================
@@ -36,19 +36,21 @@ void
DurationUnnecessaryConversionCheck::registerMatchers(MatchFinder *Finder) {
// e.g. `absl::ToDoubleSeconds(dur)`.
auto InverseFunctionMatcher = callExpr(
callee(functionDecl(hasAnyName(FloatConversion, IntegerConversion))),
- hasArgument(0, expr().bind("arg")));
+ hasArgument(0, ignoringParenImpCasts(expr().bind("arg"))));
// Matcher which matches a duration divided by the factory_matcher above,
// e.g. `dur / absl::Seconds(1)`.
auto DivisionOperatorMatcher = cxxOperatorCallExpr(
- hasOverloadedOperatorName("/"), hasArgument(0, expr().bind("arg")),
- hasArgument(1, FactoryMatcher));
+ hasOverloadedOperatorName("/"),
+ hasArgument(0, ignoringParenImpCasts(expr().bind("arg"))),
+ hasArgument(1, ignoringParenImpCasts(FactoryMatcher)));
// Matcher which matches a duration argument to `FDivDuration`,
// e.g. `absl::FDivDuration(dur, absl::Seconds(1))`
- auto FdivMatcher = callExpr(
- callee(functionDecl(hasName("::absl::FDivDuration"))),
- hasArgument(0, expr().bind("arg")), hasArgument(1, FactoryMatcher));
+ auto FdivMatcher =
+ callExpr(callee(functionDecl(hasName("::absl::FDivDuration"))),
+ hasArgument(0, ignoringParenImpCasts(expr().bind("arg"))),
+ hasArgument(1, ignoringParenImpCasts(FactoryMatcher)));
----------------
5chmidti wrote:
Please remove the `ignoringParentImpCasts` around the `expr().bind("arg")`
matchers, they are not needed.
https://github.com/llvm/llvm-project/pull/89553
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits