github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- 
clang/include/clang/ASTMatchers/ASTMatchers.h 
clang/include/clang/ASTMatchers/ASTMatchersInternal.h 
clang/lib/ASTMatchers/ASTMatchFinder.cpp 
clang/lib/ASTMatchers/ASTMatchersInternal.cpp 
clang/lib/ASTMatchers/Dynamic/Registry.cpp 
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp 
--diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h 
b/clang/include/clang/ASTMatchers/ASTMatchers.h
index 5da867165..4082512ee 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -5911,7 +5911,6 @@ AST_POLYMORPHIC_MATCHER_P(hasAnySubstatement,
                                           Builder) != CS->body_end();
 }
 
-
 /// Matches compound statements where one ore more sets of adjacent
 /// substatements matching the provided sequence of matchers. Also matches
 /// StmtExprs that have CompoundStmt as children.
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h 
b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index f16c2e32c..20e2d95c5 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -413,8 +413,7 @@ public:
   template <typename T>
   DynTypedMatcher(const MatcherInterface<T> *Implementation)
       : SupportedKind(ASTNodeKind::getFromNodeKind<T>()),
-        RestrictKind(SupportedKind),
-        Implementation(Implementation) {}
+        RestrictKind(SupportedKind), Implementation(Implementation) {}
 
   /// Construct from a variadic function.
   enum VariadicOperator {
@@ -744,9 +743,10 @@ public:
                                       bool Directly) = 0;
 
   template <typename T>
