[clang] [clang-tools-extra] [clang-tidy] Add support for use-after-suspend to bugprone-use-after-move (PR #172566)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 8 06:14:48 PST 2026


================
@@ -544,13 +580,13 @@ 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.
----------------
zwuis wrote:

Please update the comment to explain the meaning of the stored `const Decl *`.

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


More information about the cfe-commits mailing list