================
@@ -2120,27 +2066,33 @@ void CodeGenFunction::EmitAutoVarCleanups(const 
AutoVarEmission &emission) {
   // us from jumping into any of these scopes anyway.
   if (!HaveInsertPoint()) return;
 
-  const VarDecl &D = *emission.Variable;
+  // If we're initializing directly on the heap, _Block_object_destroy will
+  // handle destruction, so we don't need to perform cleanups directly.
----------------
ille-apple wrote:

Indeed... and looking at this again, I put too much code inside the if 
statement.

Not only that, there's an existing bug here when combining 
`__attribute__((cleanup))` with `__block`: if the variable was copied to the 
heap, the cleanup function will be called after the byref allocation has 
already been freed.

Will fix.

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

Reply via email to