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

John McCall rjmccall at apple.com
Fri Jul 23 18:17:35 PDT 2010


Author: rjmccall
Date: Fri Jul 23 20:17:35 2010
New Revision: 109315

URL: http://llvm.org/viewvc/llvm-project?rev=109315&view=rev
Log:
Mangle enum constant expressions.  Fixes rdar://problem/8204122


Modified:
    cfe/trunk/lib/CodeGen/Mangle.cpp
    cfe/trunk/test/CodeGenCXX/mangle.cpp

Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=109315&r1=109314&r2=109315&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Fri Jul 23 20:17:35 2010
@@ -1873,6 +1873,12 @@
       Out << 'E';
       break;
 
+    case Decl::EnumConstant: {
+      const EnumConstantDecl *ED = cast<EnumConstantDecl>(D);
+      mangleIntegerLiteral(ED->getType(), ED->getInitVal());
+      break;
+    }
+
     case Decl::NonTypeTemplateParm: {
       const NonTypeTemplateParmDecl *PD = cast<NonTypeTemplateParmDecl>(D);
       mangleTemplateParameter(PD->getIndex());

Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=109315&r1=109314&r2=109315&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Fri Jul 23 20:17:35 2010
@@ -518,3 +518,14 @@
     int S::a() { return S::x; }
   }
 }
+
+// rdar://problem/8204122
+namespace test15 {
+  enum E { e = 3 };
+  template <int I> struct S {};
+
+  template <int I> void f(S<I + e>) {}
+
+  // CHECK: define weak_odr void @_ZN6test151fILi7EEEvNS_1SIXplT_LNS_1EE3EEEE(
+  template void f<7>(S<7 + e>);
+}





More information about the cfe-commits mailing list