[clang-tidy] Aliasing: Add support for captures.
authorArtem Dergachev <artem.dergachev@gmail.com>
Mon, 26 Apr 2021 20:47:36 +0000 (13:47 -0700)
committerArtem Dergachev <artem.dergachev@gmail.com>
Mon, 10 May 2021 21:00:30 +0000 (14:00 -0700)
commit43f4331edfb595979f6854351d24f9a9219595fa
treeb36fb4bd500317d221bf805e0cfef3d76111aaf3
parent6a64c462eb82f5f37e4ce512f4c25c474ddfcc4c
[clang-tidy] Aliasing: Add support for captures.

The utility function clang::tidy::utils::hasPtrOrReferenceInFunc() scans the
function for pointer/reference aliases to a given variable. It currently scans
for operator & over that variable and for declarations of references to that
variable.

This patch makes it also scan for C++ lambda captures by reference
and for Objective-C block captures.

Differential Revision: https://reviews.llvm.org/D96215
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