[clang] [LifetimeSafety] Add support for tracking non-trivially destructed temporary objects (PR #172007)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 15 05:08:24 PST 2025


================
@@ -218,9 +241,14 @@ void FactsGenerator::VisitMaterializeTemporaryExpr(
     const MaterializeTemporaryExpr *MTE) {
   if (!hasOrigin(MTE))
     return;
-  // A temporary object's origin is the same as the origin of the
-  // expression that initializes it.
-  killAndFlowOrigin(*MTE, *MTE->getSubExpr());
+  if (getChildBinding(MTE)) {
----------------
usx95 wrote:

I would use `!isPointerType(MTE->getType())` instead of this to correctly reflect the issue with l-valued pointer type expr. For other `MTE`, we would have a loan issued but no corresponding expire because of no `BTE` child.

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


More information about the cfe-commits mailing list