[cfe-commits] r134967 - in /cfe/trunk: lib/AST/ItaniumMangle.cpp test/CodeGenCXX/mangle.cpp

Douglas Gregor dgregor at apple.com
Mon Jul 11 22:06:05 PDT 2011


Author: dgregor
Date: Tue Jul 12 00:06:05 2011
New Revision: 134967

URL: http://llvm.org/viewvc/llvm-project?rev=134967&view=rev
Log:
Mangle dependent template names of unknown arity

Modified:
    cfe/trunk/lib/AST/ItaniumMangle.cpp
    cfe/trunk/test/CodeGenCXX/mangle.cpp

Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=134967&r1=134966&r2=134967&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Tue Jul 12 00:06:05 2011
@@ -593,19 +593,13 @@
   if (mangleSubstitution(Template))
     return;
 
-  // FIXME: How to cope with operators here?
   DependentTemplateName *Dependent = Template.getAsDependentTemplateName();
   assert(Dependent && "Not a dependent template name?");
-  if (!Dependent->isIdentifier()) {
-    // FIXME: We can't possibly know the arity of the operator here!
-    Diagnostic &Diags = Context.getDiags();
-    unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error,
-                                      "cannot mangle dependent operator name");
-    Diags.Report(DiagID);
-    return;
-  }
+  if (const IdentifierInfo *Id = Dependent->getIdentifier())
+    mangleSourceName(Id);
+  else
+    mangleOperatorName(Dependent->getOperator(), UnknownArity);
   
-  mangleSourceName(Dependent->getIdentifier());
   addSubstitution(Template);
 }
 

Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=134967&r1=134966&r2=134967&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Tue Jul 12 00:06:05 2011
@@ -826,3 +826,16 @@
   // CHECK: define weak_odr void @_ZN6test342f3ILy4EEEvRAplT_Ly8E_i
   template void f3<4>(int (&)[4 + sizeof(int*)]);
 }
+
+namespace test35 {
+  // Dependent operator names of unknown arity.
+  struct A { 
+    template<typename U> A operator+(U) const;
+  };
+
+  template<typename T>
+  void f1(decltype(sizeof(&T::template operator+<int>))) {}
+
+  // CHECK: define weak_odr void @_ZN6test352f1INS_1AEEEvDTszadsrT_plIiEE
+  template void f1<A>(__SIZE_TYPE__);
+}





More information about the cfe-commits mailing list