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) {
117
117
P.startPipeline (" Mandatory Diagnostic Passes + Enabling Optimization Passes" );
118
118
P.addDiagnoseInvalidEscapingCaptures ();
119
119
P.addReferenceBindingTransform ();
120
- P.addDiagnoseStaticExclusivity ();
121
120
P.addNestedSemanticFunctionCheck ();
122
121
P.addCapturePromotion ();
123
122
@@ -130,6 +129,10 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
130
129
#else
131
130
P.addLegacyAllocBoxToStack ();
132
131
#endif
132
+ // Needs to run after MandatoryAllocBoxToStack, because MandatoryAllocBoxToStack
133
+ // can convert dynamic accesses to static accesses.
134
+ P.addDiagnoseStaticExclusivity ();
135
+
133
136
P.addNoReturnFolding ();
134
137
P.addBooleanLiteralFolding ();
135
138
addDefiniteInitialization (P);
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ func testLocalLetClosureCaptureVar() {
143
143
consumeVal ( x) // expected-note {{consumed here}}
144
144
// expected-note @-1 {{consumed again here}}
145
145
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}}
147
147
// expected-note @-2 {{conflicting access is here}}
148
148
// expected-note @-3 {{used here}}
149
149
// expected-note @-4 {{used here}}
@@ -975,7 +975,7 @@ func testLocalLetClosureCaptureConsuming(_ x: consuming SingleElt) {
975
975
consumeVal ( x) // expected-note {{consumed here}}
976
976
// expected-note @-1 {{consumed again here}}
977
977
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}}
979
979
// expected-note @-2 {{conflicting access is here}}
980
980
// expected-note @-3 {{consumed here}}
981
981
// expected-note @-4 {{used here}}
Original file line number Diff line number Diff line change @@ -263,12 +263,9 @@ func callsClosureLiteralImmediately() {
263
263
264
264
func callsStoredClosureLiteral( ) {
265
265
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}}
267
267
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}}
272
269
}
273
270
274
271
You can’t perform that action at this time.
0 commit comments