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

Anders Carlsson andersca at mac.com
Fri Nov 6 20:26:04 PST 2009


Author: andersca
Date: Fri Nov  6 22:26:04 2009
New Revision: 86339

URL: http://llvm.org/viewvc/llvm-project?rev=86339&view=rev
Log:
When looking up and adding substitutions to the substitution table, make sure to always use the canonical declaration. With tihs change, FileCheck compiles and links but crashes during startup.

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

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

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Fri Nov  6 22:26:04 2009
@@ -65,6 +65,8 @@
     bool mangleStandardSubstitution(const NamedDecl *ND);
     
     void addSubstitution(const NamedDecl *ND) {
+      ND = cast<NamedDecl>(ND->getCanonicalDecl());
+
       addSubstitution(reinterpret_cast<uintptr_t>(ND));
     }
     void addSubstitution(QualType T);
@@ -1174,6 +1176,7 @@
   if (mangleStandardSubstitution(ND))
     return true;
   
+  ND = cast<NamedDecl>(ND->getCanonicalDecl());
   return mangleSubstitution(reinterpret_cast<uintptr_t>(ND));
 }
 

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

==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-subst.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-subst.cpp Fri Nov  6 22:26:04 2009
@@ -59,3 +59,11 @@
 // CHECK: @_Z1fPKcS0_
 void f(const char*, const char*) {}
 
+namespace NS {
+  class C;
+}
+
+namespace NS {
+  // CHECK: @_ZN2NS1fERNS_1CE
+  void f(C&) { } 
+}





More information about the cfe-commits mailing list