================ @@ -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:
Updated to add the flag. It's not all that bad. In fact, if, as I suggested in my last comment, we want to support the byref lingering after unwinding, then there *must* be some kind of runtime state – to track whether whoever drops the last reference needs to run the destructor. It would be more natural for the Blocks runtime to track that state rather than relying on compiler-generated code, but the state has to live somewhere. If, on the other hand, we don't want to support the byref lingering after unwinding, then I could go back to the idea of mutating the existing `flags` field. In that scenario, the existence of runtime state would be unnecessary, but the implementation would be relatively unobtrusive. https://github.com/llvm/llvm-project/pull/89475 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits