Skip to content

Commit 2409e33

Browse files
committed
[cxx-interop] Fix an assertion for extern "C" blocks
rdar://158896622 / resolves swiftlang#83861
1 parent b444a0b commit 2409e33

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/AST/ASTMangler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,6 +2560,8 @@ ASTMangler::getSpecialManglingContext(const ValueDecl *decl,
25602560
hasNameForLinkage = !clangDecl->getDeclName().isEmpty();
25612561
if (hasNameForLinkage) {
25622562
auto *clangDC = clangDecl->getDeclContext();
2563+
while (isa<clang::LinkageSpecDecl>(clangDC))
2564+
clangDC = clangDC->getParent();
25632565
// In C, "nested" structs, unions, enums, etc. will become siblings:
25642566
// struct Foo { struct Bar { }; }; -> struct Foo { }; struct Bar { };
25652567
// Whereas in C++, nested records will actually be nested. So if this is

0 commit comments

Comments
 (0)