Open Quuxplusone opened 6 years ago
Bugzilla Link | PR37981 |
Status | NEW |
Importance | P enhancement |
Reported by | David Poliakoff (poliakoff1@llnl.gov) |
Reported on | 2018-06-28 17:02:32 -0700 |
Last modified on | 2018-10-08 04:22:22 -0700 |
Version | unspecified |
Hardware | PC All |
CC | alexfh@google.com, development@jonas-toth.eu, klimek@google.com, steveire@gmail.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Also, I don't know if this is considered off-topic for the mailing list, but I did want to comment on how incredibly helpful clang-query has been, you've really enabled some cool workflows here, thanks!
LambdaExpr::children() doesn't contain the implicit declarations of the lambda
type and its operator(). You would need to add a couple of matchers for
getLambdaClass() and getCallOperator().
Something along the lines of:
AST_MATCHER_P(LambdaExpr, hasLambdaClass,
internal::Matcher<CXXRecordDecl>, InnerMatcher) {
return InnerMatcher.matches(*Node.getLambdaClass(), Finder, Builder);
}
+ docs, tests and registration for dynamic matchers.
See https://reviews.llvm.org/D28034 for an example.
Patches are welcome! ;)
Alexander,
Thanks for the sample patch, I'll see if I can make time to write this. It's really impressive how easy it is to add these matchers, I think the SVN checkout will take longer than writing the code
Orthogonal to this issue, is there anything similar to how clang-tidy has families of checkers to allow people to contribute families of matchers to clang-query? I'd like to write some matchers for our libraries, but they don't make sense in every build of clang-tools-extra. I'm of course not opposed to maintaining those as a patch against our local Clang installs, but if there's anything like the clang-tidy "packages" I'd love to use that
> Orthogonal to this issue, is there anything similar to how clang-tidy has
> families of checkers to allow people to contribute families of matchers to
> clang-query? I'd like to write some matchers for our libraries, but they
> don't make sense in every build of clang-tools-extra. I'm of course not
> opposed to maintaining those as a patch against our local Clang installs,
> but if there's anything like the clang-tidy "packages" I'd love to use that
The is no such package for matchers. What would be possible of course is to add
primitives to clang, that can then be used by your specific matchers.
Some matchers are configurable as well, e.g. a list of typenames could be
supplied to some matcher.
This might make it easier to maintain patches.
clang-tidy itself does have private matchers for specific tasks in some checks.
It might make sense to maintain a clang-tidy module that contains these
matchers.