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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 13:10:25 PST 2020


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/RedundantBranchConditionCheck.cpp:145
+
     const auto *LeftDRE =
         dyn_cast<DeclRefExpr>(CondOp->getLHS()->IgnoreParenImpCasts());
----------------
The old code used to assert that `CondOp` was a `BinaryOperator` but the new code means that `CondOp` can be null -- should you add an `assert` in to ensure we have a valid `CondOp` still or will that assert trigger on some constructs?


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp:1077
+// ExprWithCleanups doesn't crash
+
+int positive_expr_with_cleanups() {
----------------
Can remove the newline here.


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

https://reviews.llvm.org/D91037



More information about the cfe-commits mailing list