<rdar://problem/13479539> Only rebuild the global module cache when we're allowed to.
This eliminates excessive rebuilds of the global module cache.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177766 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 633f3c5..f83c870 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -62,7 +62,8 @@
bool CompilerInstance::shouldBuildGlobalModuleIndex() const {
return (BuildGlobalModuleIndex ||
- (ModuleManager && ModuleManager->isGlobalIndexUnavailable())) &&
+ (ModuleManager && ModuleManager->isGlobalIndexUnavailable() &&
+ getFrontendOpts().GenerateGlobalModuleIndex)) &&
!ModuleBuildFailed;
}