When mangling names, always use the canonical decl. Fixes PR5144.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83420 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 7555ae5..702edf0 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -1303,7 +1303,7 @@
                                    "Mangling declaration");
     
     CXXNameMangler Mangler(Context, os);
-    if (!Mangler.mangle(D))
+    if (!Mangler.mangle(cast<NamedDecl>(D->getCanonicalDecl())))
       return false;
 
     os.flush();