diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp index 0bac2ed63a927..56bddce7d02dd 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 - bool traverse(const T &Node) { - static_assert(IsBaseType::value, - "traverse can only be instantiated with base type"); - if (!match(Node)) - return false; - return baseTraverse(Node); - } +template +bool traverse(const NodeType &node) { + static_assert(IsBaseType::value, + "traverse can only be instantiated with base type"); + if (!shouldContinue(node)) + return false; + return continueTraversal(node); +} + const DynTypedMatcher *const Matcher; ASTMatchFinder *const Finder;