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

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 7 17:20:00 PDT 2003


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.56 -> 1.57

---
Log message:

Add a sanity check for constant expression casts


---
Diffs of the changes:  (+2 -0)

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.56 llvm/lib/VMCore/Constants.cpp:1.57
--- llvm/lib/VMCore/Constants.cpp:1.56	Sat Oct  4 19:17:43 2003
+++ llvm/lib/VMCore/Constants.cpp	Tue Oct  7 17:19:19 2003
@@ -897,6 +897,8 @@
 static ValueMap<ExprMapKeyType, Type, ConstantExpr> ExprConstants;
 
 Constant *ConstantExpr::getCast(Constant *C, const Type *Ty) {
+  assert(Ty->isFirstClassType() && "Cannot cast to an aggregate type!");
+
   if (Constant *FC = ConstantFoldCastInstruction(C, Ty))
     return FC;          // Fold a few common cases...
 





More information about the llvm-commits mailing list