[clang] [LifetimeSafety] Detect expiry of loans to trivially destructed types (PR #168855)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 21 01:15:39 PST 2025


================
@@ -66,6 +66,9 @@ void FactsGenerator::run() {
       else if (std::optional<CFGAutomaticObjDtor> DtorOpt =
                    Element.getAs<CFGAutomaticObjDtor>())
         handleDestructor(*DtorOpt);
+      else if (std::optional<CFGLifetimeEnds> LifetimeEnds =
+                   Element.getAs<CFGLifetimeEnds>())
+        handleTrivialDestructors(*LifetimeEnds);
----------------
usx95 wrote:

SGTM.  
(Note that the attached facts is not the CFG but the generated lifetime facts from the CFG). The CFG looks like this: https://godbolt.org/z/jz3xYzqYh)

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


More information about the cfe-commits mailing list