https://github.com/796e43a5a8cdb73b92b created https://github.com/llvm/llvm-project/pull/71441
The `traverse` function has been updated for better readability and maintainability. The function now has clearer function names. >From 1fc6f26966f0192bb1789b66778381d94cd6bbe5 Mon Sep 17 00:00:00 2001 From: 796e43a5a8cdb73b92b <150074088+796e43a5a8cdb73b...@users.noreply.github.com> Date: Mon, 6 Nov 2023 20:22:57 +0000 Subject: [PATCH] Refactor traverse function with clearer function names The `traverse` function has been updated for better readability and maintainability. The function now has clearer function names. --- clang/lib/ASTMatchers/ASTMatchFinder.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp index 0bac2ed63a927ef..56bddce7d02ddfc 100644 --- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp @@ -395,14 +395,15 @@ class MatchChildASTVisitor // Traverses the subtree rooted at 'Node'; returns true if the // traversal should continue after this function returns. - template <typename T> - bool traverse(const T &Node) { - static_assert(IsBaseType<T>::value, - "traverse can only be instantiated with base type"); - if (!match(Node)) - return false; - return baseTraverse(Node); - } +template <typename NodeType> +bool traverse(const NodeType &node) { + static_assert(IsBaseType<NodeType>::value, + "traverse can only be instantiated with base type"); + if (!shouldContinue(node)) + return false; + return continueTraversal(node); +} + const DynTypedMatcher *const Matcher; ASTMatchFinder *const Finder; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits