[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu Sep 9 21:17:09 PDT 2004



Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.104 -> 1.105
---
Log message:

Add assertion descriptiosn on type mismatches when creating
ConstantArray and ConstantPacked objects.


---
Diffs of the changes:  (+8 -6)

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.104 llvm/lib/VMCore/Constants.cpp:1.105
--- llvm/lib/VMCore/Constants.cpp:1.104	Wed Sep  1 17:55:37 2004
+++ llvm/lib/VMCore/Constants.cpp	Thu Sep  9 23:16:59 2004
@@ -247,9 +247,10 @@
                              const std::vector<Constant*> &V) : Constant(T) {
   Operands.reserve(V.size());
   for (unsigned i = 0, e = V.size(); i != e; ++i) {
-    assert(V[i]->getType() == T->getElementType() ||
-           (T->isAbstract() &&
-            V[i]->getType()->getTypeID() == T->getElementType()->getTypeID()));
+    assert((V[i]->getType() == T->getElementType() ||
+            (T->isAbstract() &&
+             V[i]->getType()->getTypeID() == T->getElementType()->getTypeID())) &&
+           "Initializer for array element doesn't match array element type!");
     Operands.push_back(Use(V[i], this));
   }
 }
@@ -273,9 +274,10 @@
                                const std::vector<Constant*> &V) : Constant(T) {
   Operands.reserve(V.size());
   for (unsigned i = 0, e = V.size(); i != e; ++i) {
-    assert(V[i]->getType() == T->getElementType() ||
-           (T->isAbstract() &&
-            V[i]->getType()->getTypeID() == T->getElementType()->getTypeID()));
+    assert((V[i]->getType() == T->getElementType() ||
+            (T->isAbstract() &&
+             V[i]->getType()->getTypeID() == T->getElementType()->getTypeID())) &&
+           "Initializer for packed element doesn't match packed element type!");
     Operands.push_back(Use(V[i], this));
   }
 }






More information about the llvm-commits mailing list