[clang] [clang] Fix self-capturing `__block` variables (PR #89475)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 24 14:49:39 PDT 2024


================
@@ -2764,6 +2794,9 @@ void CodeGenFunction::emitByrefStructureInit(const AutoVarEmission &emission) {
     auto layoutInfo = CGM.getObjCRuntime().BuildByrefLayout(CGM, type);
     storeHeaderField(layoutInfo, getPointerSize(), "byref.layout");
   }
+
+  if (emission.NeedsInitOnHeap)
+    emitByrefInitOnHeap(pointer);
----------------
ille-apple wrote:

Ping.  Any thoughts?  I know this is a mess :)

If both options are too messy, there's also the option of making these self-captures a hard error, which would not break backwards compatibility since they never worked properly.

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


More information about the cfe-commits mailing list