[PATCH] D54259: [ASTMatchers] proof-of-concept: allow matching within a restricted scope.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 8 07:02:14 PST 2018
sammccall created this revision.
Herald added subscribers: cfe-commits, kadircet, zzheng, ioeric, ilya-biryukov.
Herald added a reviewer: shafik.
Tools may want to match only within e.g. the main file.
We can run the matcher only over those "top-level decls" but if it "escapes"
e.g. using the hasAncestor() matcher, then all bets are off.
In fact, any use of hasAncestor() or hasParent() will cause us to pay O(|TU|) in
performance to build the parent map, which is unacceptably bad for clangd.
The approach taken here is to restrict the parent map to only include edges
reachable from the top-level decls.
We create a "bounds" object wrapping the decls, and store the parent map cache
in it. This object must be plumbed around manually.
Not asking for review and probably won't in this form, too much plumbing.
Sadly, the better option is probably to make this a mutable attribute of
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 121741 bytes
Desc: not available
More information about the cfe-commits