[PATCH] D91037: [clang-tidy] Fix crash in bugprone-redundant-branch-condition on ExprWithCleanups

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 04:16:03 PST 2020


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/RedundantBranchConditionCheck.cpp:45
       ifStmt(
           hasCondition(ignoringParenImpCasts(anyOf(
               declRefExpr(hasDeclaration(ImmutableVar)),
----------------
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))
    ;
}
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91037/new/

https://reviews.llvm.org/D91037



More information about the cfe-commits mailing list