diff options
author | Anders Carlsson <andersca@mac.com> | 2009-09-17 16:12:20 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-09-17 16:12:20 +0000 |
commit | d58d6f778de936516d8815783f2e88348c41dce4 (patch) | |
tree | ad21fab20b16ebd1c9458463bb0e5e01e106395d | |
parent | 501d8a600e1652f427a092c7a82418ab097848ef (diff) |
Ignore extern "C++" { } when mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82146 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/Mangle.cpp | 12 | ||||
-rw-r--r-- | test/CodeGenCXX/mangle.cpp | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index 8241ad61d0..aaa771b21d 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -249,14 +249,20 @@ void CXXNameMangler::mangleName(const NamedDecl *ND) { // ::= <unscoped-template-name> <template-args> // ::= <local-name> // - if (ND->getDeclContext()->isTranslationUnit() || - isStdNamespace(ND->getDeclContext())) { + const DeclContext *DC = ND->getDeclContext(); + while (isa<LinkageSpecDecl>(DC)) { + assert(cast<LinkageSpecDecl>(DC)->getLanguage() == + LinkageSpecDecl::lang_cxx && "Unexpected linkage decl!"); + DC = DC->getParent(); + } + + if (DC->isTranslationUnit() || isStdNamespace(DC)) { const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND); if (FD && FD->getPrimaryTemplate()) mangleUnscopedTemplateName(FD); else mangleUnscopedName(ND); - } else if (isa<FunctionDecl>(ND->getDeclContext())) + } else if (isa<FunctionDecl>(DC)) mangleLocalName(ND); else mangleNestedName(ND); diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 65ef0083e4..98db0845c7 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -99,3 +99,8 @@ void g() { // CHECK: @_Z3ft2IcEvT_PFvS0_ES2_ ft2<char>(1, 0, 0); } + +extern "C++" { + // CHECK: @_Z1hv + void h() { } +} |