[clang] [LifetimeSafety] Track moved declarations to prevent false positives (PR #170007)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 16 10:07:22 PST 2026


================
@@ -102,6 +102,11 @@ class FactsGenerator : public ConstStmtVisitor<FactsGenerator> {
   // corresponding to the left-hand side is updated to be a "write", thereby
   // exempting it from the check.
   llvm::DenseMap<const DeclRefExpr *, UseFact *> UseFacts;
+
+  // Tracks declarations that have been moved via std::move. This is used to
+  // prevent false positives when the original owner is destroyed after the
+  // value has been moved. This tracking is flow-insensitive.
----------------
usx95 wrote:

Moved comments and added the branch tests.

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


More information about the cfe-commits mailing list