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

John McCall rjmccall at apple.com
Fri Apr 9 14:48:08 PDT 2010


Author: rjmccall
Date: Fri Apr  9 16:48:08 2010
New Revision: 100905

URL: http://llvm.org/viewvc/llvm-project?rev=100905&view=rev
Log:
Provide manglings for bool and character literal expressions.  These are
just integer-literal expressions with special case implementations in the AST.

Fixes rdar://problem/7825453.


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=100905&r1=100904&r2=100905&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Fri Apr  9 16:48:08 2010
@@ -1488,6 +1488,19 @@
     break;
   }
 
+  case Expr::CharacterLiteralClass:
+    Out << "L";
+    mangleType(E->getType());
+    Out << cast<CharacterLiteral>(E)->getValue();
+    Out << 'E';
+    break;
+
+  case Expr::CXXBoolLiteralExprClass:
+    Out << "Lb";
+    Out << (cast<CXXBoolLiteralExpr>(E)->getValue() ? '1' : '0');
+    Out << 'E';
+    break;
+
   case Expr::IntegerLiteralClass:
     mangleIntegerLiteral(E->getType(),
                          llvm::APSInt(cast<IntegerLiteral>(E)->getValue()));

Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=100905&r1=100904&r2=100905&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Fri Apr  9 16:48:08 2010
@@ -468,3 +468,12 @@
     f<int, bar>( 0);
   }
 }
+
+// <rdar://problem/7825453>
+namespace test10 {
+  template <char P1> struct S {};
+  template <char P2> void f(struct S<false ? 'a' : P2> ) {}
+
+  // CHECK: define weak_odr void @_ZN6test101fILc3EEEvNS_1SIXquLb0ELc97ET_EEE(
+  template void f<(char) 3>(struct S<3>);
+}





More information about the cfe-commits mailing list