In the yet-another-crazy-idea department, we now print the actual *value* of

integer constants, whoa! :)

llvm-svn: 39475
This commit is contained in:
Chris Lattner 2007-05-21 05:45:03 +00:00
parent de5a472e02
commit 0643041f6c
1 changed files with 14 additions and 3 deletions

View File

@ -252,12 +252,23 @@ void StmtPrinter::VisitCharacterLiteral(CharacterLiteral *Node) {
}
void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
// FIXME: print value.
OS << "1";
bool isSigned = Node->getType()->isSignedIntegerType();
OS << Node->getValue().toString(10, isSigned);
// Emit suffixes. Integer literals are always a builtin integer type.
switch (cast<BuiltinType>(Node->getType().getCanonicalType())->getKind()) {
default: assert(0 && "Unexpected type for integer literal!");
case BuiltinType::Int: break; // no suffix.
case BuiltinType::UInt: OS << 'U'; break;
case BuiltinType::Long: OS << 'L'; break;
case BuiltinType::ULong: OS << "UL"; break;
case BuiltinType::LongLong: OS << "LL"; break;
case BuiltinType::ULongLong: OS << "ULL"; break;
}
}
void StmtPrinter::VisitFloatingLiteral(FloatingLiteral *Node) {
// FIXME: print value.
OS << "1.0";
OS << "~1.0~";
}
void StmtPrinter::VisitStringLiteral(StringLiteral *Str) {
if (Str->isWide()) OS << 'L';