[cfe-commits] [PATCH] Implements hasAncestor.

Daniel Jasper reviews at llvm-reviews.chandlerc.com
Thu Sep 6 13:47:27 PDT 2012



================
Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:461
@@ +460,3 @@
+                            llvm::is_base_of<Stmt, T>::value),
+                           only_Decl_or_Stmt_allowed_for_recursive_matching);
+    return matchesAncestorOf(ast_type_traits::DynTypedNode::create(Node),
----------------
Michael Diamond wrote:
> Manuel Klimek wrote:
> > Daniel Jasper wrote:
> > > Unlike descendants, all node types should have ancestors. Is it intentional to not allow this for QualTypes or possibly other types? 
> > > - If there is a good reason for it: Comment.
> > > - If it would be significant additional work: Command + FIXME
> > > - Otherwise: Implement ;-)
> > Like with the other methods here, there are many more nodes for which we want them implemented than are currently implemented.
> > 
> > You're right that for hasAncestor probably pretty much all nodes make sense. Added a class-level comment that outlines the differences.
> I really need this to work for QualTypes. Any chance of getting that in this CL? We don't have to update both ancestor and child matchers together necessarily.
Could you quickly elaborate on what you are in need of matching? This is actually not quite as easy (from a design perspective) and I think it should be in a different patch. But maybe we can find a way around it :-).


http://llvm-reviews.chandlerc.com/D36



More information about the cfe-commits mailing list