[PATCH] D102213: [ASTMatchers] Add forCallable(), a generalization of forFunction().

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 12 10:05:29 PDT 2021


NoQ added a comment.

I totally agree that changing `forFunction()` to work correctly is the right solution but backwards compatibility breakage is very real because `forFunction()` accepts a `Matcher<FunctionDecl>` whereas `forCallable()` accepts `Matcher<Decl>` which is a smaller set of matchers. Eg., `forFunction(hasName())` is valid code bug `forCallable(hasName())` is not because `BlockDecl` isn't a `NamedDecl`. So, like, I suspect that not a lot of code expects this to be **//the//** function, but a lot of code expects it to be **//a//** function. See how much types did I have to change just to get the infinite loop checker to compile in D102214 <https://reviews.llvm.org/D102214>.

If we're ok with such compatibility breakage then i'm all for it.


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

https://reviews.llvm.org/D102213



More information about the cfe-commits mailing list