File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
lib/SILOptimizer/PassManager Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,6 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
117117 P.startPipeline (" Mandatory Diagnostic Passes + Enabling Optimization Passes" );
118118 P.addDiagnoseInvalidEscapingCaptures ();
119119 P.addReferenceBindingTransform ();
120- P.addDiagnoseStaticExclusivity ();
121120 P.addNestedSemanticFunctionCheck ();
122121 P.addCapturePromotion ();
123122
@@ -130,6 +129,10 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
130129#else
131130 P.addLegacyAllocBoxToStack ();
132131#endif
132+ // Needs to run after MandatoryAllocBoxToStack, because MandatoryAllocBoxToStack
133+ // can convert dynamic accesses to static accesses.
134+ P.addDiagnoseStaticExclusivity ();
135+
133136 P.addNoReturnFolding ();
134137 P.addBooleanLiteralFolding ();
135138 addDefiniteInitialization (P);
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ func testLocalLetClosureCaptureVar() {
143143 consumeVal ( x) // expected-note {{consumed here}}
144144 // expected-note @-1 {{consumed again here}}
145145 borrowConsumeVal ( x, x)
146- // expected-error @-1 {{overlapping accesses, but deinitialization requires exclusive access}}
146+ // expected-error @-1 {{overlapping accesses to 'x' , but deinitialization requires exclusive access}}
147147 // expected-note @-2 {{conflicting access is here}}
148148 // expected-note @-3 {{used here}}
149149 // expected-note @-4 {{used here}}
@@ -975,7 +975,7 @@ func testLocalLetClosureCaptureConsuming(_ x: consuming SingleElt) {
975975 consumeVal ( x) // expected-note {{consumed here}}
976976 // expected-note @-1 {{consumed again here}}
977977 borrowConsumeVal ( x, x) // expected-note {{used here}}
978- // expected-error @-1 {{overlapping accesses, but deinitialization requires exclusive access}}
978+ // expected-error @-1 {{overlapping accesses to 'x' , but deinitialization requires exclusive access}}
979979 // expected-note @-2 {{conflicting access is here}}
980980 // expected-note @-3 {{consumed here}}
981981 // expected-note @-4 {{used here}}
Original file line number Diff line number Diff line change @@ -263,12 +263,9 @@ func callsClosureLiteralImmediately() {
263263
264264func callsStoredClosureLiteral( ) {
265265 var i = 7 ;
266- let c = { ( p: inout Int ) in i}
266+ let c = { ( p: inout Int ) in i} // expected-note {{conflicting access is here}}
267267
268- // Closure literals that are stored and later called are treated as escaping
269- // We don't expect a static exclusivity diagnostic here, but the issue
270- // will be caught at run time
271- _ = c ( & i) // no-error
268+ _ = c ( & i) // expected-error {{overlapping accesses to 'i', but modification requires exclusive access; consider copying to a local variable}}
272269}
273270
274271
You can’t perform that action at this time.
0 commit comments