[MS ABI] Add variable templates to the NameBackReferences
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 30 Dec 2015 05:40:32 +0000 (05:40 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 30 Dec 2015 05:40:32 +0000 (05:40 +0000)
Only function template specializations are exempt from being added to
the NameBackReferences.  Redundant variable template specializations
should be appropriately substituted.

llvm-svn: 256623

clang/lib/AST/MicrosoftMangle.cpp
clang/test/CodeGenCXX/mangle-ms-cxx14.cpp

index 87d088cc11aa2e4e930e56a7dc0b50b525896cef..136a43b640f71001a47d32af2c676f08b643821c 100644 (file)
@@ -698,7 +698,7 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
     // Function templates aren't considered for name back referencing.  This
     // makes sense since function templates aren't likely to occur multiple
     // times in a symbol.
-    if (!isa<ClassTemplateDecl>(TD)) {
+    if (isa<FunctionTemplateDecl>(TD)) {
       mangleTemplateInstantiationName(TD, *TemplateArgs);
       Out << '@';
       return;
index d649c59aed0df3621c98df235677cecb9dda4dcd..9d30c406c8c720dafd4309316c0b578d5c3b7088 100644 (file)
@@ -49,3 +49,9 @@ int WithPMD = 0;
 
 template <> int WithPMD<nullptr>;
 // CHECK-DAG: "\01??$WithPMD@$GA@A@?0@@3HA"
+
+template <const int *, const int *>
+struct Foo {};
+
+Foo<&x<int>, &x<int>> Zoo;
+// CHECK-DAG: "\01?Zoo@@3U?$Foo@$1??$x@H@@3HA$1?1@3HA@@A"