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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 13 09:44:20 PDT 2021


NoQ added a comment.

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'.


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

https://reviews.llvm.org/D102213



More information about the cfe-commits mailing list