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

Anders Carlsson andersca at mac.com
Wed Sep 16 22:31:48 PDT 2009


Author: andersca
Date: Thu Sep 17 00:31:47 2009
New Revision: 82125

URL: http://llvm.org/viewvc/llvm-project?rev=82125&view=rev
Log:
Revert r82123 for now.

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=82125&r1=82124&r2=82125&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Thu Sep 17 00:31:47 2009
@@ -93,8 +93,8 @@
     void mangleCXXCtorType(CXXCtorType T);
     void mangleCXXDtorType(CXXDtorType T);
 
-    void mangleTemplateArgs(const TemplateArgumentList &L);
-    void mangleTemplateArg(const TemplateArgument &A);
+    void mangleTemplateArgumentList(const TemplateArgumentList &L);
+    void mangleTemplateArgument(const TemplateArgument &A);
   };
 }
 
@@ -252,10 +252,9 @@
   if (ND->getDeclContext()->isTranslationUnit() ||
       isStdNamespace(ND->getDeclContext())) {
     const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND);
-    if (FD && FD->getPrimaryTemplate()) {
+    if (FD && FD->getPrimaryTemplate()) 
       mangleUnscopedTemplateName(FD);
-      mangleTemplateArgs(*FD->getTemplateSpecializationArgs());
-    } else
+    else
       mangleUnscopedName(ND);
   } else if (isa<FunctionDecl>(ND->getDeclContext()))
     mangleLocalName(ND);
@@ -387,6 +386,12 @@
     assert(false && "Can't mangle a using directive name!");
     break;
   }
+
+  if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(ND)) {
+    if (const TemplateArgumentList *TemplateArgs
+          = Function->getTemplateSpecializationArgs())
+      mangleTemplateArgumentList(*TemplateArgs);
+  }
 }
 
 void CXXNameMangler::mangleSourceName(const IdentifierInfo *II) {
@@ -710,7 +715,7 @@
   // If this is a class template specialization, mangle the template arguments.
   if (ClassTemplateSpecializationDecl *Spec
       = dyn_cast<ClassTemplateSpecializationDecl>(T->getDecl()))
-    mangleTemplateArgs(Spec->getTemplateArgs());
+    mangleTemplateArgumentList(Spec->getTemplateArgs());
 }
 
 // <type>       ::= <array-type>
@@ -872,20 +877,20 @@
   }
 }
 
-void CXXNameMangler::mangleTemplateArgs(const TemplateArgumentList &L) {
+void CXXNameMangler::mangleTemplateArgumentList(const TemplateArgumentList &L) {
   // <template-args> ::= I <template-arg>+ E
   Out << "I";
 
   for (unsigned i = 0, e = L.size(); i != e; ++i) {
     const TemplateArgument &A = L[i];
 
-    mangleTemplateArg(A);
+    mangleTemplateArgument(A);
   }
 
   Out << "E";
 }
 
-void CXXNameMangler::mangleTemplateArg(const TemplateArgument &A) {
+void CXXNameMangler::mangleTemplateArgument(const TemplateArgument &A) {
   // <template-arg> ::= <type>              # type or template
   //                ::= X <expression> E    # expression
   //                ::= <expr-primary>      # simple expressions
@@ -927,11 +932,6 @@
 }
 
 bool CXXNameMangler::mangleSubstitution(QualType T) {
-  if (!T.getCVRQualifiers()) {
-    if (const RecordType *RT = dyn_cast<RecordType>(T))
-      return mangleSubstitution(RT->getDecl());
-  }
-  
   uintptr_t TypePtr = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
 
   return mangleSubstitution(TypePtr);
@@ -972,13 +972,6 @@
 }
 
 void CXXNameMangler::addSubstitution(QualType T) {
-  if (!T.getCVRQualifiers()) {
-    if (const RecordType *RT = dyn_cast<RecordType>(T)) {
-      addSubstitution(RT->getDecl());
-      return;
-    }
-  }
-  
   uintptr_t TypePtr = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
   addSubstitution(TypePtr);
 }

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

==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-subst.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-subst.cpp Thu Sep 17 00:31:47 2009
@@ -24,11 +24,3 @@
 
 // CHECK: define void @_Z1fN1A1AENS_1BE(
 void f(A::A a, A::B b) { }
-
-struct C { struct D { }; };
-
-// CHECK: define void @_Z1fP1CNS_1DE
-void f(C*, C::D) { }
-
-// CHECK: define void @_Z1fN1C1DEPKS_
-void f(C::D, const C*) { }





More information about the cfe-commits mailing list