[cfe-commits] r82557 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle.cpp

Anders Carlsson andersca at mac.com
Tue Sep 22 10:23:30 PDT 2009


Author: andersca
Date: Tue Sep 22 12:23:30 2009
New Revision: 82557

URL: http://llvm.org/viewvc/llvm-project?rev=82557&view=rev
Log:
Don't assert that linkage decls are always C++, it's not true. Fixes PR5019.

Modified:
    cfe/trunk/lib/CodeGen/Mangle.cpp
    cfe/trunk/test/CodeGenCXX/mangle.cpp

Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=82557&r1=82556&r2=82557&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Tue Sep 22 12:23:30 2009
@@ -279,11 +279,8 @@
   //         ::= <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.

Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=82557&r1=82556&r2=82557&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Tue Sep 22 12:23:30 2009
@@ -130,3 +130,10 @@
  void h() { } 
 }
 
+// PR5019
+extern "C" { struct a { int b; }; }
+
+// CHECK: @_Z1fP1a
+int f(struct a *x) {
+    return x->b;
+}





More information about the cfe-commits mailing list