aaron.ballman added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/RedundantBranchConditionCheck.cpp:85
   // remove the inner `if`.
-  const auto *BinOpCond = dyn_cast<BinaryOperator>(InnerIf->getCond());
+  const auto *BinOpCond = dyn_cast_or_null<BinaryOperator>(InnerIf->getCond());
+  if (!BinOpCond)
----------------
zinovy.nis wrote:
> aaron.ballman wrote:
> > Under what circumstances does `getCond()` return `nullptr`?
> `getCond()` is not null, but it can be `ExprWithCleanupsCond` leading the 
> original `dyn_cast` to crash. That what this bug is about.
> 
That's what I figured, but you changed `dyn_cast<>` to be `dyn_cast_or_null<>` 
and that seems incorrect -- `getCond()` doesn't return null so the `dyn_cast<>` 
was correct.


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

https://reviews.llvm.org/D91037

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to