[clang] [clang-tools-extra] [clang-tidy] Add support for use-after-suspend to bugprone-use-after-move (PR #172566)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 15 12:03:55 PST 2026
================
@@ -544,13 +581,14 @@ void UseAfterMoveCheck::check(const MatchFinder::MatchResult &Result) {
// Ignore the std::move if the variable that was passed to it isn't a local
// variable.
- if (!Arg->getDecl()->getDeclContext()->isFunctionOrMethod())
+ if (Arg && !Arg->getDecl()->getDeclContext()->isFunctionOrMethod())
return;
- // Collect all code blocks that could use the arg after move.
- llvm::SmallVector<Stmt *> CodeBlocks{};
+ // Collect all code blocks that could use the arg after move, along with the
+ // declaration of the function containing each block of code.
+ llvm::SmallVector<std::pair<const Decl *, Stmt *>> CodeBlocks{};
----------------
vbvictor wrote:
If we store function, can we use `FunctionDecl*` for clarity?
```suggestion
llvm::SmallVector<std::pair<const FunctionDecl *, Stmt *>> CodeBlocks{};
```
https://github.com/llvm/llvm-project/pull/172566
More information about the cfe-commits
mailing list