[clang] [CIR] Implement cleanups for temporaries with automatic duration (PR #189754)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 07:25:53 PDT 2026


================
@@ -997,10 +1016,37 @@ class CIRGenFunction : public CIRGenTypeCache {
     cgm.errorNYI("pushFullExprCleanup in conditional branch");
   }
 
+  /// Queue a cleanup to be pushed after finishing the current full-expression.
+  /// This serializes the cleanup into a byte buffer
+  /// (lifetimeExtendedCleanupStack) so that popCleanupBlocks can later copy it
+  /// onto the EH scope stack for the enclosing scope. This approach is modeled
+  /// after classic codegen's pushCleanupAfterFullExprWithActiveFlag. The
+  /// byte-buffer serialization looks low-level, but it is needed because
+  /// multiple unrelated cleanup types (DestroyObject, CallLifetimeEnd,
+  /// CallObjCArcUse in classic codegen) all flow through this path, and the
+  /// polymorphic Cleanup objects are POD-like by contract, making the
----------------
erichkeane wrote:

POD isn't a thing anymore :) 

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


More information about the cfe-commits mailing list