[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


================
@@ -408,41 +418,55 @@ static void emitDiagnostic(const Expr *MovingCall, const DeclRefExpr *MoveArg,
   const SourceLocation UseLoc = Use.DeclRef->getExprLoc();
   const SourceLocation MoveLoc = MovingCall->getExprLoc();
 
-  const bool IsMove = (Type == MoveType::Move);
+  const int Kind = static_cast<int>(Type);
----------------
vbvictor wrote:

Since we anyway cast `Type` to `int`, It's better to drop `class` in `enum class` and hardcode enum values to deterministic `int` values. Or there are places that still benefit having `enum class`?

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


More information about the cfe-commits mailing list