r185713 - Fix regression from r185450.

Eli Friedman eli.friedman at gmail.com
Fri Jul 5 11:41:30 PDT 2013


Author: efriedma
Date: Fri Jul  5 13:41:30 2013
New Revision: 185713

URL: http://llvm.org/viewvc/llvm-project?rev=185713&view=rev
Log:
Fix regression from r185450.

As it turns out, the NoFunction bit for local class mangling needed to be
propagated into more places. r185450 turned what used to be an incorrect
mangling into an assertion.

Modified:
    cfe/trunk/lib/AST/ItaniumMangle.cpp
    cfe/trunk/test/CodeGenCXX/mangle-local-class-names.cpp

Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=185713&r1=185712&r2=185713&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Fri Jul  5 13:41:30 2013
@@ -326,7 +326,7 @@ private:
   void manglePrefix(NestedNameSpecifier *qualifier);
   void manglePrefix(const DeclContext *DC, bool NoFunction=false);
   void manglePrefix(QualType type);
-  void mangleTemplatePrefix(const TemplateDecl *ND);
+  void mangleTemplatePrefix(const TemplateDecl *ND, bool NoFunction=false);
   void mangleTemplatePrefix(TemplateName Template);
   void mangleOperatorName(OverloadedOperatorKind OO, unsigned Arity);
   void mangleQualifiers(Qualifiers Quals);
@@ -1250,7 +1250,7 @@ void CXXNameMangler::mangleNestedName(co
   // Check if we have a template.
   const TemplateArgumentList *TemplateArgs = 0;
   if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
-    mangleTemplatePrefix(TD);
+    mangleTemplatePrefix(TD, NoFunction);
     mangleTemplateArgs(*TemplateArgs);
   }
   else {
@@ -1513,7 +1513,8 @@ void CXXNameMangler::mangleTemplatePrefi
   mangleUnscopedTemplateName(Template);
 }
 
-void CXXNameMangler::mangleTemplatePrefix(const TemplateDecl *ND) {
+void CXXNameMangler::mangleTemplatePrefix(const TemplateDecl *ND,
+                                          bool NoFunction) {
   // <template-prefix> ::= <prefix> <template unqualified-name>
   //                   ::= <template-param>
   //                   ::= <substitution>
@@ -1530,7 +1531,7 @@ void CXXNameMangler::mangleTemplatePrefi
     return;
   }
 
-  manglePrefix(getEffectiveDeclContext(ND));
+  manglePrefix(getEffectiveDeclContext(ND), NoFunction);
   mangleUnqualifiedName(ND->getTemplatedDecl());
   addSubstitution(ND);
 }

Modified: cfe/trunk/test/CodeGenCXX/mangle-local-class-names.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-local-class-names.cpp?rev=185713&r1=185712&r2=185713&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-local-class-names.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-local-class-names.cpp Fri Jul  5 13:41:30 2013
@@ -55,3 +55,12 @@ void GORF (float IVAR1)
    }
 }
 
+// CHECK: @_ZZ25LocalTemplateFunctionTestdEN5Local3fooIdEET_S1_
+int LocalTemplateFunctionTest(double d) {
+  struct Local {
+    template<class T> T foo(T t) {
+      return t;
+    }
+  };
+  return Local().foo(d);
+}





More information about the cfe-commits mailing list