aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-12 15:39:31 +0000
committerChris Lattner <sabre@nondot.org>2003-05-12 15:39:31 +0000
commit45343ea5acd7d4b663b116e553e24bbd15755473 (patch)
treeb18e0b81daccf28ed5bb78069fe440106fb97193
parent4dbaba49996795af29dffd169412c0fc3646ae9d (diff)
downloadexternal_llvm-45343ea5acd7d4b663b116e553e24bbd15755473.zip
external_llvm-45343ea5acd7d4b663b116e553e24bbd15755473.tar.gz
external_llvm-45343ea5acd7d4b663b116e553e24bbd15755473.tar.bz2
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
-rw-r--r--lib/Target/CBackend/CBackend.cpp8
-rw-r--r--lib/Target/CBackend/Writer.cpp8
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 2c4f6c2..3ab03e9 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -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;
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index 2c4f6c2..3ab03e9 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -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;