diff options
author | Alexander Neundorf <neundorf@kde.org> | 2009-09-23 18:02:05 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2009-09-23 18:02:05 (GMT) |
commit | 39383ef8cb691656012275721064baef1e4f7511 (patch) | |
tree | 8d16274bd2092a6abe925bc7756c8a23594fd4b6 /Source/cmDepends.h | |
parent | 551fcc23c220fd75eaeea7671f28e8360e466b75 (diff) | |
download | CMake-39383ef8cb691656012275721064baef1e4f7511.zip CMake-39383ef8cb691656012275721064baef1e4f7511.tar.gz CMake-39383ef8cb691656012275721064baef1e4f7511.tar.bz2 |
Major optimization of C/C++ dependency scanning.
Now only the dependencies for the file where the dependencies actually may
have changed are rescanned, before that this was done for all source files
even if only one source file had changed.
This reduces e.g. on my machine the time for scanning the dependencies
of kdelibs/khtml/ when only one file (khtml_global.cpp) has changed from
around 7.5 seconds to 1.2 seconds.
The tests succeed, it does what I expected it to do on kdelibs, and Brad
also reviewed the patch, so I think it should be ok.
Alex
Diffstat (limited to 'Source/cmDepends.h')
-rw-r--r-- | Source/cmDepends.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/cmDepends.h b/Source/cmDepends.h index 75afaaf..0fc66f8 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -59,12 +59,16 @@ public: /** Write dependencies for the target file. */ bool Write(std::ostream &makeDepends, std::ostream &internalDepends); - + + class DependencyVector: public std::vector<std::string> {}; + /** Check dependencies for the target file. Returns true if dependencies are okay and false if they must be generated. If they must be generated Clear has already been called to wipe out - the old dependencies. */ - bool Check(const char *makeFile, const char* internalFile); + the old dependencies. + Dependencies which are still valid will be stored in validDeps. */ + bool Check(const char *makeFile, const char* internalFile, + std::map<std::string, DependencyVector>& validDeps); /** Clear dependencies for the target file so they will be regenerated. */ void Clear(const char *file); @@ -83,7 +87,8 @@ protected: // Check dependencies for the target file in the given stream. // Return false if dependencies must be regenerated and true // otherwise. - virtual bool CheckDependencies(std::istream& internalDepends); + virtual bool CheckDependencies(std::istream& internalDepends, + std::map<std::string, DependencyVector>& validDeps); // Finalize the dependency information for the target. virtual bool Finalize(std::ostream& makeDepends, |