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 | f32443cdcde2a14346b45d5f8efc415474a33e89 (patch) | |
tree | 801db66dc34b5860aaaeb08868a6d738ba5ef6a3 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 50b4f4822571c82b7077bea39d1423d9a706ecae (diff) | |
download | bcm5719-llvm-f32443cdcde2a14346b45d5f8efc415474a33e89.tar.gz bcm5719-llvm-f32443cdcde2a14346b45d5f8efc415474a33e89.zip |
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index ab9633418ac..c445864bb31 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/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. |