Skip to content

Commit 715d1f9

Browse files
authored
Merge pull request #20818 from slavapestov/weak-unowned-mangling-5.0
AST: Don't mangle weak/unowned as part of a property's type [5.0; ABI]
2 parents 1ae6946 + 01d77ab commit 715d1f9

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

lib/AST/ASTMangler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,9 @@ CanType ASTMangler::getDeclTypeForMangling(
20992099
}
21002100

21012101

2102-
CanType type = decl->getInterfaceType()->getCanonicalType();
2102+
CanType type = decl->getInterfaceType()
2103+
->getReferenceStorageReferent()
2104+
->getCanonicalType();
21032105
if (auto gft = dyn_cast<GenericFunctionType>(type)) {
21042106
genericSig = gft.getGenericSignature();
21052107
CurGenericSignature = gft.getGenericSignature();

test/IRGen/objc_properties.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ class Class17127126 {
235235
// CHECK: @_INSTANCE_METHODS__TtC15objc_properties4Tree =
236236
// CHECK: i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_selector_data(parent)", i64 0, i64 0),
237237
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[GETTER_SIGNATURE]], i64 0, i64 0),
238-
// CHECK: i8* bitcast (%2* (%2*, i8*)* @"$s15objc_properties4TreeC6parentACSgXwvgTo" to i8*)
238+
// CHECK: i8* bitcast (%2* (%2*, i8*)* @"$s15objc_properties4TreeC6parentACSgvgTo" to i8*)
239239
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @"\01L_selector_data(setParent:)", i64 0, i64 0),
240240
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* [[SETTER_SIGNATURE]], i64 0, i64 0),
241-
// CHECK: i8* bitcast (void (%2*, i8*, %2*)* @"$s15objc_properties4TreeC6parentACSgXwvsTo" to i8*)
241+
// CHECK: i8* bitcast (void (%2*, i8*, %2*)* @"$s15objc_properties4TreeC6parentACSgvsTo" to i8*)
242242

243243
// CHECK: @_PROTOCOL__TtP15objc_properties5Proto_ = private constant { {{.+}} } {
244244
// CHECK: i8* null,

