[PATCH] D91037: [clang-tidy] Fix crash in bugprone-redundant-branch-condition on ExprWithCleanups
Zinovy Nis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 11 09:58:02 PST 2020
zinovy.nis marked an inline comment as done.
zinovy.nis added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/RedundantBranchConditionCheck.cpp:45
ifStmt(
hasCondition(ignoringParenImpCasts(anyOf(
declRefExpr(hasDeclaration(ImmutableVar)),
----------------
njames93 wrote:
> Just noticed, as this is ignoring Parenthesis and implicit nodes/casts, maybe we should also be ignoring those when getting the condition in the check
> `InnerIf->getCond()->IgnoreParenImpCasts()`
> I reckon if that change isnt made this could fail on
> ```lang=c++
> if (IsSet){
> if ((OtherCond && IsSet))
> ;
> }
> ```
You are right, thanks! I fixed it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91037/new/
https://reviews.llvm.org/D91037
More information about the cfe-commits
mailing list