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

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


================
@@ -98,16 +100,18 @@ void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) {
   //   `absl::Hours(x)`
   // where `x` is not of a built-in type.
   Finder->addMatcher(
-      traverse(TK_AsIs, implicitCastExpr(
-                            anyOf(hasCastKind(CK_UserDefinedConversion),
-                                  has(implicitCastExpr(
-                                      hasCastKind(CK_UserDefinedConversion)))),
-                            hasParent(callExpr(
-                                callee(functionDecl(
-                                    DurationFactoryFunction(),
-                                    unless(hasParent(functionTemplateDecl())))),
-                                hasArgument(0, expr().bind("arg")))))
-                            .bind("OuterExpr")),
+      traverse(
+          TK_AsIs,
+          implicitCastExpr(
+              anyOf(
+                  hasCastKind(CK_UserDefinedConversion),
+                  has(implicitCastExpr(hasCastKind(CK_UserDefinedConversion)))),
+              hasParent(callExpr(
+                  callee(
+                      functionDecl(DurationFactoryFunction(),
+                                   unless(hasParent(functionTemplateDecl())))),
+                  hasArgument(0, ignoringParenImpCasts(expr().bind("arg"))))))
----------------
5chmidti wrote:

This change is not needed, the check does not if implicit nodes are ignored or not, so we don't need to do the extra work.

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


More information about the llvm-commits mailing list