test/SILGen/modify.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class HasStoredDidSet {
224224
class HasWeak {
225225
weak var weakvar: HasWeak?
226226
}
227-
// CHECK-LABEL: sil hidden [transparent] @$s6modify7HasWeakC7weakvarACSgXwvM : $@yield_once @convention(method) (@guaranteed HasWeak) -> @yields @inout Optional<HasWeak> {
227+
// CHECK-LABEL: sil hidden [transparent] @$s6modify7HasWeakC7weakvarACSgvM : $@yield_once @convention(method) (@guaranteed HasWeak) -> @yields @inout Optional<HasWeak> {
228228
// CHECK: bb0([[SELF:%.*]] : @guaranteed $HasWeak):
229229
// CHECK: [[PROP:%.*]] = ref_element_addr [[SELF]] : $HasWeak, #HasWeak.weakvar
230230
// CHECK: [[ACCESS:%.*]] = begin_access [modify] [dynamic] [[PROP]] : $*@sil_weak Optional<HasWeak>

test/SILGen/struct_resilience.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ public struct MySize {
120120
// CHECK-LABEL: sil @$s17struct_resilience6MySizeV1hSivg : $@convention(method) (@in_guaranteed MySize) -> Int
121121
public let h: Int
122122

123+
// Weak property
124+
125+
// CHECK-LABEL: sil @$s17struct_resilience6MySizeV1iyXlSgvg : $@convention(method) (@in_guaranteed MySize) -> @owned Optional<AnyObject>
126+
public weak var i: AnyObject?
127+
123128
// Static stored property
124129

125130
// CHECK-LABEL: sil @$s17struct_resilience6MySizeV9copyrightSivgZ : $@convention(method) (@thin MySize.Type) -> Int

test/api-digester/Outputs/cake-abi.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
}
247247
],
248248
"declKind": "Accessor",
249-
"usr": "s:4cake2C1C3InsACSgXwvg",
249+
"usr": "s:4cake2C1C3InsACSgvg",
250250
"moduleName": "cake",
251251
"implicit": true,
252252
"declAttributes": [
@@ -279,7 +279,7 @@
279279
}
280280
],
281281
"declKind": "Accessor",
282-
"usr": "s:4cake2C1C3InsACSgXwvs",
282+
"usr": "s:4cake2C1C3InsACSgvs",
283283
"moduleName": "cake",
284284
"implicit": true,
285285
"declAttributes": [
@@ -288,7 +288,7 @@
288288
}
289289
],
290290
"declKind": "Var",
291-
"usr": "s:4cake2C1C3InsACSgXwvp",
291+
"usr": "s:4cake2C1C3InsACSgvp",
292292
"moduleName": "cake",
293293
"declAttributes": [
294294
"HasInitialValue",
@@ -321,7 +321,7 @@
321321
}
322322
],
323323
"declKind": "Accessor",
324-
"usr": "s:4cake2C1C4Ins2ACXovg",
324+
"usr": "s:4cake2C1C4Ins2ACvg",
325325
"moduleName": "cake",
326326
"implicit": true,
327327
"declAttributes": [
@@ -346,7 +346,7 @@
346346
}
347347
],
348348
"declKind": "Accessor",
349-
"usr": "s:4cake2C1C4Ins2ACXovs",
349+
"usr": "s:4cake2C1C4Ins2ACvs",
350350
"moduleName": "cake",
351351
"implicit": true,
352352
"declAttributes": [
@@ -355,7 +355,7 @@
355355
}
356356
],
357357
"declKind": "Var",
358-
"usr": "s:4cake2C1C4Ins2ACXovp",
358+
"usr": "s:4cake2C1C4Ins2ACvp",
359359
"moduleName": "cake",
360360
"declAttributes": [
361361
"HasInitialValue",

test/api-digester/Outputs/cake.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@
289289
}
290290
],
291291
"declKind": "Accessor",
292-
"usr": "s:4cake2C1C3InsACSgXwvg",
292+
"usr": "s:4cake2C1C3InsACSgvg",
293293
"moduleName": "cake",
294294
"implicit": true,
295295
"declAttributes": [
@@ -322,7 +322,7 @@
322322
}
323323
],
324324
"declKind": "Accessor",
325-
"usr": "s:4cake2C1C3InsACSgXwvs",
325+
"usr": "s:4cake2C1C3InsACSgvs",
326326
"moduleName": "cake",
327327
"implicit": true,
328328
"declAttributes": [
@@ -331,7 +331,7 @@
331331
}
332332
],
333333
"declKind": "Var",
334-
"usr": "s:4cake2C1C3InsACSgXwvp",
334+
"usr": "s:4cake2C1C3InsACSgvp",
335335
"moduleName": "cake",
336336
"declAttributes": [
337337
"HasInitialValue",
@@ -363,7 +363,7 @@
363363
}
364364
],
365365
"declKind": "Accessor",
366-
"usr": "s:4cake2C1C4Ins2ACXovg",
366+
"usr": "s:4cake2C1C4Ins2ACvg",
367367
"moduleName": "cake",
368368
"implicit": true,
369369
"declAttributes": [
@@ -388,7 +388,7 @@
388388
}
389389
],
390390
"declKind": "Accessor",
391-
"usr": "s:4cake2C1C4Ins2ACXovs",
391+
"usr": "s:4cake2C1C4Ins2ACvs",
392392
"moduleName": "cake",
393393
"implicit": true,
394394
"declAttributes": [
@@ -397,7 +397,7 @@
397397
}
398398
],
399399
"declKind": "Var",
400-
"usr": "s:4cake2C1C4Ins2ACXovp",
400+
"usr": "s:4cake2C1C4Ins2ACvp",
401401
"moduleName": "cake",
402402
"declAttributes": [
403403
"HasInitialValue",

0 commit comments

Comments
 (0)