Skip to content

Commit 3135b5d

Browse files
Merge pull request swiftlang#34994 from nate-chandler/rdar72053639
[IRGen] Use specialized mangled name for class constants.
2 parents 1687855 + e34a998 commit 3135b5d

File tree

21 files changed

+57
-21
lines changed

21 files changed

+57
-21
lines changed

lib/IRGen/GenClass.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,6 +2076,15 @@ namespace {
20762076
/// Get the name of the class or protocol to mangle into the ObjC symbol
20772077
/// name.
20782078
StringRef getEntityName(llvm::SmallVectorImpl<char> &buffer) const {
2079+
if (auto prespecialization = getSpecializedGenericType()) {
2080+
buffer.clear();
2081+
llvm::raw_svector_ostream os(buffer);
2082+
os << LinkEntity::forTypeMetadata(*prespecialization,
2083+
TypeMetadataAddress::FullMetadata)
2084+
.mangleAsString();
2085+
return os.str();
2086+
}
2087+
20792088
if (auto theClass = getClass()) {
20802089
return theClass->getObjCRuntimeName(buffer);
20812090
}

test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_distinct_generic_class.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
// CHECK-apple-SAME: }*,
7070
// CHECK-apple-SAME: i8*,
7171
// CHECK-apple-SAME: i8*
72-
// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_2:[0-9A-Z_]+]]5Value to [[INT]]
72+
// CHECK-apple-SAME: }* @"_DATA_$s4main5Value[[UNIQUE_ID_1]]LLCyAA9Argument1ACLLCySiGAA9Argument2ACLLCySSGGMf" to [[INT]]
7373
// CHECK-apple-SAME: ),
7474
// CHECK-apple-SAME: [[INT]] 2
7575
// CHECK-apple-SAME: ),

test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_different_value.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
// CHECK-apple-SAME: }*,
6868
// CHECK-apple-SAME: i8*,
6969
// CHECK-apple-SAME: i8*
70-
// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_2:[0-9A-Z_]+]]5Value to [[INT]]
70+
// CHECK-apple-SAME: }* @"_DATA_$s4main5Value[[UNIQUE_ID_1]]LLCyAA9Argument1ACLLCySiGAFySSGGMf" to [[INT]]
7171
// CHECK-apple-SAME: ),
7272
// CHECK-apple-SAME: [[INT]] 2
7373
// CHECK-apple-SAME: ),

test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_same_value.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
// CHECK-apple-SAME: }*,
6868
// CHECK-apple-SAME: i8*,
6969
// CHECK-apple-SAME: i8*
70-
// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_2:[0-9A-Z_]+]]5Value to [[INT]]
70+
// CHECK-apple-SAME: }* @"_DATA_$s4main5Value[[UNIQUE_ID_1]]LLCyAA9Argument1ACLLCySiGAGGMf" to [[INT]]
7171
// CHECK-apple-SAME: ),
7272
// CHECK-apple-SAME: [[INT]] 2
7373
// CHECK-apple-SAME: ),

test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_con_double.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
// CHECK-apple-SAME: }*,
127127
// CHECK-apple-SAME: i8*,
128128
// CHECK-apple-SAME: i8*
129-
// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_2:[0-9A-Za-z_]+]]5Value to [[INT]]
129+
// CHECK-apple-SAME: }* @"_DATA_$s4main5Value[[UNIQUE_ID_1]]CySSGMf" to [[INT]]
130130
// CHECK-apple-SAME: ),
131131
// CHECK-apple-SAME: [[INT]] 2
132132
// CHECK-apple-SAME: ),

test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_subclass_arg.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
// CHECK-apple-SAME: }*,
119119
// CHECK-apple-SAME: i8*,
120120
// CHECK-apple-SAME: i8*
121-
// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_2:[0-9A-Za-z_]+]]5Value to [[INT]]
121+
// CHECK-apple-SAME: }* @"_DATA_$s4main5Value[[UNIQUE_ID_1]]CySSGMf" to [[INT]]
122122
// CHECK-apple-SAME: ),
123123
// CHECK-apple-SAME: [[INT]] 2
124124
// CHECK-apple-SAME: ),

test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subclass_arg-2nd_anc_gen-1st-arg_con_int.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
// CHECK-apple-SAME: }*,
123123
// CHECK-apple-SAME: i8*,
124124
// CHECK-apple-SAME: i8*
125-
// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_1]]5Value to [[INT]]
125+
// CHECK-apple-SAME: }* @"_DATA_$s4main5Value[[UNIQUE_ID_1]]LLCySSGMf" to [[INT]]
126126
// CHECK-apple-SAME: ),
127127
// CHECK-apple-SAME: [[INT]] 2
128128
// CHECK-apple-SAME: ),

test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subcls_arg-2nd_anc_gen-1st-arg_subcls_arg.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
// CHECK-apple-SAME: }*,
115115
// CHECK-apple-SAME: i8*,
116116
// CHECK-apple-SAME: i8*
117-
// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_1]]5Value to [[INT]]
117+
// CHECK-apple-SAME: }* @"_DATA_$s4main5Value[[UNIQUE_ID_1]]LLCySiGMf" to [[INT]]
118118
// CHECK-apple-SAME: ),
119119
// CHECK-apple-SAME: [[INT]] 2
120120
// CHECK-apple-SAME: ),

test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_constant_int.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
// CHECK-apple-SAME: }*,
113113
// CHECK-apple-SAME: i8*,
114114
// CHECK-apple-SAME: i8*
115-
// CHECK-apple-SAME: }* @_DATA__TtC4mainP33_4D007063F2EFC1988130B7D42A21EE4C5Value to [[INT]]
115+
// CHECK-apple-SAME: }* @"_DATA_$s4main5Value[[UNIQUE_ID_1]]CySSGMf" to [[INT]]
116116
// CHECK-apple-SAME: ),
117117
// CHECK-apple-SAME: [[INT]] 2
118118
// CHECK-apple-SAME: ),

test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_subclass_argument.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
// : }*,
5757
// : i8*,
5858
// : i8*
59-
// : }* @_DATA__TtC4mainP33_496329636AC05466637A72F247DC6ABC9Ancestor1 to i64
59+
// : }* @"_DATA_$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMf to i64
6060
// : ),
6161
// : i64 2
6262
// : ),
@@ -184,7 +184,7 @@
184184
// CHECK-apple-SAME: }*,
185185
// CHECK-apple-SAME: i8*,
186186
// CHECK-apple-SAME: i8*
187-
// CHECK-apple-SAME: }* @_DATA__TtC4mainP33_496329636AC05466637A72F247DC6ABC5Value to [[INT]]
187+
// CHECK-apple-SAME: }* @"_DATA_$s4main5Value[[UNIQUE_ID_1]]CySiGMf" to [[INT]]
188188
// CHECK-apple-SAME: ),
189189
// CHECK-apple-SAME: [[INT]] 2
190190
// CHECK-apple-SAME: ),

0 commit comments

Comments
 (0)