[clang-tools-extra] Extend bugprone-use-after-move check to allow custom invalidation functions (PR #170346)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 11:50:26 PST 2025


================
@@ -399,7 +409,7 @@ static MoveType determineMoveType(const FunctionDecl *FuncDecl) {
   if (FuncDecl->getName() == "forward")
     return MoveType::Forward;
 
-  llvm_unreachable("Invalid move type");
+  return MoveType::Invalidation;
----------------
vbvictor wrote:

To keep ~sanity~ _soundness_ check, I think we should pass `InvalidationFunctions` to `determineMoveType` and write another `if (llvm::is_contained(FuncDecl->getName(), InvalidationFunctions))` if IIRC that `is_contained` does exist.

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


More information about the cfe-commits mailing list