[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

Morris Hafner via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 31 07:44:35 PDT 2025


================
@@ -797,3 +799,11 @@ void CIRGenFunction::emitAutoVarTypeCleanup(
   assert(!cir::MissingFeatures::ehCleanupFlags());
   ehStack.pushCleanup<DestroyObject>(cleanupKind, addr, type, destroyer);
 }
+
+void CIRGenFunction::maybeEmitDeferredVarDeclInit(const VarDecl *vd) {
+  if (auto *dd = dyn_cast_if_present<DecompositionDecl>(vd)) {
+    for (auto *b : dd->flat_bindings())
+      if (auto *hd = b->getHoldingVar())
+        emitVarDecl(*hd);
+  }
+}
----------------
mmha wrote:

It surprises me a little that clang-format didn't catch this.

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


More information about the cfe-commits mailing list