-  bool matchesChildOf(const T &Node, const DynTypedMatcher &Matcher,
-                      BoundNodesTreeBuilder *Builder, BindKind Bind,
-                      llvm::function_ref<bool(BoundNodesTreeBuilder*)> 
MatchCallback) {
+  bool matchesChildOf(
+      const T &Node, const DynTypedMatcher &Matcher,
+      BoundNodesTreeBuilder *Builder, BindKind Bind,
+      llvm::function_ref<bool(BoundNodesTreeBuilder *)> MatchCallback) {
     static_assert(std::is_base_of<Decl, T>::value ||
                       std::is_base_of<Stmt, T>::value ||
                       std::is_base_of<NestedNameSpecifier, T>::value ||
@@ -763,12 +763,12 @@ public:
   bool matchesChildOf(const T &Node, const DynTypedMatcher &Matcher,
                       BoundNodesTreeBuilder *Builder, BindKind Bind) {
     static_assert(std::is_base_of<Decl, T>::value ||
-                  std::is_base_of<Stmt, T>::value ||
-                  std::is_base_of<NestedNameSpecifier, T>::value ||
-                  std::is_base_of<NestedNameSpecifierLoc, T>::value ||
-                  std::is_base_of<TypeLoc, T>::value ||
-                  std::is_base_of<QualType, T>::value ||
-                  std::is_base_of<Attr, T>::value,
+                      std::is_base_of<Stmt, T>::value ||
+                      std::is_base_of<NestedNameSpecifier, T>::value ||
+                      std::is_base_of<NestedNameSpecifierLoc, T>::value ||
+                      std::is_base_of<TypeLoc, T>::value ||
+                      std::is_base_of<QualType, T>::value ||
+                      std::is_base_of<Attr, T>::value,
                   "unsupported type for recursive matching");
     return matchesChildOf(DynTypedNode::create(Node), getASTContext(), Matcher,
                           Builder, Bind);
@@ -813,11 +813,10 @@ public:
   bool isTraversalIgnoringImplicitNodes() const;
 
 protected:
-  virtual bool matchesChildOf(const DynTypedNode &Node, ASTContext &Ctx,
-                              const DynTypedMatcher &Matcher,
-                              BoundNodesTreeBuilder *Builder,
-                              BindKind Bind,
-                              llvm::function_ref<bool(BoundNodesTreeBuilder 
*)> MatchCallback) = 0;
+  virtual bool matchesChildOf(
+      const DynTypedNode &Node, ASTContext &Ctx, const DynTypedMatcher 
&Matcher,
+      BoundNodesTreeBuilder *Builder, BindKind Bind,
+      llvm::function_ref<bool(BoundNodesTreeBuilder *)> MatchCallback) = 0;
 
   virtual bool matchesChildOf(const DynTypedNode &Node, ASTContext &Ctx,
                               const DynTypedMatcher &Matcher,
@@ -2321,7 +2320,8 @@ class ForEachAdjacentSubstatementsMatcher : public 
MatcherInterface<T> {
                 "Matcher ArgT must be std::vector<Matcher<Stmt>>");
 
 public:
-  explicit ForEachAdjacentSubstatementsMatcher(std::vector<Matcher<Stmt>> 
Matchers)
+  explicit ForEachAdjacentSubstatementsMatcher(
+      std::vector<Matcher<Stmt>> Matchers)
       : Matchers(std::move(Matchers)) {}
 
   bool matches(const T &Node, ASTMatchFinder *Finder,
diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp 
b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
index 7739d4537..75fd62982 100644
--- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -595,9 +595,8 @@ public:
 
   // Matches children or descendants of 'Node' with a custom callback.
   bool memoizedMatchesRecursively(
-      const DynTypedNode &Node, ASTContext &Ctx,
-      const DynTypedMatcher &Matcher, BoundNodesTreeBuilder *Builder,
-      int MaxDepth, BindKind Bind,
+      const DynTypedNode &Node, ASTContext &Ctx, const DynTypedMatcher 
&Matcher,
+      BoundNodesTreeBuilder *Builder, int MaxDepth, BindKind Bind,
       llvm::function_ref<bool(BoundNodesTreeBuilder *)> MatchCallback) {
     // For AST-nodes that don't have an identity, we can't memoize.
     if (!Node.getMemoizationData() || !Builder->isComparable())
@@ -684,11 +683,11 @@ public:
   bool matchesChildOf(const DynTypedNode &Node, ASTContext &Ctx,
                       const DynTypedMatcher &Matcher,
                       BoundNodesTreeBuilder *Builder, BindKind Bind) override {
-    return matchesChildOf(Node, Ctx, Matcher, Builder, Bind,
-                         [this, &Node, &Matcher, Bind](
-                            BoundNodesTreeBuilder* Nodes) -> bool {
-                           return matchesRecursively(Node, Matcher, Nodes, 1, 
Bind);
-                         });
+    return matchesChildOf(
+        Node, Ctx, Matcher, Builder, Bind,
+        [this, &Node, &Matcher, Bind](BoundNodesTreeBuilder *Nodes) -> bool {
+          return matchesRecursively(Node, Matcher, Nodes, 1, Bind);
+        });
   }
   // Implements ASTMatchFinder::matchesDescendantOf.
   bool matchesDescendantOf(const DynTypedNode &Node, ASTContext &Ctx,
@@ -697,12 +696,11 @@ public:
                            BindKind Bind) override {
     if (ResultCache.size() > MaxMemoizationEntries)
       ResultCache.clear();
-    return memoizedMatchesRecursively(Node, Ctx, Matcher, Builder, INT_MAX,
-                                      Bind,
-                                      [this, &Node, &Matcher, Bind](
-                                          BoundNodesTreeBuilder* Nodes) -> 
bool {
-                                        return matchesRecursively(Node, 
Matcher, Nodes, INT_MAX, Bind);
-                                      });
+    return memoizedMatchesRecursively(
+        Node, Ctx, Matcher, Builder, INT_MAX, Bind,
+        [this, &Node, &Matcher, Bind](BoundNodesTreeBuilder *Nodes) -> bool {
+          return matchesRecursively(Node, Matcher, Nodes, INT_MAX, Bind);
+        });
   }
   // Implements ASTMatchFinder::matchesAncestorOf.
   bool matchesAncestorOf(const DynTypedNode &Node, ASTContext &Ctx,
@@ -718,7 +716,6 @@ public:
     return matchesAnyAncestorOf(Node, Ctx, Matcher, Builder);
   }
 
-
   // Matches all registered matchers on the given node and calls the
   // result callback for every node that matches.
   void match(const DynTypedNode &Node) {
diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp 
b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
index 022d24738..9f0455052 100644
--- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -487,7 +487,8 @@ static BoundNodesTreeBuilder 
extendBuilder(BoundNodesTreeBuilder &&Builder) {
 
 ForEachAdjacentSubstatementsMatcherType
 forEachAdjSubstatementsFunc(ArrayRef<const Matcher<Stmt> *> MatcherRefs) {
-  return 
ForEachAdjacentSubstatementsMatcherType(vectorFromMatcherRefs(MatcherRefs));
+  return ForEachAdjacentSubstatementsMatcherType(
+      vectorFromMatcherRefs(MatcherRefs));
 }
 
 template <typename T, typename ArgT>
@@ -507,8 +508,9 @@ bool ForEachAdjacentSubstatementsMatcher<T, ArgT>::matches(
   DynTypedMatcher MatcherWrapper(this);
 
   // Use memoization to avoid re-running the same matcher on the same node.
-  return Finder->matchesChildOf(static_cast<const Stmt&>(*CS),
-      MatcherWrapper, Builder, ASTMatchFinder::BK_All,
+  return Finder->matchesChildOf(
+      static_cast<const Stmt &>(*CS), MatcherWrapper, Builder,
+      ASTMatchFinder::BK_All,
       [this, CS, Finder](BoundNodesTreeBuilder *MemoBuilder) -> bool {
         // Search for all sequences of adjacent substatements that match the
         // matchers
@@ -527,9 +529,9 @@ bool ForEachAdjacentSubstatementsMatcher<T, ArgT>::matches(
           // Start with a fresh builder for this sequence
           BoundNodesTreeBuilder SequenceBuilder;
 
-          // Use enumerate to iterate over matchers and statements 
simultaneously
-          auto StmtRange =
-              llvm::make_range(StartIt, StartIt + Matchers.size());
+          // Use enumerate to iterate over matchers and statements
+          // simultaneously
+          auto StmtRange = llvm::make_range(StartIt, StartIt + 
Matchers.size());
           for (auto [Idx, Matcher, StmtPtr] :
                llvm::enumerate(Matchers, StmtRange)) {
             // Extend the builder before matching each statement
@@ -1134,9 +1136,9 @@ const 
internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
 const internal::VariadicFunction<internal::HasOpNameMatcher, StringRef,
                                  internal::hasAnyOperatorNameFunc>
     hasAnyOperatorName = {};
-const 
internal::VariadicFunction<internal::ForEachAdjacentSubstatementsMatcherType,
-                                 internal::Matcher<Stmt>,
-                                 internal::forEachAdjSubstatementsFunc>
+const internal::VariadicFunction<
+    internal::ForEachAdjacentSubstatementsMatcherType, internal::Matcher<Stmt>,
+    internal::forEachAdjSubstatementsFunc>
     forEachAdjacentSubstatements = {};
 const internal::VariadicFunction<internal::HasOverloadOpNameMatcher, StringRef,
                                  internal::hasAnyOverloadedOperatorNameFunc>
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp 
b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index ab0baade2..0213b2102 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -2410,13 +2410,13 @@ TEST(ForEachAdjSubstatements, 
MatchesMultipleAdjacentPairs) {
   // When multiple adjacent pairs exist, should match all of them
   EXPECT_TRUE(matchAndVerifyResultTrue(
       "void f() { {} 1+2; {} 3+4; }",
-      compoundStmt(forEachAdjacentSubstatements(
-          compoundStmt().bind("cs"), binaryOperator().bind("bo"))),
+      compoundStmt(forEachAdjacentSubstatements(compoundStmt().bind("cs"),
+                                                binaryOperator().bind("bo"))),
       std::make_unique<VerifyIdIsBoundTo<CompoundStmt>>("cs", 2)));
   EXPECT_TRUE(matchAndVerifyResultTrue(
       "void f() { {} 1+2; {} 3+4; }",
-      compoundStmt(forEachAdjacentSubstatements(
-          compoundStmt().bind("cs"), binaryOperator().bind("bo"))),
+      compoundStmt(forEachAdjacentSubstatements(compoundStmt().bind("cs"),
+                                                binaryOperator().bind("bo"))),
       std::make_unique<VerifyIdIsBoundTo<BinaryOperator>>("bo", 2)));
 }
 
@@ -2438,8 +2438,8 @@ TEST(ForEachAdjSubstatements, MatchesAllAdjacentPairs) {
   // When multiple adjacent pairs exist, should match all of them
   EXPECT_TRUE(matchAndVerifyResultTrue(
       "void f() { {} 1+2; int x; {} 3+4; }",
-      compoundStmt(forEachAdjacentSubstatements(
-          compoundStmt().bind("cs"), binaryOperator().bind("bo"))),
+      compoundStmt(forEachAdjacentSubstatements(compoundStmt().bind("cs"),
+                                                binaryOperator().bind("bo"))),
       std::make_unique<VerifyIdIsBoundTo<CompoundStmt>>("cs", 2)));
 }
 
@@ -2459,9 +2459,9 @@ TEST(ForEachAdjSubstatements, 
DoesNotMatchSingleStatement) {
 
 TEST(ForEachAdjSubstatements, MatchesDifferentStatementTypes) {
   // Test with different statement types
-  EXPECT_TRUE(
-      matches("void f() { for (;;); while (true); }",
-              compoundStmt(forEachAdjacentSubstatements(forStmt(), 
whileStmt()))));
+  EXPECT_TRUE(matches(
+      "void f() { for (;;); while (true); }",
+      compoundStmt(forEachAdjacentSubstatements(forStmt(), whileStmt()))));
 
   EXPECT_TRUE(matches(
       "void f() { int x; return; }",
@@ -2470,9 +2470,9 @@ TEST(ForEachAdjSubstatements, 
MatchesDifferentStatementTypes) {
 
 TEST(ForEachAdjSubstatements, WorksWithStmtExpr) {
   // Test that it works with StmtExpr (polymorphic support)
-  EXPECT_TRUE(matches(
-      "void f() { int x = ({ {} 1+2; }); }",
-      stmtExpr(forEachAdjacentSubstatements(compoundStmt(), 
binaryOperator()))));
+  EXPECT_TRUE(matches("void f() { int x = ({ {} 1+2; }); }",
+                      stmtExpr(forEachAdjacentSubstatements(
+                          compoundStmt(), binaryOperator()))));
 }
 
 TEST(ForEachAdjSubstatements, DoesNotMatchWrongOrder) {
@@ -2494,10 +2494,12 @@ TEST(ForEachAdjSubstatements, 
MatchesMultipleSequencesWithStatementsBetween) {
   constexpr llvm::StringRef Code =
       "void f() { {} 1+2; int x; {} 3+4; int y; {} 5+6; }";
   const auto Matcher = compoundStmt(forEachAdjacentSubstatements(
-          compoundStmt().bind("cs"), binaryOperator().bind("bo")));
-  EXPECT_TRUE(matchAndVerifyResultTrue(Code, Matcher,
+      compoundStmt().bind("cs"), binaryOperator().bind("bo")));
+  EXPECT_TRUE(matchAndVerifyResultTrue(
+      Code, Matcher,
       std::make_unique<VerifyIdIsBoundTo<CompoundStmt>>("cs", 3)));
-  EXPECT_TRUE(matchAndVerifyResultTrue(Code, Matcher,
+  EXPECT_TRUE(matchAndVerifyResultTrue(
+      Code, Matcher,
       std::make_unique<VerifyIdIsBoundTo<BinaryOperator>>("bo", 3)));
 }
 
@@ -2513,9 +2515,9 @@ TEST(ForEachAdjSubstatements, 
VariadicMatchesMultipleSequences) {
   // Test variadic version matches all sequences
   EXPECT_TRUE(matchAndVerifyResultTrue(
       "void f() { {} 1+2; 3+4; int x; {} 5+6; 7+8; }",
-      compoundStmt(forEachAdjacentSubstatements(
-          compoundStmt().bind("cs"), binaryOperator().bind("bo1"),
-          binaryOperator().bind("bo2"))),
+      compoundStmt(forEachAdjacentSubstatements(compoundStmt().bind("cs"),
+                                                binaryOperator().bind("bo1"),
+                                                binaryOperator().bind("bo2"))),
       std::make_unique<VerifyIdIsBoundTo<CompoundStmt>>("cs", 2)));
 }
 
@@ -2531,8 +2533,8 @@ TEST(ForEachAdjSubstatements, 
VariadicMatchesFiveAdjacentSubstatements) {
   // Test variadic version with 5 matchers
   EXPECT_TRUE(matches(
       "void f() { for (;;); while (true); if (true) {} return; 1+2; }",
-      compoundStmt(forEachAdjacentSubstatements(forStmt(), whileStmt(), 
ifStmt(),
-                                            returnStmt(), binaryOperator()))));
+      compoundStmt(forEachAdjacentSubstatements(
+          forStmt(), whileStmt(), ifStmt(), returnStmt(), binaryOperator()))));
 }
 
 TEST(ForEachAdjSubstatements, VariadicDoesNotMatchNonAdjacentSequence) {
@@ -2578,9 +2580,9 @@ TEST(ForEachAdjSubstatements, 
VariadicMatchesAllSequences) {
   // When multiple sequences exist, should match all of them
   EXPECT_TRUE(matchAndVerifyResultTrue(
       "void f() { {} 1+2; 3+4; int x; {} 5+6; 7+8; }",
-      compoundStmt(forEachAdjacentSubstatements(
-          compoundStmt().bind("cs"), binaryOperator().bind("bo1"),
-          binaryOperator().bind("bo2"))),
+      compoundStmt(forEachAdjacentSubstatements(compoundStmt().bind("cs"),
+                                                binaryOperator().bind("bo1"),
+                                                binaryOperator().bind("bo2"))),
       std::make_unique<VerifyIdIsBoundTo<CompoundStmt>>("cs", 2)));
 }
 
@@ -2637,19 +2639,19 @@ TEST(ForEachAdjSubstatements, 
MatchesOverlappingSequences) {
   // { {}; 1+2; {}; } has two sequences: {}->1+2 and 1+2->{}
   EXPECT_TRUE(matchAndVerifyResultTrue(
       "void f() { {} 1+2; {}; }",
-      compoundStmt(forEachAdjacentSubstatements(
-          compoundStmt().bind("cs"), binaryOperator().bind("bo"))),
+      compoundStmt(forEachAdjacentSubstatements(compoundStmt().bind("cs"),
+                                                binaryOperator().bind("bo"))),
       std::make_unique<VerifyIdIsBoundTo<CompoundStmt>>("cs", 1)));
   // The second sequence: binaryOperator followed by compoundStmt
   EXPECT_TRUE(matchAndVerifyResultTrue(
       "void f() { {} 1+2; {}; }",
-      compoundStmt(forEachAdjacentSubstatements(
-          binaryOperator().bind("bo"), compoundStmt().bind("cs"))),
+      compoundStmt(forEachAdjacentSubstatements(binaryOperator().bind("bo"),
+                                                compoundStmt().bind("cs"))),
       std::make_unique<VerifyIdIsBoundTo<BinaryOperator>>("bo", 1)));
   EXPECT_TRUE(matchAndVerifyResultTrue(
       "void f() { {} 1+2; {}; }",
-      compoundStmt(forEachAdjacentSubstatements(
-          binaryOperator().bind("bo"), compoundStmt().bind("cs"))),
+      compoundStmt(forEachAdjacentSubstatements(binaryOperator().bind("bo"),
+                                                compoundStmt().bind("cs"))),
       std::make_unique<VerifyIdIsBoundTo<CompoundStmt>>("cs", 1)));
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/173587
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to