[PATCH] D102213: [ASTMatchers] Add forCallable(), a generalization of forFunction().
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 13 09:45:43 PDT 2021
vsavchenko added a comment.
In D102213#2757253 <https://reviews.llvm.org/D102213#2757253>, @NoQ wrote:
> In D102213#2756254 <https://reviews.llvm.org/D102213#2756254>, @vsavchenko wrote:
>
>>> Additionally, forCallable(functionDecl()) is not equivalent to forFunction() (the former silently matches less stuff).
>>
>> I'm not sure I understand this one. Can you please show an example where one matches something that the other doesn't?
>
>
>
> void foo() {
> ^{
> int x = 1;
> }
> }
>
> Here `declStmt(forCallable(functionDecl()))` doesn't match because the callable the variable belongs to isn't a `FunctionDecl` but `declStmt(forFunction())` matches 'x' for 'foo'.
Ahhh, right! Thanks!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102213/new/
https://reviews.llvm.org/D102213
More information about the cfe-commits
mailing list