aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r--lib/Frontend/CompilerInstance.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index e3689c0c52..c56cc3d9db 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -658,10 +658,18 @@ static void compileModule(CompilerInstance &ImportingInstance,
// Construct a compiler invocation for creating this module.
llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation
(new CompilerInvocation(ImportingInstance.getInvocation()));
+
+ // For any options that aren't intended to affect how a module is built,
+ // reset them to their default values.
Invocation->getLangOpts().resetNonModularOptions();
Invocation->getPreprocessorOpts().resetNonModularOptions();
+
+ // Note that this module is part of the module build path, so that we
+ // can detect cycles in the module graph.
Invocation->getPreprocessorOpts().ModuleBuildPath.push_back(ModuleName);
+ // Set up the inputs/outputs so that we build the module from its umbrella
+ // header.
FrontendOptions &FrontendOpts = Invocation->getFrontendOpts();
FrontendOpts.OutputFile = ModuleFileName.str();
FrontendOpts.DisableFree = false;