[PATCH] D89743: Support Attr in DynTypedNode and ASTMatchers.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 20 15:46:08 PST 2020


sammccall added a comment.

In D89743#2409001 <https://reviews.llvm.org/D89743#2409001>, @sammccall wrote:

> We didn't talk about overloading isImplicit to apply to attrs too, but it doesn't seem like that was controversial (and it does help with the tests).

I spoke too soon about this...
This prevents `hasAncestor(isImplicit())` from compiling, because `hasAncestor` needs to deduce the node type from its argument to call `ASTMatchFinder::matchesAncestorOf<T>()`.
This occurs in a few places in tree and many places in our private codebase...
The workaround is `hasAncestor(decl(isImplicit()))` which is reasonable, except that "is contained in *any* implicit node" is probably actually the intent. Well, at least it's not a regression.

In addition, while digging into this, I realized Attrs are not traversed in the parent map, and not supported by the parent/child/ancestor/descendant traversals.
So I'm fixing that... and adding some tests.

I'll need to send this for another round, even without the name matcher.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89743/new/

https://reviews.llvm.org/D89743



More information about the cfe-commits mailing list