This contributes follow-up work from https://reviews.llvm.org/D112491, which
allows for increased control over the matching of lambda captures. This also
updates the documentation for the lambdaCapture matcher.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| clang/include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 4224 | it would be nice to be able to do something like int main() {
  int x, y;
  float z;
  auto f = [=, z]() { return x+ y + z; };
}lambdaExpr(forEachLambdaCapture(isImplicit()) matches x and y but not z | |
| clang/include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 4224 | I believe that this should be possible, I've gone ahead and added some unit tests to demonstrate (see the tests named MatchImplicitCapturesOnly and MatchExplicitCapturesOnly). | |
| clang/include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 4235 | nice catch! i would have overlooked that detail. | |
it would be nice to be able to do something like
int main() { int x, y; float z; auto f = [=, z]() { return x+ y + z; }; }lambdaExpr(forEachLambdaCapture(isImplicit()) matches x and y but not z