[cfe-dev] hasAnyArgument matcher

Ádám Balogh via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 7 07:22:14 PST 2016

Hi All,

I needed to extends Danial Marjamäki's MisPlacedWideningCastCheck Tidy checker for implicit casts, and also for further use cases such as return values and function arguments. (Maybe the check for misplaced implicit casts should be an option.) My problem was that hasAnyArgument() currently skips implicit casts and parenthesized expressions. However, it contains a "FIXME" comment that this skipping will be removed in the future once ignoreImplicit() matcher is implemented. This matcher seems to be implemented, but its name is ignoreImpCasts(). Is it the same matchers?

To overcome the problem I temporarily implemented a matcher called hasAnyArgumentRaw(), which is in the same a file as the checker. The question is what is the acceptable solution now:

1)      Leave the temporary matcher in the checker's source

2)      Move the matcher into ASTMatcher.h

3)      Execute the FIXME, thus remove the skipping of implicit casts (and parenthesized expressions)

For me 3) seems to be the best final solution, but will it not break any existing checkers? 2) seems totally unacceptable for me.

Thanks for the answers!



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160307/9533196d/attachment.html>

More information about the cfe-dev mailing list