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 | 4fc9f3e819d64b244f322c213e2dab10bd85636f (patch) | |
tree | bbf574d05acff4fcbe42ca396f0e384bb3504346 /clang/lib/Serialization/ModuleManager.cpp | |
parent | c3cc110bb43a3d84782a7f72210cd68e15870d04 (diff) | |
download | bcm5719-llvm-4fc9f3e819d64b244f322c213e2dab10bd85636f.tar.gz bcm5719-llvm-4fc9f3e819d64b244f322c213e2dab10bd85636f.zip |
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.
llvm-svn: 148412
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 4470855ec7a..ab364b7ebd2 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/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; |