diff options
Diffstat (limited to 'compilerplugins/clang/unnecessaryparen.cxx')
-rw-r--r-- | compilerplugins/clang/unnecessaryparen.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compilerplugins/clang/unnecessaryparen.cxx b/compilerplugins/clang/unnecessaryparen.cxx index 8a94051d5bf4..02b71694e6ac 100644 --- a/compilerplugins/clang/unnecessaryparen.cxx +++ b/compilerplugins/clang/unnecessaryparen.cxx @@ -224,6 +224,12 @@ void UnnecessaryParen::VisitSomeStmt(const Stmt *parent, const Expr* cond, Strin if (parenExpr) { if (parenExpr->getLocStart().isMacroID()) return; + // Used to silence -Wunreachable-code: + if (isa<CXXBoolLiteralExpr>(parenExpr->getSubExpr()) + && stmtName == "if") + { + return; + } // assignments need extra parentheses or they generate a compiler warning auto binaryOp = dyn_cast<BinaryOperator>(parenExpr->getSubExpr()); if (binaryOp && binaryOp->getOpcode() == BO_Assign) |