Ensure we don't print 123ULL_foo when printing a user-defined integer literal.

llvm-svn: 152303
This commit is contained in:
Richard Smith 2012-03-08 09:02:38 +00:00
parent 39570d0020
commit 75025ba487
2 changed files with 16 additions and 1 deletions

View File

@ -1237,7 +1237,12 @@ void StmtPrinter::VisitUserDefinedLiteral(UserDefinedLiteral *Node) {
}
break;
}
case UserDefinedLiteral::LOK_Integer:
case UserDefinedLiteral::LOK_Integer: {
// Print integer literal without suffix.
IntegerLiteral *Int = cast<IntegerLiteral>(Node->getCookedLiteral());
OS << Int->getValue().toString(10, /*isSigned*/false);
break;
}
case UserDefinedLiteral::LOK_Floating:
case UserDefinedLiteral::LOK_String:
case UserDefinedLiteral::LOK_Character:

View File

@ -4,9 +4,19 @@
// CHECK: decltype(nullptr) operator "" _foo(const char *p, decltype(sizeof(int)));
auto operator"" _foo(const char *p, decltype(sizeof(int))) -> decltype(nullptr);
// CHECK: decltype(""_foo) operator "" _bar(unsigned long long);
decltype(""_foo) operator"" _bar(unsigned long long);
// CHECK: decltype(42_bar) operator "" _baz(long double);
decltype(42_bar) operator"" _baz(long double);
// CHECK: const char *p1 = "bar1"_foo;
const char *p1 = "bar1"_foo;
// CHECK: const char *p2 = "bar2"_foo;
const char *p2 = R"x(bar2)x"_foo;
// CHECK: const char *p3 = u8"bar3"_foo;
const char *p3 = u8"bar3"_foo;
// CHECK: const char *p4 = 297_bar;
const char *p4 = 0x129_bar;
// CHECK: const char *p5 = 1.0E+12_baz;
const char *p5 = 1e12_baz;