diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-05-12 10:14:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-05-12 14:36:59 +0200 |
commit | 21f92ce72ada2ea92ef4997a7a0fae986f023b6c (patch) | |
tree | cee8f04d8a5ea13b47b779f240f801dc620b3881 /compilerplugins | |
parent | b2f8032c43e298525ab7897f13baad9017a969ff (diff) |
Guard against isCXX11ConstantExpr on dependent expression
> Assertion failed: (!isValueDependent() && "Expression evaluator can't be called on a dependent expression."), function isCXX11ConstantExpr, file ~/llvm/llvm-project/clang/lib/AST/ExprConstant.cpp, line 15540.
...as would have hit with a preliminary version of
ad48b2b02f83eed41fb1eb8d16de7e804156fcf1 "Optimized OString operator +=
overloads"
Change-Id: I652063b4eebd076973eaa57219df91cd1fbef312
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115462
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/buriedassign.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compilerplugins/clang/buriedassign.cxx b/compilerplugins/clang/buriedassign.cxx index 658ad4789d87..e1932c821e21 100644 --- a/compilerplugins/clang/buriedassign.cxx +++ b/compilerplugins/clang/buriedassign.cxx @@ -442,7 +442,8 @@ bool BuriedAssign::VisitIfStmt(IfStmt const* ifStmt) if (auto binaryOp2 = dyn_cast<BinaryOperator>(binaryOp->getLHS()->IgnoreParenImpCasts())) { - if (binaryOp->getRHS()->isCXX11ConstantExpr(compiler.getASTContext()) + if (!binaryOp->getRHS()->isValueDependent() + && binaryOp->getRHS()->isCXX11ConstantExpr(compiler.getASTContext()) && isAssignmentOp(binaryOp2->getOpcode())) report(DiagnosticsEngine::Warning, "buried assignment, rather put on own line", compat::getBeginLoc(expr)) @@ -451,7 +452,8 @@ bool BuriedAssign::VisitIfStmt(IfStmt const* ifStmt) if (auto binaryOp2 = dyn_cast<BinaryOperator>(binaryOp->getRHS()->IgnoreParenImpCasts())) { - if (binaryOp->getLHS()->isCXX11ConstantExpr(compiler.getASTContext()) + if (!binaryOp->getLHS()->isValueDependent() + && binaryOp->getLHS()->isCXX11ConstantExpr(compiler.getASTContext()) && isAssignmentOp(binaryOp2->getOpcode())) report(DiagnosticsEngine::Warning, "buried assignment, rather put on own line", compat::getBeginLoc(expr)) |