summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-01-25 01:03:03 +0000
committerDouglas Gregor <dgregor@apple.com>2013-01-25 01:03:03 +0000
commite060e57bf74681939ffab90ff743ab8594a8b866 (patch)
treea1dfdd31544afed4c34e2e1b9fc9eb8bc97d16ec /clang/lib/Frontend/CompilerInstance.cpp
parentc1bbec85a87c9a929b1814a0b316ed28e6e224af (diff)
downloadbcm5719-llvm-e060e57bf74681939ffab90ff743ab8594a8b866.tar.gz
bcm5719-llvm-e060e57bf74681939ffab90ff743ab8594a8b866.zip
Implement the reader of the global module index and wire it into the
AST reader. The global module index tracks all of the identifiers known to a set of module files. Lookup of those identifiers looks first in the global module index, which returns the set of module files in which that identifier can be found. The AST reader only needs to look into those module files and any module files not known to the global index (e.g., because they were (re)built after the global index), reducing the number of on-disk hash tables to visit. For an example source I'm looking at, we go from 237844 total identifier lookups into on-disk hash tables down to 126817. Unfortunately, this does not translate into a performance advantage. At best, it's a wash once the global module index has been built, but that's ignore the cost of building the global module index (which is itself fairly large). Profiles show that the global module index code is far less efficient than it should be; optimizing it might give enough of an advantage to justify its continued inclusion. llvm-svn: 173405
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 0e60c399220..a7f0770ec7b 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -61,7 +61,9 @@ void CompilerInstance::setInvocation(CompilerInvocation *Value) {
}
bool CompilerInstance::shouldBuildGlobalModuleIndex() const {
- return BuildGlobalModuleIndex && !ModuleBuildFailed;
+ return (BuildGlobalModuleIndex ||
+ (ModuleManager && ModuleManager->isGlobalIndexUnavailable())) &&
+ !ModuleBuildFailed;
}
void CompilerInstance::setDiagnostics(DiagnosticsEngine *Value) {
OpenPOWER on IntegriCloud