Quick fix for crash in IRgen when we can tryEvaluate a condition to

something that is not an int.

 - Ignore these cases for now, added FIXME that we should also boolize
   them.

llvm-svn: 59184
This commit is contained in:
Daniel Dunbar 2008-11-12 22:37:10 +00:00
parent 50b4f48225
commit f32443cdcd
1 changed files with 5 additions and 2 deletions

View File

@ -194,8 +194,11 @@ bool CodeGenFunction::ContainsLabel(const Stmt *S, bool IgnoreCaseStmts) {
/// to 'false' and does not contain a label, return -1.
int CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond) {
APValue V;
if (!Cond->tryEvaluate(V, getContext()))
return 0; // Not foldable.
// FIXME: Rename and handle conversion of other evaluatable things
// to bool.
if (!Cond->tryEvaluate(V, getContext()) || !V.isInt())
return 0; // Not foldable or not integer.
if (CodeGenFunction::ContainsLabel(Cond))
return 0; // Contains a label.