summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/unnecessaryparen.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/compilerplugins/clang/unnecessaryparen.cxx b/compilerplugins/clang/unnecessaryparen.cxx
index 106f2d2b3352..e93dfa64b5ec 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -468,6 +468,11 @@ bool UnnecessaryParen::VisitVarDecl(const VarDecl* varDecl)
// Sometimes parentheses make the RHS of an assignment easier to read by
// visually disambiguating the = from a call to ==
auto sub = parenExpr->getSubExpr();
+#if CLANG_VERSION >= 100000
+ if (auto const e = dyn_cast<CXXRewrittenBinaryOperator>(sub)) {
+ sub = e->getDecomposedForm().InnerBinOp;
+ }
+#endif
if (auto subBinOp = dyn_cast<BinaryOperator>(sub))
{
if (!(subBinOp->isMultiplicativeOp() || subBinOp->isAdditiveOp() || subBinOp->isPtrMemOp()))