================
@@ -2374,9 +2379,14 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt
&S) {
RunCleanupsScope ConditionScope(*this);
- if (S.getInit())
+ if (S.getInit()) {
EmitStmt(S.getInit());
+ // The init statement may have cleared the insertion point (e.g. it ended
in
+ // a 'noreturn' call); the condition emitted below needs a valid one.
+ EnsureInsertPoint();
----------------
efriedma-quic wrote:
If we wanted to be "optimal", instead of using EnsureInsertPoint to emit a
bunch of dead code, we could skip emitting the "switch". But doing that
correctly is probably too complicated to be worthwhile, given this situation
shouldn't show up in real code, so this patch seems fine.
https://github.com/llvm/llvm-project/pull/201047
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits