diff options
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 8596dd0..1526ea5 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -1240,11 +1240,15 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompileImpl( Instance.createSourceManager(Instance.getFileManager()); SourceManager &SourceMgr = Instance.getSourceManager(); - // Note that this module is part of the module build stack, so that we - // can detect cycles in the module graph. - SourceMgr.setModuleBuildStack(getSourceManager().getModuleBuildStack()); - SourceMgr.pushModuleBuildStack(ModuleName, - FullSourceLoc(ImportLoc, getSourceManager())); + if (ThreadSafeConfig) { + // Detecting cycles in the module graph is responsibility of the client. + } else { + // Note that this module is part of the module build stack, so that we + // can detect cycles in the module graph. + SourceMgr.setModuleBuildStack(getSourceManager().getModuleBuildStack()); + SourceMgr.pushModuleBuildStack( + ModuleName, FullSourceLoc(ImportLoc, getSourceManager())); + } // Make a copy for the new instance. Instance.FailedModules = FailedModules; |