Skip to content

AST: Don't mangle weak/unowned as part of a property's type [5.0; ABI] #20818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,9 @@ CanType ASTMangler::getDeclTypeForMangling(
}


CanType type = decl->getInterfaceType()->getCanonicalType();
CanType type = decl->getInterfaceType()
->getReferenceStorageReferent()
->getCanonicalType();
if (auto gft = dyn_cast<GenericFunctionType>(type)) {
genericSig = gft.getGenericSignature();
CurGenericSignature = gft.getGenericSignature();
Expand Down
4 changes: 2 additions & 2 deletions test/IRGen/objc_properties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ class Class17127126 {
// CHECK: @_INSTANCE_METHODS__TtC15objc_properties4Tree =
// CHECK: i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_selector_data(parent)", i64 0, i64 0),
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[GETTER_SIGNATURE]], i64 0, i64 0),
// CHECK: i8* bitcast (%2* (%2*, i8*)* @"$s15objc_properties4TreeC6parentACSgXwvgTo" to i8*)
// CHECK: i8* bitcast (%2* (%2*, i8*)* @"$s15objc_properties4TreeC6parentACSgvgTo" to i8*)
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @"\01L_selector_data(setParent:)", i64 0, i64 0),
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* [[SETTER_SIGNATURE]], i64 0, i64 0),
// CHECK: i8* bitcast (void (%2*, i8*, %2*)* @"$s15objc_properties4TreeC6parentACSgXwvsTo" to i8*)
// CHECK: i8* bitcast (void (%2*, i8*, %2*)* @"$s15objc_properties4TreeC6parentACSgvsTo" to i8*)

// CHECK: @_PROTOCOL__TtP15objc_properties5Proto_ = private constant { {{.+}} } {
// CHECK: i8* null,
Expand Down
2 changes: 1 addition & 1 deletion test/SILGen/modify.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class HasStoredDidSet {
class HasWeak {
weak var weakvar: HasWeak?
}
// CHECK-LABEL: sil hidden [transparent] @$s6modify7HasWeakC7weakvarACSgXwvM : $@yield_once @convention(method) (@guaranteed HasWeak) -> @yields @inout Optional<HasWeak> {
// CHECK-LABEL: sil hidden [transparent] @$s6modify7HasWeakC7weakvarACSgvM : $@yield_once @convention(method) (@guaranteed HasWeak) -> @yields @inout Optional<HasWeak> {
// CHECK: bb0([[SELF:%.*]] : @guaranteed $HasWeak):
// CHECK: [[PROP:%.*]] = ref_element_addr [[SELF]] : $HasWeak, #HasWeak.weakvar
// CHECK: [[ACCESS:%.*]] = begin_access [modify] [dynamic] [[PROP]] : $*@sil_weak Optional<HasWeak>
Expand Down
5 changes: 5 additions & 0 deletions test/SILGen/struct_resilience.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ public struct MySize {
// CHECK-LABEL: sil @$s17struct_resilience6MySizeV1hSivg : $@convention(method) (@in_guaranteed MySize) -> Int
public let h: Int

// Weak property

// CHECK-LABEL: sil @$s17struct_resilience6MySizeV1iyXlSgvg : $@convention(method) (@in_guaranteed MySize) -> @owned Optional<AnyObject>
public weak var i: AnyObject?

// Static stored property

// CHECK-LABEL: sil @$s17struct_resilience6MySizeV9copyrightSivgZ : $@convention(method) (@thin MySize.Type) -> Int
Expand Down
12 changes: 6 additions & 6 deletions test/api-digester/Outputs/cake-abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
}
],
"declKind": "Accessor",
"usr": "s:4cake2C1C3InsACSgXwvg",
"usr": "s:4cake2C1C3InsACSgvg",
"moduleName": "cake",
"implicit": true,
"declAttributes": [
Expand Down Expand Up @@ -279,7 +279,7 @@
}
],
"declKind": "Accessor",
"usr": "s:4cake2C1C3InsACSgXwvs",
"usr": "s:4cake2C1C3InsACSgvs",
"moduleName": "cake",
"implicit": true,
"declAttributes": [
Expand All @@ -288,7 +288,7 @@
}
],
"declKind": "Var",
"usr": "s:4cake2C1C3InsACSgXwvp",
"usr": "s:4cake2C1C3InsACSgvp",
"moduleName": "cake",
"declAttributes": [
"HasInitialValue",
Expand Down Expand Up @@ -321,7 +321,7 @@
}
],
"declKind": "Accessor",
"usr": "s:4cake2C1C4Ins2ACXovg",
"usr": "s:4cake2C1C4Ins2ACvg",
"moduleName": "cake",
"implicit": true,
"declAttributes": [
Expand All @@ -346,7 +346,7 @@
}
],
"declKind": "Accessor",
"usr": "s:4cake2C1C4Ins2ACXovs",
"usr": "s:4cake2C1C4Ins2ACvs",
"moduleName": "cake",
"implicit": true,
"declAttributes": [
Expand All @@ -355,7 +355,7 @@
}
],
"declKind": "Var",
"usr": "s:4cake2C1C4Ins2ACXovp",
"usr": "s:4cake2C1C4Ins2ACvp",
"moduleName": "cake",
"declAttributes": [
"HasInitialValue",
Expand Down
12 changes: 6 additions & 6 deletions test/api-digester/Outputs/cake.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
}
],
"declKind": "Accessor",
"usr": "s:4cake2C1C3InsACSgXwvg",
"usr": "s:4cake2C1C3InsACSgvg",
"moduleName": "cake",
"implicit": true,
"declAttributes": [
Expand Down Expand Up @@ -322,7 +322,7 @@
}
],
"declKind": "Accessor",
"usr": "s:4cake2C1C3InsACSgXwvs",
"usr": "s:4cake2C1C3InsACSgvs",
"moduleName": "cake",
"implicit": true,
"declAttributes": [
Expand All @@ -331,7 +331,7 @@
}
],
"declKind": "Var",
"usr": "s:4cake2C1C3InsACSgXwvp",
"usr": "s:4cake2C1C3InsACSgvp",
"moduleName": "cake",
"declAttributes": [
"HasInitialValue",
Expand Down Expand Up @@ -363,7 +363,7 @@
}
],
"declKind": "Accessor",
"usr": "s:4cake2C1C4Ins2ACXovg",
"usr": "s:4cake2C1C4Ins2ACvg",
"moduleName": "cake",
"implicit": true,
"declAttributes": [
Expand All @@ -388,7 +388,7 @@
}
],
"declKind": "Accessor",
"usr": "s:4cake2C1C4Ins2ACXovs",
"usr": "s:4cake2C1C4Ins2ACvs",
"moduleName": "cake",
"implicit": true,
"declAttributes": [
Expand All @@ -397,7 +397,7 @@
}
],
"declKind": "Var",
"usr": "s:4cake2C1C4Ins2ACXovp",
"usr": "s:4cake2C1C4Ins2ACvp",
"moduleName": "cake",
"declAttributes": [
"HasInitialValue",
Expand Down