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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 5 08:28:00 PDT 2021


aaron.ballman added a comment.

In D96215#2737085 <https://reviews.llvm.org/D96215#2737085>, @NoQ wrote:

> In D96215#2735546 <https://reviews.llvm.org/D96215#2735546>, @njames93 wrote:
>
>> Just my $0.02, We shouldn't worry too much about pathological cases like that. I imagine that code would almost never appear in the wild. And for cases where you don't have access to definition for `hidden_reference `, there's not much that can be done anyway.
>
> That's not what I typically tell myself; it really amazes me that for almost all such pathological cases there appear to be users who write such code on a regular basis.

+1, Hyrum's Law is real. :-) (or :-(, more accurately).



================
Comment at: clang-tools-extra/clang-tidy/utils/Aliasing.cpp:45-48
+    return llvm::any_of(LE->captures(), [Var](const LambdaCapture &C) {
+      return C.capturesVariable() && C.getCaptureKind() == LCK_ByRef &&
+             C.getCapturedVar() == Var;
+    });
----------------
Should this use `capturesByRef()` from https://reviews.llvm.org/D101787?


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

https://reviews.llvm.org/D96215



More information about the cfe-commits mailing list