diff options
author | Brad King <brad.king@kitware.com> | 2017-09-22 14:17:00 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-09-22 14:17:49 (GMT) |
commit | 4609aaf513ffd6f253ec7c8a8bca6bb93d7eede5 (patch) | |
tree | a4fac206b20ac4a8b8888ca7898fac78fcf2b680 /Source/cmMakefile.h | |
parent | 7df7eea7cf9c0bcaa7c690a6f56995704c78a7b6 (diff) | |
parent | 3b95ab569345028a1a8fe521d5ecd81fa97f2653 (diff) | |
download | CMake-4609aaf513ffd6f253ec7c8a8bca6bb93d7eede5.zip CMake-4609aaf513ffd6f253ec7c8a8bca6bb93d7eede5.tar.gz CMake-4609aaf513ffd6f253ec7c8a8bca6bb93d7eede5.tar.bz2 |
Merge topic 'perf-source-lookup'
3b95ab56 Performance: Improve efficiency of source file lookup in cmMakefile
e0188803 cmMakefile: Drop unused method
fe1e811b cmSourceFileLocation: Drop unnecessary copy-assignment operator
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1154
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r-- | Source/cmMakefile.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 398604d..2cae659 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -13,6 +13,7 @@ #include <stddef.h> #include <string> #include <unordered_map> +#include <unordered_set> #include <vector> #include "cmAlgorithms.h" @@ -623,7 +624,6 @@ public: { return this->SourceFiles; } - std::vector<cmSourceFile*>& GetSourceFiles() { return this->SourceFiles; } /** * Is there a source file that has the provided source file as an output? @@ -809,7 +809,17 @@ protected: // libraries, classes, and executables mutable cmTargets Targets; std::map<std::string, std::string> AliasTargets; + std::vector<cmSourceFile*> SourceFiles; + // Because cmSourceFile names are compared in a fuzzy way (see + // cmSourceFileLocation::Match()) we can't have a straight mapping from + // filename to cmSourceFile. To make lookups more efficient we store the + // Name portion of the cmSourceFileLocation and then compare on the list of + // cmSourceFiles that might match that name. Note that on platforms which + // have a case-insensitive filesystem we store the key in all lowercase. + typedef std::unordered_set<cmSourceFile*> SourceFileSet; + typedef std::unordered_map<std::string, SourceFileSet> SourceFileMap; + SourceFileMap SourceFileSearchIndex; // Tests std::map<std::string, cmTest*> Tests; |