[clang-tools-extra] [clang-tidy] Improve `bugprone-use-after-move` to handle lambdas (PR #173192)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 8 08:53:44 PST 2026


zwuis wrote:

Not sure if there are better approaches, but there are similar cases which should be handled in the future if we land this patch.

```cpp
[&] { // nested lambdas, seems low priority?
  [&] { use(std::move(x)); }(); // lambdas invalidating `x`
  [&] { reinit(x); }(); // correctly handled by this patch
  [&] { use(x); }(); // lambdas using `x`
}();
```

https://github.com/llvm/llvm-project/pull/173192


More information about the cfe-commits mailing list