]> granicus.if.org Git - llvm/commitdiff
Fix bug: CWriter/2003-05-12-IntegerSizeWarning.c
authorChris Lattner <sabre@nondot.org>
Mon, 12 May 2003 15:39:31 +0000 (15:39 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 12 May 2003 15:39:31 +0000 (15:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6128 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp

index 2c4f6c2f9f152ec0f85d379925afdf5760bf9d2e..3ab03e988e6f4239ec6ffdca761198aa95ebabd7 100644 (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;
 
index 2c4f6c2f9f152ec0f85d379925afdf5760bf9d2e..3ab03e988e6f4239ec6ffdca761198aa95ebabd7 100644 (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;