Skip to content

Commit 5dc2817

Browse files
authored
Merge pull request swiftlang#83874 from egorzhdan/egorzhdan/redecl-context-assertion
[cxx-interop] Fix an assertion for `extern "C"` blocks
2 parents b420cd2 + 2409e33 commit 5dc2817

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
@@ -2578,6 +2578,8 @@ ASTMangler::getSpecialManglingContext(const ValueDecl *decl,
25782578
hasNameForLinkage = !clangDecl->getDeclName().isEmpty();
25792579
if (hasNameForLinkage) {
25802580
auto *clangDC = clangDecl->getDeclContext();
2581+
while (isa<clang::LinkageSpecDecl>(clangDC))
2582+
clangDC = clangDC->getParent();
25812583
// In C, "nested" structs, unions, enums, etc. will become siblings:
25822584
// struct Foo { struct Bar { }; }; -> struct Foo { }; struct Bar { };
25832585
// Whereas in C++, nested records will actually be nested. So if this is

0 commit comments

Comments
 (0)