]> granicus.if.org Git - clang/commitdiff
When mangling names, always use the canonical decl. Fixes PR5144.
authorAnders Carlsson <andersca@mac.com>
Tue, 6 Oct 2009 21:58:01 +0000 (21:58 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 6 Oct 2009 21:58:01 +0000 (21:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83420 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Mangle.cpp
test/CodeGenCXX/mangle.cpp

index 7555ae5da467e0756289f11e647d7f7eb2ac9039..702edf05a9625e1f0557e2c01ccc6aecc420a80e 100644 (file)
@@ -1303,7 +1303,7 @@ namespace clang {
                                    "Mangling declaration");
     
     CXXNameMangler Mangler(Context, os);
-    if (!Mangler.mangle(D))
+    if (!Mangler.mangle(cast<NamedDecl>(D->getCanonicalDecl())))
       return false;
 
     os.flush();
index 86f5fb0d5bbd59881a37a46fccca6a51b213dfd2..a881a710d490d4f20a04e18505099706c10fd09f 100644 (file)
@@ -198,3 +198,12 @@ template<typename T> typename __enable_if<__is_scalar<T>::__value, void>::__type
 template void ft7<int>();
 // CHECK: @_Z3ft7IPvEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv
 template void ft7<void*>();
+
+// PR5144
+extern "C" {
+void extern_f(void);
+};
+
+// CHECK: @extern_f
+void extern_f(void) { }
+