summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-22 17:23:30 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-22 17:23:30 +0000
commitfc51cc968b11e805e7c9c2e01136547579e00a6e (patch)
tree652660a2c870a1f93792b1e86ea27e9a9e0d45c8 /clang
parente983d1757020b4f069310015faf11debe9bfe3c9 (diff)
downloadbcm5719-llvm-fc51cc968b11e805e7c9c2e01136547579e00a6e.tar.gz
bcm5719-llvm-fc51cc968b11e805e7c9c2e01136547579e00a6e.zip
Don't assert that linkage decls are always C++, it's not true. Fixes PR5019.
llvm-svn: 82557
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/Mangle.cpp5
-rw-r--r--clang/test/CodeGenCXX/mangle.cpp7
2 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp
index 973f0d188cb..5a994d2234b 100644
--- a/clang/lib/CodeGen/Mangle.cpp
+++ b/clang/lib/CodeGen/Mangle.cpp
@@ -279,11 +279,8 @@ void CXXNameMangler::mangleName(const NamedDecl *ND) {
// ::= <local-name>
//
const DeclContext *DC = ND->getDeclContext();
- while (isa<LinkageSpecDecl>(DC)) {
- assert(cast<LinkageSpecDecl>(DC)->getLanguage() ==
- LinkageSpecDecl::lang_cxx && "Unexpected linkage decl!");
+ while (isa<LinkageSpecDecl>(DC))
DC = DC->getParent();
- }
if (DC->isTranslationUnit() || isStdNamespace(DC)) {
// Check if we have a template.
diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp
index d952f314397..dbcd0c9460d 100644
--- a/clang/test/CodeGenCXX/mangle.cpp
+++ b/clang/test/CodeGenCXX/mangle.cpp
@@ -130,3 +130,10 @@ extern "C++" {
void h() { }
}
+// PR5019
+extern "C" { struct a { int b; }; }
+
+// CHECK: @_Z1fP1a
+int f(struct a *x) {
+ return x->b;
+}
OpenPOWER on IntegriCloud