File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -3327,17 +3327,20 @@ SILGenFunction::createWithoutActuallyEscapingClosure(
3327
3327
3328
3328
// Create it in our current function.
3329
3329
auto thunkValue = B.createFunctionRefFor (loc, thunk);
3330
+
3331
+ // Create a copy for the noescape value, so we can mark_dependence upon the
3332
+ // original value.
3330
3333
SILValue noEscapeValue =
3331
- noEscapingFunctionValue.ensurePlusOne (*this , loc).forward (*this );
3334
+ noEscapingFunctionValue.copy (*this , loc).forward (*this );
3332
3335
SingleValueInstruction *thunkedFn = B.createPartialApply (
3333
3336
loc, thunkValue,
3334
3337
SILType::getPrimitiveObjectType (substFnTy),
3335
3338
interfaceSubs,
3336
3339
noEscapeValue,
3337
3340
SILType::getPrimitiveObjectType (escapingFnTy));
3338
3341
// We need to ensure the 'lifetime' of the trivial values context captures. As
3339
- // long as we rerpresent these captures by the same value the following works.
3340
- thunkedFn = B.createMarkDependence (loc, thunkedFn, noEscapeValue );
3342
+ // long as we represent these captures by the same value the following works.
3343
+ thunkedFn = B.createMarkDependence (loc, thunkedFn, noEscapingFunctionValue. getValue () );
3341
3344
3342
3345
return emitManagedRValueWithCleanup (thunkedFn);
3343
3346
}
Original file line number Diff line number Diff line change 1
1
// RUN: %empty-directory(%t)
2
- // RUN: %target-build-swift -swift-version 4 %s -o %t/a.out -enforce-exclusivity=checked -Onone
2
+ // RUN: %target-build-swift -Xfrontend -verify-sil-ownership - swift-version 4 %s -o %t/a.out -enforce-exclusivity=checked -Onone
3
3
//
4
4
// RUN: %target-codesign %t/a.out
5
5
// RUN: %target-run %t/a.out
You can’t perform that action at this time.
0 commit comments