Skip to content
Snippets Groups Projects
Commit ef5a66d8 authored by Anders Carlsson's avatar Anders Carlsson
Browse files

An expression is not foldable if it can't be fully evaluated. Fixes PR3060

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59887 91177308-0d34-0410-b5e6-96231b3b80d8
parent 43f44709
No related branches found
No related tags found
No related merge requests found
...@@ -197,8 +197,10 @@ int CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond) { ...@@ -197,8 +197,10 @@ int CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond) {
// FIXME: Rename and handle conversion of other evaluatable things // FIXME: Rename and handle conversion of other evaluatable things
// to bool. // to bool.
if (!Cond->Evaluate(V, getContext()) || !V.isInt()) bool isEvaluated;
return 0; // Not foldable or not integer. if (!Cond->Evaluate(V, getContext(), &isEvaluated) || !V.isInt() ||
!isEvaluated)
return 0; // Not foldable, not integer or not fully evaluatable.
if (CodeGenFunction::ContainsLabel(Cond)) if (CodeGenFunction::ContainsLabel(Cond))
return 0; // Contains a label. return 0; // Contains a label.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment