Skip to content

Commit 6b07132

Browse files
Merge pull request #33572 from varungandhi-apple/vg-fix-clang-module-self-cycle
[ModuleTrace] Early exit if a Clang module imports itself.
2 parents 7daed3c + 260125e commit 6b07132

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,9 @@ void ABIDependencyEvaluator::computeABIDependenciesForClangModule(
588588
}
589589
if (import->isNonSwiftModule()
590590
&& module->getTopLevelModule() == import->getTopLevelModule()
591-
&& !import->findUnderlyingClangModule()
592-
->isSubModuleOf(module->findUnderlyingClangModule())) {
591+
&& (module == import
592+
|| !import->findUnderlyingClangModule()
593+
->isSubModuleOf(module->findUnderlyingClangModule()))) {
593594
continue;
594595
}
595596
computeABIDependenciesForModule(import);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Outer {
2+
module Inner {
3+
export Outer.Inner
4+
}
5+
export Outer
6+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Check that this doesn't crash due to a self-cycle. rdar://67435472
2+
// RUN: %target-swift-frontend %s -emit-module -o /dev/null -emit-loaded-module-trace-path /dev/null -I %S/Inputs/imported_modules/SelfImport
3+
4+
import Outer

0 commit comments

Comments
 (0)