]> granicus.if.org Git - clang/commitdiff
Provide manglings for bool and character literal expressions. These are
authorJohn McCall <rjmccall@apple.com>
Fri, 9 Apr 2010 21:48:08 +0000 (21:48 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 9 Apr 2010 21:48:08 +0000 (21:48 +0000)
just integer-literal expressions with special case implementations in the AST.

Fixes rdar://problem/7825453.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100905 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Mangle.cpp
test/CodeGenCXX/mangle.cpp

index a29841d02b74a8c49f3417dae1a11cd2a661c625..649e848c99600886bcd21ee6d5a0f045cadd9cc6 100644 (file)
@@ -1488,6 +1488,19 @@ void CXXNameMangler::mangleExpression(const Expr *E) {
     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()));
index ad57c199c424de255eeba03e4f45d52357739444..8f3d3568488438468b6ecbe950c713eed1fc5aa6 100644 (file)
@@ -468,3 +468,12 @@ namespace test9 {
     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>);
+}