summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx2
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp1
-rw-r--r--Source/cmCTest.cxx7
-rw-r--r--Source/cmListFileCache.cxx95
-rw-r--r--Source/cmListFileCache.h32
-rw-r--r--Source/cmMakefile.cxx10
-rw-r--r--Source/cmTryCompileCommand.cxx1
-rw-r--r--Source/cmTryRunCommand.cxx1
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Source/ctest.cxx1
10 files changed, 13 insertions, 138 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 5220fc8..a32d2e6 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -48,10 +48,8 @@ int cmCTestBuildAndTestHandler::ProcessHandler()
m_Output = "";
std::string output;
cmSystemTools::ResetErrorOccuredFlag();
- cmListFileCache::ClearCache();
int retv = this->RunCMakeAndTest(&m_Output);
cmSystemTools::ResetErrorOccuredFlag();
- cmListFileCache::ClearCache();
return retv;
}
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index a6ebc46..534f713 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -212,7 +212,6 @@ CMakeSetupDialog::~CMakeSetupDialog()
{
delete m_CMakeInstance;
// clean up globals
- cmListFileCache::GetInstance()->ClearCache();
cmDynamicLoader::FlushCache();
}
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 29e7f1d..fd96447 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1656,13 +1656,6 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
cmCTestBuildAndTestHandler* handler =
static_cast<cmCTestBuildAndTestHandler*>(this->GetHandler("buildtest"));
int retv = handler->ProcessHandler();
- /*
- cmSystemTools::ResetErrorOccuredFlag();
- cmListFileCache::ClearCache();
- int retv = this->RunCMakeAndTest(output);
- cmSystemTools::ResetErrorOccuredFlag();
- cmListFileCache::ClearCache();
- */
*output = handler->GetOutput();
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDynamicLoader::FlushCache();
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 35a596d..2013fb4 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -25,65 +25,7 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
cmListFileFunction& function,
const char* filename);
-cmListFileCache* cmListFileCache::Instance = 0;
-
-
-cmListFileCache* cmListFileCache::GetInstance()
-{
- if(!cmListFileCache::Instance)
- {
- cmListFileCache::Instance = new cmListFileCache;
- }
- return cmListFileCache::Instance;
-}
-
-
-void cmListFileCache::ClearCache()
-{
- delete cmListFileCache::Instance;
- cmListFileCache::Instance = 0;
-}
-
-
-
-cmListFile* cmListFileCache::GetFileCache(const char* path,
- bool requireProjectCommand)
-{
- ListFileMap::iterator sl = m_ListFileCache.find(path);
- if (sl == m_ListFileCache.end())
- {
- // if not already in the map, then parse and store the
- // file
- if(!this->CacheFile(path, requireProjectCommand))
- {
- return 0;
- }
- sl = m_ListFileCache.find(path);
- if (sl == m_ListFileCache.end())
- {
- cmSystemTools::Error("Fatal error, in cmListFileCache CacheFile failed",
- path);
- return 0;
- }
- }
- cmListFile& ret = sl->second;
- if(cmSystemTools::ModifiedTime(path) > ret.m_ModifiedTime )
- {
- if(!this->CacheFile(path, requireProjectCommand))
- {
- return 0;
- }
- else
- {
- sl = m_ListFileCache.find(path);
- return &sl->second;
- }
- }
- return &ret;
-}
-
-
-bool cmListFileCache::CacheFile(const char* path, bool requireProjectCommand)
+bool cmListFile::ParseFile(const char* path, bool requireProjectCommand)
{
if(!cmSystemTools::FileExists(path))
{
@@ -110,8 +52,7 @@ bool cmListFileCache::CacheFile(const char* path, bool requireProjectCommand)
// Use a simple recursive-descent parser to process the token
// stream.
- cmListFile inFile;
- inFile.m_ModifiedTime = cmSystemTools::ModifiedTime(filename);
+ this->m_ModifiedTime = cmSystemTools::ModifiedTime(filename);
bool parseError = false;
bool haveNewline = true;
cmListFileLexer_Token* token;
@@ -132,7 +73,7 @@ bool cmListFileCache::CacheFile(const char* path, bool requireProjectCommand)
inFunction.m_Line = token->line;
if(cmListFileCacheParseFunction(lexer, inFunction, filename))
{
- inFile.m_Functions.push_back(inFunction);
+ this->m_Functions.push_back(inFunction);
}
else
{
@@ -166,7 +107,7 @@ bool cmListFileCache::CacheFile(const char* path, bool requireProjectCommand)
}
if (parseError)
{
- inFile.m_ModifiedTime = 0;
+ this->m_ModifiedTime = 0;
}
cmListFileLexer_Delete(lexer);
@@ -176,8 +117,8 @@ bool cmListFileCache::CacheFile(const char* path, bool requireProjectCommand)
bool hasProject = false;
// search for a project command
for(std::vector<cmListFileFunction>::iterator i
- = inFile.m_Functions.begin();
- i != inFile.m_Functions.end(); ++i)
+ = this->m_Functions.begin();
+ i != this->m_Functions.end(); ++i)
{
if(cmSystemTools::LowerCase(i->m_Name) == "project")
{
@@ -192,23 +133,12 @@ bool cmListFileCache::CacheFile(const char* path, bool requireProjectCommand)
project.m_Name = "PROJECT";
cmListFileArgument prj("Project", false, filename, 0);
project.m_Arguments.push_back(prj);
- inFile.m_Functions.insert(inFile.m_Functions.begin(),project);
+ this->m_Functions.insert(this->m_Functions.begin(),project);
}
}
- m_ListFileCache[filename] = inFile;
return true;
}
-void cmListFileCache::FlushCache(const char* path)
-{
- ListFileMap::iterator it = m_ListFileCache.find(path);
- if ( it != m_ListFileCache.end() )
- {
- m_ListFileCache.erase(it);
- return;
- }
-}
-
bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
cmListFileFunction& function,
const char* filename)
@@ -284,7 +214,7 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
}
//----------------------------------------------------------------------------
-const char* cmListFileCache::GetUniqueStringPointer(const char* name)
+const char* cmListFile::GetUniqueStringPointer(const char* name)
{
UniqueStrings::iterator i = m_UniqueStrings.find(name);
if(i == m_UniqueStrings.end())
@@ -296,12 +226,3 @@ const char* cmListFileCache::GetUniqueStringPointer(const char* name)
return i->second;
}
-//----------------------------------------------------------------------------
-cmListFileCache::~cmListFileCache()
-{
- for(UniqueStrings::iterator i = m_UniqueStrings.begin();
- i != m_UniqueStrings.end(); ++i)
- {
- delete [] i->second;
- }
-}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 17239d2..fc35c37 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -62,42 +62,12 @@ struct cmListFile
:m_ModifiedTime(0)
{
}
+ bool ParseFile(const char* path, bool requireProjectCommand);
long int m_ModifiedTime;
std::vector<cmListFileFunction> m_Functions;
-};
-
-class cmListFileCache
-{
-public:
- static cmListFileCache* GetInstance();
- static void ClearCache();
-
-
- /** Return the cached version of the given file.
- * If the file is not already in the cache, a cache entry
- * will be made. If there is an error loading the file,
- * NULL is returned. If requireProjectCommand is true,
- * then a PROJECT(Project) command will be added to the file
- * if it does not have a PROJECT command in it.
- */
- cmListFile* GetFileCache(const char* path, bool requireProjectCommand);
-
- //! Flush cache file out of cache.
- void FlushCache(const char* path);
-
- ~cmListFileCache();
-private:
- // Cache the file
- bool CacheFile(const char* path, bool requireProjectCommand);
- // private data
- typedef std::map<cmStdString, cmListFile> ListFileMap;
- ListFileMap m_ListFileCache; // file name to ListFile map
-
typedef std::map<cmStdString, char*> UniqueStrings;
UniqueStrings m_UniqueStrings;
const char* GetUniqueStringPointer(const char* name);
-
- static cmListFileCache* Instance; // singelton pointer
};
#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7d38acc..4fb853b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -378,20 +378,18 @@ bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in)
}
}
- cmListFile* lf =
- cmListFileCache::GetInstance()->GetFileCache(filenametoread,
- requireProjectCommand);
- if(!lf)
+ cmListFile cacheFile;
+ if( !cacheFile.ParseFile(filenametoread, requireProjectCommand) )
{
this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentFile.c_str());
return false;
}
// add this list file to the list of dependencies
m_ListFiles.push_back( filenametoread);
- const size_t numberFunctions = lf->m_Functions.size();
+ const size_t numberFunctions = cacheFile.m_Functions.size();
for(size_t i =0; i < numberFunctions; ++i)
{
- this->ExecuteCommand(lf->m_Functions[i]);
+ this->ExecuteCommand(cacheFile.m_Functions[i]);
if ( cmSystemTools::GetFatalErrorOccured() )
{
this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentFile.c_str());
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index 900d2d7..faafde9 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -243,7 +243,6 @@ int cmTryCompileCommand::CoreTryCompileCode(
// if They specified clean then we clean up what we can
if (srcFileSignature && clean)
{
- cmListFileCache::GetInstance()->FlushCache(outFileName.c_str());
if(!mf->GetCMakeInstance()->GetDebugTryCompile())
{
cmTryCompileCommand::CleanupFiles(binaryDirectory);
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index a2179d8..f8525a3 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -152,7 +152,6 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
// if we created a directory etc, then cleanup after ourselves
std::string cacheFile = binaryDirectory;
cacheFile += "/CMakeLists.txt";
- cmListFileCache::GetInstance()->FlushCache(cacheFile.c_str());
if(!m_Makefile->GetCMakeInstance()->GetDebugTryCompile())
{
cmTryCompileCommand::CleanupFiles(binaryDirectory.c_str());
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index e63c319..1b52f26 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -121,7 +121,6 @@ int main(int ac, char** av)
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDynamicLoader::FlushCache();
#endif
- cmListFileCache::ClearCache();
return ret;
}
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index a2471d4..5a9053f 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -237,7 +237,6 @@ int main (int argc, char *argv[])
std::string output;
int res = inst.Run(args,&output);
cmCTestLog(&inst, OUTPUT, output);
- cmListFileCache::ClearCache();
return res;
}