[PATCH] D101787: [clang-tidy] Aliasing: Add more support for lambda captures.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 3 14:42:25 PDT 2021


NoQ created this revision.
NoQ added reviewers: alexfh, gribozavr2, aaron.ballman, vsavchenko.
Herald added subscribers: martong, mgehre, xazax.hun.
NoQ requested review of this revision.
Herald added a project: clang-tools-extra.

D96215 <https://reviews.llvm.org/D96215> takes care of the situation where the variable is captured into a nearby lambda. This patch takes care of the situation where the current function //is// the lambda and the variable is one of its captures from an enclosing scope.

The analogous problem for ^{blocks} is already handled automagically by the previous patch. That said, I added two FIXME tests that demonstrate an unrelated (but fairly disturbing) problem: because `BlockDecl` isn't a `FunctionDecl`, the `forFunction()` matcher doesn't behave as expected. This time it manifests through alias analysis analyzing more code than necessary but there are other annoying effects of this bug that I'll get to later.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D101787

Files:
  clang-tools-extra/clang-tidy/utils/Aliasing.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-infinite-loop.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101787.342546.patch
Type: text/x-patch
Size: 6579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210503/db60cdf7/attachment.bin>


More information about the cfe-commits mailing list