[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Wed May 1 12:23:42 PDT 2024


================
@@ -30,9 +30,9 @@ void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
       cxxOperatorCallExpr(
           argumentCountIs(2),
-          hasArgument(
-              0, expr(hasType(cxxRecordDecl(hasName("::absl::Duration"))))),
-          hasArgument(1, expr().bind("arg")),
+          hasArgument(0, ignoringParenImpCasts(expr(hasType(
+                             cxxRecordDecl(hasName("::absl::Duration")))))),
+          hasArgument(1, ignoringParenImpCasts(expr().bind("arg"))),
----------------
5chmidti wrote:

I don't think that we need the `ignoringParenImpCasts` for the 0-th argument, because we want to know if it is called on an `::absl::Duration` and not on something that was implicitly constructed from one. I know that the original `hasArgument` did include the `ignoringParenImpCasts`, but I think its better to leave it out. Thoughts?

The `ignoringParenImpCasts` from the 1-st argument can be removed.

https://github.com/llvm/llvm-project/pull/89553


More information about the cfe-commits mailing list