Skip to content

Commit 953dfec

Browse files
committed
[interop] fix swift-ide-test module interface namespace printing crash for _impl namespace in swift_private namespace
1 parent 70b982f commit 953dfec

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,9 @@ namespace {
11061106
auto parentNS = cast<clang::NamespaceDecl>(decl->getParent());
11071107
auto parent =
11081108
Impl.importDecl(parentNS, getVersion(), /*UseCanonicalDecl*/ false);
1109+
// The parent namespace might not be imported if it's `swift_private`.
1110+
if (!parent)
1111+
return nullptr;
11091112
dc = cast<EnumDecl>(parent);
11101113
}
11111114

test/Interop/SwiftToCxxToSwift/hide-swift-module-namespace-in-swift.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
// RUN: %check-interop-cxx-header-in-clang(%t/swiftMod2.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -Wno-error)
1111

12+
// RUN: %target-swift-ide-test -print-module -module-to-print=SwiftToCxxTest -I %t -source-filename=x -enable-experimental-cxx-interop -Xcc -DSWIFT_CXX_INTEROP_HIDE_SWIFT_ERROR
13+
1214
// XFAIL: OS=linux-android, OS=linux-androideabi
1315

1416
//--- header.h

0 commit comments

Comments
 (0)