@@ -2580,10 +2580,6 @@ void SILGenFunction::emitSwitchStmt(SwitchStmt *S) {
2580
2580
emitIgnoredExpr (S->getSubjectExpr ());
2581
2581
return failure (SILLocation (S));
2582
2582
}
2583
-
2584
- SILBasicBlock *contBB = createBasicBlock ();
2585
- emitProfilerIncrement (S);
2586
- JumpDest contDest (contBB, Cleanups.getCleanupsDepth (), CleanupLocation (S));
2587
2583
2588
2584
bool diagnosedError = false ;
2589
2585
@@ -2662,19 +2658,6 @@ void SILGenFunction::emitSwitchStmt(SwitchStmt *S) {
2662
2658
};
2663
2659
2664
2660
PatternMatchEmission emission (*this , S, completionHandler);
2665
-
2666
- Scope switchScope (Cleanups, CleanupLocation (S));
2667
-
2668
- // Enter a break/continue scope. If we wanted a continue
2669
- // destination, it would probably be out here.
2670
- BreakContinueDestStack.push_back ({S, contDest, JumpDest (S)});
2671
-
2672
- PatternMatchContext switchContext = { emission };
2673
- SwitchStack.push_back (&switchContext);
2674
-
2675
- // Emit the subject value. Dispatching will consume it.
2676
- ManagedValue subjectMV = emitRValueAsSingleValue (S->getSubjectExpr ());
2677
- auto subject = ConsumableManagedValue::forOwned (subjectMV);
2678
2661
2679
2662
// Add a row for each label of each case.
2680
2663
//
@@ -2700,6 +2683,23 @@ void SILGenFunction::emitSwitchStmt(SwitchStmt *S) {
2700
2683
hasFallthrough = containsFallthrough (caseBlock->getBody ());
2701
2684
}
2702
2685
2686
+ SILBasicBlock *contBB = createBasicBlock ();
2687
+ emitProfilerIncrement (S);
2688
+ JumpDest contDest (contBB, Cleanups.getCleanupsDepth (), CleanupLocation (S));
2689
+
2690
+ Scope switchScope (Cleanups, CleanupLocation (S));
2691
+
2692
+ // Enter a break/continue scope. If we wanted a continue
2693
+ // destination, it would probably be out here.
2694
+ BreakContinueDestStack.push_back ({S, contDest, JumpDest (S)});
2695
+
2696
+ PatternMatchContext switchContext = { emission };
2697
+ SwitchStack.push_back (&switchContext);
2698
+
2699
+ // Emit the subject value. Dispatching will consume it.
2700
+ ManagedValue subjectMV = emitRValueAsSingleValue (S->getSubjectExpr ());
2701
+ auto subject = ConsumableManagedValue::forOwned (subjectMV);
2702
+
2703
2703
// Set up an initial clause matrix.
2704
2704
ClauseMatrix clauses (clauseRows);
2705
2705
0 commit comments