diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-18 20:56:22 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-18 20:56:22 +0000 |
commit | 057df20b3107cef764052d271c89b8591b98b3ce (patch) | |
tree | 656d5b6add01e885f09487b746d302e7794f7a9b /lib/Serialization/ModuleManager.cpp | |
parent | c2a8d6cee01fc4845f5409bf5c021a64616ac8c3 (diff) |
Optimize unqualified/global name lookup in modules by introducing a
generational scheme for identifiers that avoids searching the hash
tables of a given module more than once for a given
identifier. Previously, loading any new module invalidated all of the
previous lookup results for all identifiers, causing us to perform the
lookups repeatedly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | lib/Serialization/ModuleManager.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Serialization/ModuleManager.cpp b/lib/Serialization/ModuleManager.cpp index 4470855ec7..ab364b7ebd 100644 --- a/lib/Serialization/ModuleManager.cpp +++ b/lib/Serialization/ModuleManager.cpp @@ -35,7 +35,8 @@ llvm::MemoryBuffer *ModuleManager::lookupBuffer(StringRef Name) { std::pair<ModuleFile *, bool> ModuleManager::addModule(StringRef FileName, ModuleKind Type, - ModuleFile *ImportedBy, std::string &ErrorStr) { + ModuleFile *ImportedBy, unsigned Generation, + std::string &ErrorStr) { const FileEntry *Entry = FileMgr.getFile(FileName); if (!Entry && FileName != "-") { ErrorStr = "file not found"; @@ -47,7 +48,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, bool NewModule = false; if (!ModuleEntry) { // Allocate a new module. - ModuleFile *New = new ModuleFile(Type); + ModuleFile *New = new ModuleFile(Type, Generation); New->FileName = FileName.str(); Chain.push_back(New); NewModule = true; |