summaryrefslogtreecommitdiffstats
path: root/clang/lib/ASTMatchers/ASTMatchFinder.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2012-10-22 16:26:51 +0000
committerDaniel Jasper <djasper@google.com>2012-10-22 16:26:51 +0000
commit632aea92a57b5611cf54fc159cc3f77547a24ff7 (patch)
treeb83591ea64f636bc791e8d78c3cad8064de6a26b /clang/lib/ASTMatchers/ASTMatchFinder.cpp
parent7bc31332b8350e297e08477e39f7ca28f5f6de80 (diff)
downloadbcm5719-llvm-632aea92a57b5611cf54fc159cc3f77547a24ff7.tar.gz
bcm5719-llvm-632aea92a57b5611cf54fc159cc3f77547a24ff7.zip
Implement hasParent()-matcher.
llvm-svn: 166421
Diffstat (limited to 'clang/lib/ASTMatchers/ASTMatchFinder.cpp')
-rw-r--r--clang/lib/ASTMatchers/ASTMatchFinder.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
index ebbadc424d4..c0d97df0758 100644
--- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -352,7 +352,7 @@ public:
const Matcher<NamedDecl> &Base,
BoundNodesTreeBuilder *Builder);
- // Implements ASTMatchFinder::MatchesChildOf.
+ // Implements ASTMatchFinder::matchesChildOf.
virtual bool matchesChildOf(const ast_type_traits::DynTypedNode &Node,
const DynTypedMatcher &Matcher,
BoundNodesTreeBuilder *Builder,
@@ -361,7 +361,7 @@ public:
return matchesRecursively(Node, Matcher, Builder, 1, Traversal,
Bind);
}
- // Implements ASTMatchFinder::MatchesDescendantOf.
+ // Implements ASTMatchFinder::matchesDescendantOf.
virtual bool matchesDescendantOf(const ast_type_traits::DynTypedNode &Node,
const DynTypedMatcher &Matcher,
BoundNodesTreeBuilder *Builder,
@@ -372,7 +372,8 @@ public:
// Implements ASTMatchFinder::matchesAncestorOf.
virtual bool matchesAncestorOf(const ast_type_traits::DynTypedNode &Node,
const DynTypedMatcher &Matcher,
- BoundNodesTreeBuilder *Builder) {
+ BoundNodesTreeBuilder *Builder,
+ AncestorMatchMode MatchMode) {
if (!Parents) {
// We always need to run over the whole translation unit, as
// \c hasAncestor can escape any subtree.
@@ -395,6 +396,8 @@ public:
Ancestor = I->second;
if (Matcher.matches(Ancestor, this, Builder))
return true;
+ if (MatchMode == ASTMatchFinder::AMM_ParentOnly)
+ return false;
}
return false;
}
OpenPOWER on IntegriCloud