From 33ce777c4de75c4f81cfe5aaa04b54b0003f92dd Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 28 Sep 2006 23:19:29 +0000 Subject: [PATCH] Simplify some code, reformat break's git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30660 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CBackend/CBackend.cpp | 18 ++++++++++++------ lib/Target/CBackend/Writer.cpp | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 23bd41d8dd0..88113a0347a 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -638,10 +638,12 @@ void CWriter::printConstant(Constant *CPV) { switch (CPV->getType()->getTypeID()) { case Type::BoolTyID: - Out << (CPV == ConstantBool::False ? '0' : '1'); break; + Out << (cast(CPV)->getValue() ? '1' : '0'); + break; case Type::SByteTyID: case Type::ShortTyID: - Out << cast(CPV)->getValue(); break; + Out << cast(CPV)->getValue(); + break; case Type::IntTyID: if ((int)cast(CPV)->getValue() == (int)0x80000000) Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning @@ -653,15 +655,19 @@ void CWriter::printConstant(Constant *CPV) { if (cast(CPV)->isMinValue()) Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)"; else - Out << cast(CPV)->getValue() << "ll"; break; + Out << cast(CPV)->getValue() << "ll"; + break; case Type::UByteTyID: case Type::UShortTyID: - Out << cast(CPV)->getValue(); break; + Out << cast(CPV)->getValue(); + break; case Type::UIntTyID: - Out << cast(CPV)->getValue() << 'u'; break; + Out << cast(CPV)->getValue() << 'u'; + break; case Type::ULongTyID: - Out << cast(CPV)->getValue() << "ull"; break; + Out << cast(CPV)->getValue() << "ull"; + break; case Type::FloatTyID: case Type::DoubleTyID: { diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 23bd41d8dd0..88113a0347a 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -638,10 +638,12 @@ void CWriter::printConstant(Constant *CPV) { switch (CPV->getType()->getTypeID()) { case Type::BoolTyID: - Out << (CPV == ConstantBool::False ? '0' : '1'); break; + Out << (cast(CPV)->getValue() ? '1' : '0'); + break; case Type::SByteTyID: case Type::ShortTyID: - Out << cast(CPV)->getValue(); break; + Out << cast(CPV)->getValue(); + break; case Type::IntTyID: if ((int)cast(CPV)->getValue() == (int)0x80000000) Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning @@ -653,15 +655,19 @@ void CWriter::printConstant(Constant *CPV) { if (cast(CPV)->isMinValue()) Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)"; else - Out << cast(CPV)->getValue() << "ll"; break; + Out << cast(CPV)->getValue() << "ll"; + break; case Type::UByteTyID: case Type::UShortTyID: - Out << cast(CPV)->getValue(); break; + Out << cast(CPV)->getValue(); + break; case Type::UIntTyID: - Out << cast(CPV)->getValue() << 'u'; break; + Out << cast(CPV)->getValue() << 'u'; + break; case Type::ULongTyID: - Out << cast(CPV)->getValue() << "ull"; break; + Out << cast(CPV)->getValue() << "ull"; + break; case Type::FloatTyID: case Type::DoubleTyID: {