[clang-tools-extra] Add ignoring paren imp casts in has any argument (PR #89509)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 21 09:04:57 PDT 2024


================
@@ -74,8 +74,9 @@ RewriteRuleWith<std::string> StringviewNullptrCheckImpl() {
   auto BasicStringViewConstructingFromNullExpr =
       cxxConstructExpr(
           HasBasicStringViewType, argumentCountIs(1),
-          hasAnyArgument(/* `hasArgument` would skip over parens */ anyOf(
-              NullLiteral, NullInitList, EmptyInitList)),
+          hasAnyArgument(
+              /* `hasArgument` would skip over parens */ ignoringParenImpCasts(
+                  anyOf(NullLiteral, NullInitList, EmptyInitList))),
----------------
5chmidti wrote:

Checkout this file later for this and the other section I highlighted, here it looks like the only reason that  `hasAnyArgument` was chosen is because of this differing behavior, instead, this can be replaced with `hasArgument(0, ...)` after the `IgnoreParenImpCasts` is removed from the `hasArgument` matcher.

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


More information about the cfe-commits mailing list