Don't try to evaluate value of value-dependent Expr

...which causes asserts to fire since <https://github.com/llvm/llvm-project/
commit/04323c24a1ac9464471331d9f6499d3cb95d1ccd> "Added an assertion to constant
evaluation enty points that prohibits …"

Change-Id: Iafbf1cea85d15a38a71275d4cea8303bab500f6a
Reviewed-on: https://gerrit.libreoffice.org/72723
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2019-05-22 09:37:53 +02:00
parent fd59a10734
commit 9c346feb33
2 changed files with 2 additions and 2 deletions

View file

@ -100,7 +100,7 @@ private:
return;
}
APSInt val;
if (!rhs->isIntegerConstantExpr(val, compiler.getASTContext()))
if (rhs->isValueDependent() || !rhs->isIntegerConstantExpr(val, compiler.getASTContext()))
{
return;
}

View file

@ -135,7 +135,7 @@ std::unique_ptr<APSInt> ExpressionAlwaysZero::getExprValue(Expr const * expr)
return std::unique_ptr<APSInt>();
}
APSInt x1;
if (compat::EvaluateAsInt(expr, x1, compiler.getASTContext()))
if (!expr->isValueDependent() && compat::EvaluateAsInt(expr, x1, compiler.getASTContext()))
return std::unique_ptr<APSInt>(new APSInt(x1));
return std::unique_ptr<APSInt>();
}