[clang-tools-extra] [clang-tidy]suggest use `std::span` as replacement of c array in C++20 for modernize-avoid-c-arrays (PR #108555)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 10:04:45 PDT 2024


================
@@ -38,6 +39,13 @@ AST_MATCHER(clang::ParmVarDecl, isArgvOfMain) {
   return FD ? FD->isMain() : false;
 }
 
+AST_MATCHER_P(clang::TypeLoc, alwaysTrue,
+              clang::ast_matchers::internal::Matcher<clang::TypeLoc>,
+              InnerMatcher) {
+  InnerMatcher.matches(Node, Finder, Builder);
+  return true;
+}
----------------
5chmidti wrote:

In the way that you are using this matcher, it has the same result as using the existing `optionally` matcher.

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


More information about the cfe-commits mailing list