1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Add a sanity check for constant expression casts

llvm-svn: 8951
This commit is contained in:
Chris Lattner 2003-10-07 22:19:19 +00:00
parent f090d28209
commit bd123c6e51

View File

@ -897,6 +897,8 @@ struct ConvertConstantType<ConstantExpr, Type> {
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...