Fix bug: CWriter/2003-05-12-IntegerSizeWarning.c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6128 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-05-12 15:39:31 +00:00
parent 4dbaba4999
commit 45343ea5ac
2 changed files with 14 additions and 2 deletions

View File

@ -380,8 +380,14 @@ void CWriter::printConstant(Constant *CPV) {
Out << (CPV == ConstantBool::False ? "0" : "1"); break;
case Type::SByteTyID:
case Type::ShortTyID:
case Type::IntTyID:
Out << cast<ConstantSInt>(CPV)->getValue(); break;
case Type::IntTyID:
if ((int)cast<ConstantSInt>(CPV)->getValue() == (int)0x80000000)
Out << "((int)0x80000000)"; // Handle MININT specially to avoid warning
else
Out << cast<ConstantSInt>(CPV)->getValue();
break;
case Type::LongTyID:
Out << cast<ConstantSInt>(CPV)->getValue() << "ll"; break;

View File

@ -380,8 +380,14 @@ void CWriter::printConstant(Constant *CPV) {
Out << (CPV == ConstantBool::False ? "0" : "1"); break;
case Type::SByteTyID:
case Type::ShortTyID:
case Type::IntTyID:
Out << cast<ConstantSInt>(CPV)->getValue(); break;
case Type::IntTyID:
if ((int)cast<ConstantSInt>(CPV)->getValue() == (int)0x80000000)
Out << "((int)0x80000000)"; // Handle MININT specially to avoid warning
else
Out << cast<ConstantSInt>(CPV)->getValue();
break;
case Type::LongTyID:
Out << cast<ConstantSInt>(CPV)->getValue() << "ll"; break;