File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1240,11 +1240,15 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompileImpl(
12401240 Instance.createSourceManager (Instance.getFileManager ());
12411241 SourceManager &SourceMgr = Instance.getSourceManager ();
12421242
1243- // Note that this module is part of the module build stack, so that we
1244- // can detect cycles in the module graph.
1245- SourceMgr.setModuleBuildStack (getSourceManager ().getModuleBuildStack ());
1246- SourceMgr.pushModuleBuildStack (ModuleName,
1247- FullSourceLoc (ImportLoc, getSourceManager ()));
1243+ if (ThreadSafeConfig) {
1244+ // Detecting cycles in the module graph is responsibility of the client.
1245+ } else {
1246+ // Note that this module is part of the module build stack, so that we
1247+ // can detect cycles in the module graph.
1248+ SourceMgr.setModuleBuildStack (getSourceManager ().getModuleBuildStack ());
1249+ SourceMgr.pushModuleBuildStack (
1250+ ModuleName, FullSourceLoc (ImportLoc, getSourceManager ()));
1251+ }
12481252
12491253 // Make a copy for the new instance.
12501254 Instance.FailedModules = FailedModules;
You can’t perform that action at this time.
0 commit comments