Give better assertion message for error conditions
authorChris Lattner <sabre@nondot.org>
Wed, 11 Sep 2002 01:21:04 +0000 (01:21 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 11 Sep 2002 01:21:04 +0000 (01:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3680 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Constants.cpp

index 146f307a55a8fbbdfcc730f85c94185c7a3ff0dd..fe6af758bd713fc174a3a94e911766945d76a333 100644 (file)
@@ -174,10 +174,14 @@ ConstantInt::ConstantInt(const Type *Ty, uint64_t V) : ConstantIntegral(Ty) {
 }
 
 ConstantSInt::ConstantSInt(const Type *Ty, int64_t V) : ConstantInt(Ty, V) {
+  assert(Ty->isInteger() && Ty->isSigned() &&
+         "Illegal type for unsigned integer constant!");
   assert(isValueValidForType(Ty, V) && "Value too large for type!");
 }
 
 ConstantUInt::ConstantUInt(const Type *Ty, uint64_t V) : ConstantInt(Ty, V) {
+  assert(Ty->isInteger() && Ty->isUnsigned() &&
+         "Illegal type for unsigned integer constant!");
   assert(isValueValidForType(Ty, V) && "Value too large for type!");
 }