diff options
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | lib/Frontend/CompilerInstance.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 9941eae8d4..07c0248b6c 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -48,7 +48,8 @@ using namespace clang; CompilerInstance::CompilerInstance() - : Invocation(new CompilerInvocation()), ModuleManager(0) { + : Invocation(new CompilerInvocation()), ModuleManager(0), + BuildGlobalModuleIndex(false) { } CompilerInstance::~CompilerInstance() { @@ -785,6 +786,7 @@ static void compileModule(CompilerInstance &ImportingInstance, FrontendOptions &FrontendOpts = Invocation->getFrontendOpts(); FrontendOpts.OutputFile = ModuleFileName.str(); FrontendOpts.DisableFree = false; + FrontendOpts.GenerateModuleIndex = false; FrontendOpts.Inputs.clear(); InputKind IK = getSourceInputKindFromOptions(*Invocation->getLangOpts()); @@ -858,6 +860,12 @@ static void compileModule(CompilerInstance &ImportingInstance, Instance.clearOutputFiles(/*EraseFiles=*/true); if (!TempModuleMapFileName.empty()) llvm::sys::Path(TempModuleMapFileName).eraseFromDisk(); + + // We've rebuilt a module. If we're allowed to generate or update the global + // module index, record that fact in the importing compiler instance. + if (ImportingInstance.getFrontendOpts().GenerateModuleIndex) { + ImportingInstance.setBuildGlobalModuleIndex(true); + } } ModuleLoadResult |