mkovacevic99 wrote:
I have the Implementation for the churn fix as suggested — I gate the whole
thing on whether the initializer's ExprWithCleanups actually contains a block.
With that, only block-containing initializers get the conditional handling and
the guard-abort active flag; every other guarded static init is now
byte-for-byte identical to trunk (no flag). Verified on both the Itanium and
MSVC paths, with and without exceptions: the block cases (inline, escape, and
the mayThrow guard-abort case) are correct, and a plain static T t; is
unchanged.
So mechanically the patch is in good shape now — correct on all paths, no
codegen churn. The one thing still open is the direction, where I think you two
differ:
@ahatanak leaned toward compiling the single-run case correctly (which this
patch does).
@efriedma-quic would rather reject the construct in Sema unless we change the
lifetime-extension rules.
I'm happy to go either way, but I'd like you to settle that before I finalize,
so I'm not implementing something the other will block. If we support it, this
patch is ready. If we reject it, I'll write a Sema diagnostic instead — in
which case, what's the intended scope? The reported repro in #188058 is an
immediately-invoked block (static const int i = ^{ ...captures... }();), where
the block is consumed inside the initializer and the lifetime is unambiguous,
so I'd lean toward rejecting only the cases that actually need lifetime
extension rather than that well-defined inline form. Let me know which way
you'd like to take it.
https://github.com/llvm/llvm-project/pull/199508
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits