AST Matcher only on subtree

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

AST Matcher only on subtree

This post has NOT been accepted by the mailing list yet.
I want to find a variable named "x", so I define a DeclarationMatcher

DeclarationMatcher decmatch = varDecl().bind("id");

Also I set up the MatchFinder with the matcher and the MatchCallBack

 matcher.addMatcher(decmatch, &callback);

I use this to match a given AST


I'd like to know if it is possible to use this matcher to match only inside a subtree and not on the whole AST. For example, if a have a given FunctionDecl node, I'd like to use the matcher to match only against nodes below this one. I've searched through the documentation and could not find anything to help me with this.