aaron.ballman added inline comments.

================
Comment at: clang-tidy/modernize/ReplaceGenericFunctorCallCheck.cpp:70
+  if (MFunctor && MFunctor->isTypeDependent()) {
+    const auto *Paren = static_cast<const ParenExpr *>(MFunctor->getCallee());
+    const auto *BinOp =
----------------
JonasToth wrote:
> Eugene.Zelenko wrote:
> > I think you should use LLVM's cast instead, but I'm not sure which one. 
> > Same for other places.
> in this case i think `const auto *BinOp = 
> dyn_cast<BinaryOperator>(Paren->getSubExpr());` would match.
> 
> As a safety measure adding a `assert(BinOp && "No Binary Operator as 
> subexpression");` helps spotting bugs.
I agree; you'd want `dyn_cast` here. There's no need to add that assertion -- 
`dyn_cast` already asserts that the given value is non-null. If the value could 
be null and still be valid, you could use `dyn_cast_or_null` instead.


https://reviews.llvm.org/D52281



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

Reply via email to