diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-22 02:08:40 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-22 02:08:40 +0000 |
commit | 33e0f7ef94124a53404555879666cef0e370f8c2 (patch) | |
tree | 1af12f79ff3471a8c522bd0f60eb75421a2c532c /clang/lib/Serialization/ModuleManager.cpp | |
parent | ccc025b9fec6ec28fe0ec312f67cf0c1cf3fa5bc (diff) | |
download | llvm-33e0f7ef94124a53404555879666cef0e370f8c2.zip llvm-33e0f7ef94124a53404555879666cef0e370f8c2.tar.gz llvm-33e0f7ef94124a53404555879666cef0e370f8c2.tar.bz2 |
[modules] Stop performing PCM lookups for all identifiers when building with C++ modules. Instead, serialize a list of interesting identifiers and mark those ones out of date on module import. Avoiding the identifier lookups here gives a 20-30% speedup in builds with large numbers of modules. No functionality change intended.
llvm-svn: 242868
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index a52abe6..254e8e6 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -95,6 +95,8 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, New->File = Entry; New->ImportLoc = ImportLoc; Chain.push_back(New); + if (!New->isModule()) + PCHChain.push_back(New); if (!ImportedBy) Roots.push_back(New); NewModule = true; @@ -159,6 +161,8 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, Modules.erase(Entry); assert(Chain.back() == ModuleEntry); Chain.pop_back(); + if (!ModuleEntry->isModule()) + PCHChain.pop_back(); if (Roots.back() == ModuleEntry) Roots.pop_back(); else @@ -225,6 +229,15 @@ void ModuleManager::removeModules( // Remove the modules from the chain. Chain.erase(first, last); + + // Also remove them from the PCH chain. + for (auto I = first; I != last; ++I) { + if (!(*I)->isModule()) { + PCHChain.erase(std::find(PCHChain.begin(), PCHChain.end(), *I), + PCHChain.end()); + break; + } + } } void |