================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to