================
@@ -1360,8 +1360,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
QualType RetTy,
else
Ty = VD->getType();
- if (Ty->isVariablyModifiedType())
+ if (Ty->isVariablyModifiedType()) {
+ RunCleanupsScope Scope(*this);
----------------
AaronBallman wrote:
> That said, "destroying" a compound literal doesn't really do anything at the
> moment; outside of ObjC ARC, C doesn't have destructors, and we don't emit
> lifetime intrinsics (#68746) .
C does now have `_Defer` though for running cleanups at the appropriate time,
we have lifetime analysis in C, and we have `__attribute__((cleanup))` (though
that's on a declaration of a variable and shouldn't matter here). Given that a
common idiom in C is to take the address of the compound literal (because it's
an lvalue, unlike in C++), I think we have to be careful about getting cleanups
correct.
https://github.com/llvm/llvm-project/pull/212559
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits