Add an argumentsAre matcher
Details
Diff Detail
- Build Status
Buildable 2535 Build 2535: arc lint + arc unit
Event Timeline
You should also regenerate the HTML matcher documentation as part of this patch.
include/clang/ASTMatchers/ASTMatchers.h | ||
---|---|---|
3075 | This is a neat matcher, but I'm not certain it will work with the dynamic matchers, which is an unfortunate divergence for clang-query. Another concern is that this is leaking implementation details into ASTMatchers.h rather than keeping them in ASTMatchersInternal.h. | |
unittests/ASTMatchers/ASTMatchersTraversalTest.cpp | ||
383 | How does this matcher work in the presence of default arguments? e.g., void f(int a, int b = 12); f(1); Will callExpr(argumentsAre(integerLiteral())) match? A similar question applies for variadic functions and functions without a prototype (from C). I suspect it all works fine, but some test cases would be nice. |
Given that this can't be expressed as a dynamic matcher, I'm wondering what the use case is for the matcher. Do you have a specific need for this functionality, or do you see this being generally useful?
@jdennett wanted this matcher for something he is working on and I had some free cycles to write it up. Unfortunately, I am about to leave on an extended vacation, so I will not be able to follow up with this patch for 2 months at the earliest.
I suspect the best solution is for someone to take over this patch and work with James to clarify any corner cases.
This is a neat matcher, but I'm not certain it will work with the dynamic matchers, which is an unfortunate divergence for clang-query.
Another concern is that this is leaking implementation details into ASTMatchers.h rather than keeping them in ASTMatchersInternal.h.