@@ -15,7 +15,7 @@ using namespace llvm;
15
15
using namespace clang ;
16
16
using namespace ast_matchers ;
17
17
18
- namespace clang ::ast_matchers::internal {
18
+ namespace clang ::ast_matchers {
19
19
// A `RecursiveASTVisitor` that traverses all descendants of a given node "n"
20
20
// except for those belonging to a different callable of "n".
21
21
class MatchDescendantVisitor
@@ -26,9 +26,10 @@ class MatchDescendantVisitor
26
26
// Creates an AST visitor that matches `Matcher` on all
27
27
// descendants of a given node "n" except for the ones
28
28
// belonging to a different callable of "n".
29
- MatchDescendantVisitor (const DynTypedMatcher *Matcher, ASTMatchFinder *Finder,
30
- BoundNodesTreeBuilder *Builder,
31
- ASTMatchFinder::BindKind Bind)
29
+ MatchDescendantVisitor (const internal::DynTypedMatcher *Matcher,
30
+ internal::ASTMatchFinder *Finder,
31
+ internal::BoundNodesTreeBuilder *Builder,
32
+ internal::ASTMatchFinder::BindKind Bind)
32
33
: Matcher(Matcher), Finder(Finder), Builder(Builder), Bind(Bind),
33
34
Matches (false ) {}
34
35
@@ -86,32 +87,32 @@ class MatchDescendantVisitor
86
87
// Returns 'true' if traversal should continue after this function
87
88
// returns, i.e. if no match is found or 'Bind' is 'BK_All'.
88
89
template <typename T> bool match (const T &Node) {
89
- BoundNodesTreeBuilder RecursiveBuilder (*Builder);
90
+ internal:: BoundNodesTreeBuilder RecursiveBuilder (*Builder);
90
91
91
92
if (Matcher->matches (DynTypedNode::create (Node), Finder,
92
93
&RecursiveBuilder)) {
93
94
ResultBindings.addMatch (RecursiveBuilder);
94
95
Matches = true ;
95
- if (Bind != ASTMatchFinder::BK_All)
96
+ if (Bind != internal:: ASTMatchFinder::BK_All)
96
97
return false ; // Abort as soon as a match is found.
97
98
}
98
99
return true ;
99
100
}
100
101
101
- const DynTypedMatcher *const Matcher;
102
- ASTMatchFinder *const Finder;
103
- BoundNodesTreeBuilder *const Builder;
104
- BoundNodesTreeBuilder ResultBindings;
105
- const ASTMatchFinder::BindKind Bind;
102
+ const internal:: DynTypedMatcher *const Matcher;
103
+ internal:: ASTMatchFinder *const Finder;
104
+ internal:: BoundNodesTreeBuilder *const Builder;
105
+ internal:: BoundNodesTreeBuilder ResultBindings;
106
+ const internal:: ASTMatchFinder::BindKind Bind;
106
107
bool Matches;
107
108
};
108
109
109
- AST_MATCHER_P (Stmt, forEveryDescendant, Matcher<Stmt>, innerMatcher) {
110
+ AST_MATCHER_P (Stmt, forEveryDescendant, internal:: Matcher<Stmt>, innerMatcher) {
110
111
MatchDescendantVisitor Visitor (new DynTypedMatcher (innerMatcher), Finder,
111
112
Builder, ASTMatchFinder::BK_All);
112
113
return Visitor.findMatch (DynTypedNode::create (Node));
113
114
}
114
- } // namespace clang::ast_matchers::internal
115
+ } // namespace clang::ast_matchers
115
116
116
117
namespace {
117
118
// Because the analysis revolves around variables and their types, we'll need to
0 commit comments