File tree 3 files changed +10
-9
lines changed
SwiftCompilerSources/Sources
3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,8 @@ extension LifetimeDependentApply {
138
138
// for consistency, we use yieldAddress if any yielded value is an address.
139
139
let targetKind = beginApply. yieldedValues. contains ( where: { $0. type. isAddress } )
140
140
? TargetKind . yieldAddress : TargetKind . yield
141
- info. sources. push ( LifetimeSource ( targetKind: targetKind, convention: . scope( addressable: false ) ,
141
+ info. sources. push ( LifetimeSource ( targetKind: targetKind,
142
+ convention: . scope( addressable: false , addressableForDeps: false ) ,
142
143
value: beginApply. token) )
143
144
}
144
145
for operand in applySite. parameterOperands {
@@ -218,7 +219,7 @@ private extension LifetimeDependentApply.LifetimeSourceInfo {
218
219
bases. append ( source. value)
219
220
case . result, . inParameter, . inoutParameter:
220
221
// addressable dependencies directly depend on the incoming address.
221
- if context. options. enableAddressDependencies ( ) && source. convention. isAddressable {
222
+ if context. options. enableAddressDependencies ( ) && source. convention. isAddressable ( for : source . value ) {
222
223
bases. append ( source. value)
223
224
return
224
225
}
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ extension FunctionConvention {
237
237
238
238
public enum LifetimeDependenceConvention : CustomStringConvertible {
239
239
case inherit
240
- case scope( addressable: Bool )
240
+ case scope( addressable: Bool , addressableForDeps : Bool )
241
241
242
242
public var isScoped : Bool {
243
243
switch self {
@@ -248,12 +248,12 @@ public enum LifetimeDependenceConvention : CustomStringConvertible {
248
248
}
249
249
}
250
250
251
- public var isAddressable : Bool {
251
+ public func isAddressable( for value : Value ) -> Bool {
252
252
switch self {
253
253
case . inherit:
254
254
return false
255
- case let . scope( addressable) :
256
- return addressable
255
+ case let . scope( addressable, addressableForDeps ) :
256
+ return addressable || ( addressableForDeps && value . type . isAddressableForDeps ( in : value . parentFunction ) )
257
257
}
258
258
}
259
259
@@ -313,8 +313,8 @@ extension FunctionConvention {
313
313
}
314
314
if scope {
315
315
let addressable = bridged. checkAddressable ( bridgedIndex ( parameterIndex: index) )
316
- || bridged. checkConditionallyAddressable ( bridgedIndex ( parameterIndex: index) )
317
- return . scope( addressable: addressable)
316
+ let addressableForDeps = bridged. checkConditionallyAddressable ( bridgedIndex ( parameterIndex: index) )
317
+ return . scope( addressable: addressable, addressableForDeps : addressableForDeps )
318
318
}
319
319
return nil
320
320
}
Original file line number Diff line number Diff line change @@ -393,7 +393,7 @@ bool BridgedType::isMarkedAsImmortal() const {
393
393
}
394
394
395
395
bool BridgedType::isAddressableForDeps (BridgedFunction f) const {
396
- return unbridged ().isAddressableForDeps ();
396
+ return unbridged ().isAddressableForDeps (*f. getFunction () );
397
397
}
398
398
399
399
SwiftInt BridgedType::getCaseIdxOfEnumType (BridgedStringRef name) const {
You can’t perform that action at this time.
0 commit comments