[clang] Refactor traverse function with clearer function names (PR #71441)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 6 12:26:00 PST 2023


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 74e0a26fd114cac39e251e4c2b6fbbadd6009887 1fc6f26966f0192bb1789b66778381d94cd6bbe5 -- clang/lib/ASTMatchers/ASTMatchFinder.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
index 56bddce7d..612bc3b5e 100644
--- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -395,15 +395,13 @@ private:
 
   // Traverses the subtree rooted at 'Node'; returns true if the
   // traversal should continue after this function returns.
-template <typename NodeType>
-bool traverse(const NodeType &node) {
+  template <typename NodeType> bool traverse(const NodeType &node) {
     static_assert(IsBaseType<NodeType>::value,
-        "traverse can only be instantiated with base type");
+                  "traverse can only be instantiated with base type");
     if (!shouldContinue(node))
-        return false;
+      return false;
     return continueTraversal(node);
-}
-
+  }
 
   const DynTypedMatcher *const Matcher;
   ASTMatchFinder *const Finder;

``````````

</details>


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


More information about the cfe-commits mailing list