diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-11-12 22:37:10 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-11-12 22:37:10 +0000 |
commit | 36bc14c3a1cf63ee306df5687ac8e85f924f8639 (patch) | |
tree | ca772d87381e1dfd3ec3aacc4269adb8975c2e94 /lib/CodeGen | |
parent | 174da89d2d4f4136dc56075176358e3a9cd8604f (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index ab9633418a..c445864bb3 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -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. |