[cfe-commits] r82265 - /cfe/trunk/lib/CodeGen/Mangle.cpp

Anders Carlsson andersca at mac.com
Fri Sep 18 13:11:09 PDT 2009


Author: andersca
Date: Fri Sep 18 15:11:09 2009
New Revision: 82265

URL: http://llvm.org/viewvc/llvm-project?rev=82265&view=rev
Log:
More mangling work.

Modified:
    cfe/trunk/lib/CodeGen/Mangle.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Fri Sep 18 15:11:09 2009
@@ -511,8 +511,15 @@
   if (mangleSubstitution(cast<NamedDecl>(DC)))
     return;
 
-  manglePrefix(DC->getParent());
-  mangleUnqualifiedName(cast<NamedDecl>(DC));
+  // Check if we have a template.
+  const TemplateArgumentList *TemplateArgs = 0;
+  if (const NamedDecl *TD = isTemplate(cast<NamedDecl>(DC), TemplateArgs)) { 
+    mangleTemplatePrefix(TD);
+    mangleTemplateArgumentList(*TemplateArgs);
+  } else {
+    manglePrefix(DC->getParent());
+    mangleUnqualifiedName(cast<NamedDecl>(DC));
+  }
   
   addSubstitution(cast<NamedDecl>(DC));
 }
@@ -790,11 +797,6 @@
     mangleName(T->getDecl()->getTypedefForAnonDecl());
   else
     mangleName(T->getDecl());
-
-  // If this is a class template specialization, mangle the template arguments.
-  if (ClassTemplateSpecializationDecl *Spec
-      = dyn_cast<ClassTemplateSpecializationDecl>(T->getDecl()))
-    mangleTemplateArgumentList(Spec->getTemplateArgs());
 }
 
 // <type>       ::= <array-type>





More information about the cfe-commits mailing list