summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/Mangle.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-17 16:12:20 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-17 16:12:20 +0000
commitca51ef156b2aeec798598d44bdd00a2296f9a1d1 (patch)
tree80134b519fed038986c25bce701c7666557cec4a /clang/lib/CodeGen/Mangle.cpp
parent5ff90ed33ef6409c71b5557ec5f301c004d2ab43 (diff)
downloadbcm5719-llvm-ca51ef156b2aeec798598d44bdd00a2296f9a1d1.tar.gz
bcm5719-llvm-ca51ef156b2aeec798598d44bdd00a2296f9a1d1.zip
Ignore extern "C++" { } when mangling.
llvm-svn: 82146
Diffstat (limited to 'clang/lib/CodeGen/Mangle.cpp')
-rw-r--r--clang/lib/CodeGen/Mangle.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp
index 8241ad61d07..aaa771b21de 100644
--- a/clang/lib/CodeGen/Mangle.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud