Skip to content

Commit 25bf99c

Browse files
committed
[NFC] Emit descriptive string constant names
Modify IRGen to emit “anonymous” string constants with names of the form `@.str.<len>.<contents>` (with a special mangling for internal `\0` characters). This makes it much easier to write IRGen tests that check for the contents of strings, because matching the constant name also implies that the constant has the expected content.
1 parent a3df5f3 commit 25bf99c

18 files changed

+178
-145
lines changed

docs/Testing.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,3 +601,36 @@ actually unblocks PR testing by running the smoke test build preset locally.
601601
To enable the lldb test allowlist, add `-G swiftpr` to the
602602
`LLDB_TEST_CATEGORIES` variable in `utils/build-script-impl`. Disable it by
603603
removing that option.
604+
605+
#### String constants in IR tests
606+
607+
IRGen often needs to create private constants containing the NUL-terminated
608+
contents of strings, such as for string literals in user code or names in type
609+
metadata. When it does, IRGen names them in a specific format: they will
610+
have the prefix `.str.`, followed by the size in bytes (excluding terminator),
611+
followed by a `.`, followed by the contents of the string (excluding
612+
terminator). For example:
613+
614+
```
615+
@.str.5.Hello ; A constant containing "Hello\0"
616+
@".str.11.Hello World" ; A constant containing "Hello World\0"
617+
@".str.7.Hello!\0A" ; A constant containing "Hello!\n\0"
618+
@".str.4.\F0\9F\8F\8E" ; A constant containing "🏎️\0"
619+
@.str.0. ; A constant containing "\0"
620+
```
621+
622+
When writing IRGen tests, you can assume that names in this format have the
623+
expected contents, so you don't need to capture the constant's name and then
624+
check that it's referred to correctly at the use site.
625+
626+
Note that this name format treats NUL characters (\00) specially. All string
627+
constants generated in this manner are NUL-terminated, so the terminator is not
628+
included in the count *or* the content. To work around LLVM IR limitations, NUL
629+
characters elsewhere in the content are replaced with `_` and a `.nul<index>`
630+
suffix is appended to the name, in order from lowest to highest index:
631+
632+
```
633+
@.str.1._.nul0 ; A constant containing "\0\0"
634+
@.str.2.__.nul0.nul1 ; A constant containing "\0\0\0"
635+
@".str.6.nul: _.nul5" ; A constant containing "nul: \0\0"
636+
```

lib/IRGen/GenDecl.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5451,9 +5451,20 @@ llvm::Constant *IRGenModule::getAddrOfGlobalString(StringRef data,
54515451
return entry.second;
54525452
}
54535453

5454+
SmallString<64> name;
5455+
(llvm::Twine(".str.") + llvm::Twine(data.size()) + "." + data).toVector(name);
5456+
5457+
// \0 is not allowed in variable names. Rewrite any \0s into _s and append
5458+
// information about their original locations so the name remains unique.
5459+
for (size_t i = name.find('\0');
5460+
i != StringRef::npos;
5461+
i = name.find('\0', i)) {
5462+
name[i] = '_';
5463+
(llvm::Twine(".nul") + llvm::Twine(i)).toVector(name);
5464+
}
5465+
54545466
entry = createStringConstant(data, willBeRelativelyAddressed,
5455-
/*sectionName*/ "",
5456-
".str" /* match how Clang creates strings */);
5467+
/*sectionName*/ "", name);
54575468
return entry.second;
54585469
}
54595470

test/IRGen/anonymous_context_descriptors.sil

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
2-
// RUN: %target-swift-frontend -emit-ir -enable-anonymous-context-mangled-names %s | %FileCheck %s -check-prefix CHECK-MANGLED
1+
// RUN: %target-swift-frontend -emit-ir %s > %t.ir
2+
// %FileCheck --input-file %t.ir %s
3+
// RUN: %target-swift-frontend -emit-ir -enable-anonymous-context-mangled-names %s > %t.anon.ir
4+
// RUN: %FileCheck --input-file %t.anon.ir %s -check-prefix CHECK-MANGLED
35

46
import Builtin
57
import Swift
@@ -12,7 +14,7 @@ class Blah<T: P> {
1214

1315
// Mangled name of the anonymous descriptor
1416
// CHECK-NOT: private constant [84 x i8] c"$s29anonymous_context_descriptors4BlahC5Inner33_4F495173994818481DD703D65EB08308LLV\00"
15-
// CHECK-MANGLED: [[INNER_MANGLED:@.str.[0-9]+]] = private constant [84 x i8] c"$s29anonymous_context_descriptors4BlahC5Inner33_4F495173994818481DD703D65EB08308LLV\00"
17+
// CHECK-MANGLED: @".str.83.$s29anonymous_context_descriptors4BlahC5Inner33_4F495173994818481DD703D65EB08308LLV" = private constant [84 x i8] c"$s29anonymous_context_descriptors4BlahC5Inner33_4F495173994818481DD703D65EB08308LLV\00"
1618

1719
// Anonymous descriptor
1820
// CHECK: @"$s29anonymous_context_descriptors4BlahC5Inner33{{.*}}MXX" =
@@ -36,4 +38,4 @@ class Blah<T: P> {
3638
// CHECK-MANGLED-SAME: i16 4, i16 0
3739

3840
// # mangled name
39-
// CHECK-MANGLED-SAME: [[INNER_MANGLED]]
41+
// CHECK-MANGLED-SAME: @".str.83.$s29anonymous_context_descriptors4BlahC5Inner33_4F495173994818481DD703D65EB08308LLV"

test/IRGen/builtins_objc.swift

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-swift-frontend -parse-stdlib -primary-file %s -emit-ir | %FileCheck %s
1+
// RUN: %target-swift-frontend -parse-stdlib -primary-file %s -emit-ir > %t.ir
2+
// RUN: %FileCheck %s --input-file=%t.ir
23

34
// REQUIRES: executable_test
45
// REQUIRES: objc_interop
@@ -7,9 +8,6 @@ import Swift
78
import Foundation
89
import CoreGraphics
910

10-
// CHECK: [[INT32:@.str.[0-9]+]] = {{.*}} c"i\00"
11-
// CHECK: [[OBJECT:@.str.[0-9]+]] = {{.*}} c"@\00"
12-
1311
@objc enum ObjCEnum: Int32 { case X }
1412
@objc class ObjCClass: NSObject {}
1513
class NonObjCClass {}
@@ -18,21 +16,21 @@ class NonObjCClass {}
1816
func use(_: Builtin.RawPointer)
1917

2018
func getObjCTypeEncoding<T>(_: T) {
21-
// CHECK: call swiftcc void @use({{.* i8]\*}} [[INT32]],
19+
// CHECK: call swiftcc void @use({{.* i8]\*}} @.str.1.i,
2220
use(Builtin.getObjCTypeEncoding(Int32.self))
23-
// CHECK: call swiftcc void @use({{.* i8]\*}} [[INT32]]
21+
// CHECK: call swiftcc void @use({{.* i8]\*}} @.str.1.i
2422
use(Builtin.getObjCTypeEncoding(ObjCEnum.self))
25-
// CHECK: call swiftcc void @use({{.* i8]\*}} [[CGRECT:@.str.[0-9]+]],
23+
// CHECK: call swiftcc void @use({{.* i8]\*}} [[CGRECT:@".str.[0-9]+.\{CGRect=[^"]*"]],
2624
use(Builtin.getObjCTypeEncoding(CGRect.self))
27-
// CHECK: call swiftcc void @use({{.* i8]\*}} [[NSRANGE:@.str.[0-9]+]],
25+
// CHECK: call swiftcc void @use({{.* i8]\*}} [[NSRANGE:@".str.[0-9]+.\{_NSRange=[^"]*"]],
2826
use(Builtin.getObjCTypeEncoding(NSRange.self))
29-
// CHECK: call swiftcc void @use({{.* i8]\*}} [[OBJECT]]
27+
// CHECK: call swiftcc void @use({{.* i8]\*}} @".str.1.@"
3028
use(Builtin.getObjCTypeEncoding(AnyObject.self))
31-
// CHECK: call swiftcc void @use({{.* i8]\*}} [[OBJECT]]
29+
// CHECK: call swiftcc void @use({{.* i8]\*}} @".str.1.@"
3230
use(Builtin.getObjCTypeEncoding(NSObject.self))
33-
// CHECK: call swiftcc void @use({{.* i8]\*}} [[OBJECT]]
31+
// CHECK: call swiftcc void @use({{.* i8]\*}} @".str.1.@"
3432
use(Builtin.getObjCTypeEncoding(ObjCClass.self))
35-
// CHECK: call swiftcc void @use({{.* i8]\*}} [[OBJECT]]
33+
// CHECK: call swiftcc void @use({{.* i8]\*}} @".str.1.@"
3634
use(Builtin.getObjCTypeEncoding(NonObjCClass.self))
3735
}
3836

test/IRGen/closure.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
// REQUIRES: PTRSIZE=64
66

7-
// CHECK-DAG: [[FILENAME:@.str]] = {{.*}} c"{{.*}}closure.swift\00"
8-
// OPT: [[FILENAME:@.str]] = {{.*}} [1 x i8] zeroinitializer
7+
// CHECK-DAG: [[FILENAME:@"\.str\..*closure\.swift"]] = {{.*}} c"{{.*}}closure.swift\00"
8+
// OPT: [[FILENAME:@\.str\.0\.]] = {{.*}} [1 x i8] zeroinitializer
99

1010
// -- partial_apply context metadata
1111

test/IRGen/expressions.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55
import Swift
66

77

8-
// CHECK: private unnamed_addr constant [22 x i8] c"this is just a\0A\0A test\00"
9-
108
// CHECK: define hidden [[stringLayout:[^@]*]] @"$s11expressions17TestStringLiteralSSyF"() {{.*}} {
11-
// CHECK: call [[stringLayout]] @{{.*}}_builtinStringLiteral{{.*}}(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64 21, i1 true)
9+
// CHECK: call [[stringLayout]] @{{.*}}_builtinStringLiteral{{.*}}(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @".str.21.this is just a\0A\0A test", i64 0, i64 0), i64 21, i1 true)
1210

1311
func TestStringLiteral() -> String {
1412
return "this is just a\n\u{0a} test"
1513
}
1614

1715
// CHECK: define hidden [[stringLayout]] @"$s11expressions18TestStringLiteral2SSyF"() {{.*}} {
18-
// CHECK: call [[stringLayout]] @{{.*}}_builtinStringLiteral{{.*}}(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 19, i1 false)
16+
// CHECK: call [[stringLayout]] @{{.*}}_builtinStringLiteral{{.*}}(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @".str.19.non-ASCII string \C2\B5", i64 0, i64 0), i64 19, i1 false)
1917
func TestStringLiteral2() -> String {
2018
return "non-ASCII string \u{00B5}"
2119
}

test/IRGen/objc_attr_NSManaged.sil

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ sil_vtable X {}
1919
// The getter/setter should not show up in the Objective-C metadata.
2020
// CHECK: @_INSTANCE_METHODS__TtC19objc_attr_NSManaged10SwiftGizmo = internal constant { i32, i32, [2 x { i8*, i8*, i8* }] } { i32 24, i32 2, {{.*}} @"\01L_selector_data(initWithBellsOn:)", {{.*}} @"\01L_selector_data(init)",
2121

22-
// CHECK: [[X:@.str.[0-9]+]] = private unnamed_addr constant [2 x i8] c"x\00"
23-
2422
// The property 'x' should show up in the Objective-C metadata.
25-
// CHECK: @_PROPERTIES__TtC19objc_attr_NSManaged10SwiftGizmo = internal constant { {{.*}}i32, i32, [1 x { i8*, i8* }] } { i32 16, i32 1, [1 x { i8*, i8* }] [{ i8*, i8* } { i8* getelementptr inbounds ([2 x i8], [2 x i8]* [[X]], i64 0, i64 0),
23+
// CHECK: @_PROPERTIES__TtC19objc_attr_NSManaged10SwiftGizmo = internal constant { {{.*}}i32, i32, [1 x { i8*, i8* }] } { i32 16, i32 1, [1 x { i8*, i8* }] [{ i8*, i8* } { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1.x, i64 0, i64 0),
2624

2725
// The getter/setter should not show up in the Swift metadata.
2826
// CHECK: @"$s19objc_attr_NSManaged10SwiftGizmoCMf" = internal global <{ {{.*}} }> <{ void (%T19objc_attr_NSManaged10SwiftGizmoC*)* {{.*}}@"$s19objc_attr_NSManaged10SwiftGizmoCfD{{(\.ptrauth)?}}"{{.*}}, i8**{{.*}} @"$sBOWV{{(.ptrauth)?(.)?[0-9]?}}"{{.*}}, {{.*}} @"OBJC_METACLASS_$__TtC19objc_attr_NSManaged10SwiftGizmo{{(.ptrauth)?}}"{{.*}}, %objc_class*{{.*}} @"OBJC_CLASS_$_Gizmo{{(.ptrauth)?}}"{{.*}}, %swift.opaque* @_objc_empty_cache, %swift.opaque* null,{{.*}}@_DATA__TtC19objc_attr_NSManaged10SwiftGizmo{{.*}}i64 {{1|2}}){{.*}}, i32 {{1|0}}, i32 0, i32 8, i16 7, i16 0, i32 96, i32 16, {{.*}}* @"$s19objc_attr_NSManaged10SwiftGizmoCMn{{(\.ptrauth)?}}"{{.*}}, i8* null }>

test/IRGen/objc_bridge.swift

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,101 +7,97 @@
77

88
import Foundation
99

10-
// CHECK: [[GETTER_SIGNATURE:@.*]] = private unnamed_addr constant [8 x i8] c"@16@0:8\00"
11-
// CHECK: [[SETTER_SIGNATURE:@.*]] = private unnamed_addr constant [11 x i8] c"v24@0:8@16\00"
12-
// CHECK: [[DEALLOC_SIGNATURE:@.*]] = private unnamed_addr constant [8 x i8] c"v16@0:8\00"
13-
1410
// CHECK: @_INSTANCE_METHODS__TtC11objc_bridge3Bas = internal constant { i32, i32, [17 x { i8*, i8*, i8* }] } {
1511
// CHECK: i32 24,
1612
// CHECK: i32 17,
1713
// CHECK: [17 x { i8*, i8*, i8* }] [
1814
// CHECK: { i8*, i8*, i8* } {
1915
// CHECK: i8* getelementptr inbounds ([12 x i8], [12 x i8]* @"\01L_selector_data(strRealProp)", i64 0, i64 0),
20-
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[GETTER_SIGNATURE]], i64 0, i64 0),
16+
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @".str.7.@16@0:8", i64 0, i64 0),
2117
// CHECK-noptrauth: i8* bitcast ([[OPAQUE:.*]]* ([[OPAQUE:.*]]*, i8*)* @"$s11objc_bridge3BasC11strRealPropSSvgTo" to i8*)
2218
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC11strRealPropSSvgTo.ptrauth" to i8*)
2319
// CHECK: },
2420
// CHECK: { i8*, i8*, i8* } {
2521
// CHECK: i8* getelementptr inbounds ([16 x i8], [16 x i8]* @"\01L_selector_data(setStrRealProp:)", i64 0, i64 0),
26-
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* [[SETTER_SIGNATURE]], i64 0, i64 0),
22+
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @".str.10.v24@0:8@16", i64 0, i64 0),
2723
// CHECK-noptrauth: i8* bitcast (void ([[OPAQUE:.*]]*, i8*, [[OPAQUE:.*]]*)* @"$s11objc_bridge3BasC11strRealPropSSvsTo" to i8*)
2824
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC11strRealPropSSvsTo.ptrauth" to i8*)
2925
// CHECK: },
3026
// CHECK: { i8*, i8*, i8* } {
3127
// CHECK: i8* getelementptr inbounds ([12 x i8], [12 x i8]* @"\01L_selector_data(strFakeProp)", i64 0, i64 0),
32-
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[GETTER_SIGNATURE]], i64 0, i64 0),
28+
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @".str.7.@16@0:8", i64 0, i64 0),
3329
// CHECK-noptrauth: i8* bitcast ([[OPAQUE:.*]]* ([[OPAQUE:.*]]*, i8*)* @"$s11objc_bridge3BasC11strFakePropSSvgTo" to i8*)
3430
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC11strFakePropSSvgTo.ptrauth" to i8*)
3531
// CHECK: },
3632
// CHECK: { i8*, i8*, i8* } {
3733
// CHECK: i8* getelementptr inbounds ([16 x i8], [16 x i8]* @"\01L_selector_data(setStrFakeProp:)", i64 0, i64 0),
38-
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* [[SETTER_SIGNATURE]], i64 0, i64 0),
34+
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @".str.10.v24@0:8@16", i64 0, i64 0),
3935
// CHECK-noptrauth: i8* bitcast (void ([[OPAQUE:.*]]*, i8*, [[OPAQUE:.*]]*)* @"$s11objc_bridge3BasC11strFakePropSSvsTo" to i8*)
4036
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC11strFakePropSSvsTo.ptrauth" to i8*)
4137
// CHECK: },
4238
// CHECK: { i8*, i8*, i8* } {
4339
// CHECK: i8* getelementptr inbounds ([14 x i8], [14 x i8]* @"\01L_selector_data(nsstrRealProp)", i64 0, i64 0),
44-
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[GETTER_SIGNATURE]], i64 0, i64 0),
40+
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @".str.7.@16@0:8", i64 0, i64 0),
4541
// CHECK-noptrauth: i8* bitcast ([[OPAQUE:.*]]* ([[OPAQUE:.*]]*, i8*)* @"$s11objc_bridge3BasC13nsstrRealPropSo8NSStringCvgTo" to i8*)
4642
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC13nsstrRealPropSo8NSStringCvgTo.ptrauth" to i8*)
4743
// CHECK: },
4844
// CHECK: { i8*, i8*, i8* } {
4945
// CHECK: i8* getelementptr inbounds ([18 x i8], [18 x i8]* @"\01L_selector_data(setNsstrRealProp:)", i64 0, i64 0),
50-
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* [[SETTER_SIGNATURE]], i64 0, i64 0),
46+
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @".str.10.v24@0:8@16", i64 0, i64 0),
5147
// CHECK-noptrauth: i8* bitcast (void ([[OPAQUE:.*]]*, i8*, [[OPAQUE:.*]]*)* @"$s11objc_bridge3BasC13nsstrRealPropSo8NSStringCvsTo" to i8*)
5248
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC13nsstrRealPropSo8NSStringCvsTo.ptrauth" to i8*)
5349
// CHECK: },
5450
// CHECK: { i8*, i8*, i8* } {
5551
// CHECK: i8* getelementptr inbounds ([14 x i8], [14 x i8]* @"\01L_selector_data(nsstrFakeProp)", i64 0, i64 0),
56-
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[GETTER_SIGNATURE]], i64 0, i64 0),
52+
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @".str.7.@16@0:8", i64 0, i64 0),
5753
// CHECK-noptrauth: i8* bitcast ([[OPAQUE:.*]]* ([[OPAQUE:.*]]*, i8*)* @"$s11objc_bridge3BasC13nsstrFakePropSo8NSStringCvgTo" to i8*)
5854
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC13nsstrFakePropSo8NSStringCvgTo.ptrauth" to i8*)
5955
// CHECK: },
6056
// CHECK: { i8*, i8*, i8* } {
6157
// CHECK: i8* getelementptr inbounds ([18 x i8], [18 x i8]* @"\01L_selector_data(setNsstrFakeProp:)", i64 0, i64 0),
62-
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* [[SETTER_SIGNATURE]], i64 0, i64 0),
58+
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @".str.10.v24@0:8@16", i64 0, i64 0),
6359
// CHECK-noptrauth: i8* bitcast (void ([[OPAQUE:.*]]*, i8*, [[OPAQUE:.*]]*)* @"$s11objc_bridge3BasC13nsstrFakePropSo8NSStringCvsTo" to i8*)
6460
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC13nsstrFakePropSo8NSStringCvsTo.ptrauth" to i8*)
6561
// CHECK: },
6662
// CHECK: { i8*, i8*, i8* } {
6763
// CHECK: i8* getelementptr inbounds ([10 x i8], [10 x i8]* @"\01L_selector_data(strResult)", i64 0, i64 0),
68-
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[GETTER_SIGNATURE]], i64 0, i64 0),
64+
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @".str.7.@16@0:8", i64 0, i64 0),
6965
// CHECK-noptrauth: i8* bitcast ([[OPAQUE:.*]]* ([[OPAQUE:.*]]*, i8*)* @"$s11objc_bridge3BasC9strResultSSyFTo" to i8*)
7066
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC9strResultSSyFTo.ptrauth" to i8*)
7167
// CHECK: },
7268
// CHECK: { i8*, i8*, i8* } {
7369
// CHECK: i8* getelementptr inbounds ([{{[0-9]*}} x i8], [{{[0-9]*}} x i8]* @"\01L_selector_data(strArgWithS:)", i64 0, i64 0),
74-
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* [[SETTER_SIGNATURE]], i64 0, i64 0),
70+
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @".str.10.v24@0:8@16", i64 0, i64 0),
7571
// CHECK-noptrauth: i8* bitcast (void ([[OPAQUE:.*]]*, i8*, [[OPAQUE:.*]]*)* @"$s11objc_bridge3BasC6strArg1sySS_tFTo" to i8*)
7672
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC6strArg1sySS_tFTo.ptrauth" to i8*)
7773
// CHECK: },
7874
// CHECK: { i8*, i8*, i8* } {
7975
// CHECK: i8* getelementptr inbounds ([12 x i8], [12 x i8]* @"\01L_selector_data(nsstrResult)", i64 0, i64 0),
80-
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[GETTER_SIGNATURE]], i64 0, i64 0),
76+
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @".str.7.@16@0:8", i64 0, i64 0),
8177
// CHECK-noptrauth: i8* bitcast ([[OPAQUE:.*]]* ([[OPAQUE:.*]]*, i8*)* @"$s11objc_bridge3BasC11nsstrResultSo8NSStringCyFTo" to i8*)
8278
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC11nsstrResultSo8NSStringCyFTo.ptrauth" to i8*)
8379
// CHECK: },
8480
// CHECK: { i8*, i8*, i8* } {
8581
// CHECK: i8* getelementptr inbounds ([{{[0-9]+}} x i8], [{{[0-9]+}} x i8]* @"\01L_selector_data(nsstrArgWithS:)", i64 0, i64 0),
86-
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* [[SETTER_SIGNATURE]], i64 0, i64 0),
82+
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @".str.10.v24@0:8@16", i64 0, i64 0),
8783
// CHECK-noptrauth: i8* bitcast (void ([[OPAQUE:.*]]*, i8*, [[OPAQUE:.*]]*)* @"$s11objc_bridge3BasC8nsstrArg1sySo8NSStringC_tFTo" to i8*)
8884
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC8nsstrArg1sySo8NSStringC_tFTo.ptrauth" to i8*)
8985
// CHECK: },
9086
// CHECK: { i8*, i8*, i8* } {
9187
// CHECK: i8* getelementptr inbounds ([5 x i8], [5 x i8]* @"\01L_selector_data(init)", i64 0, i64 0),
92-
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[GETTER_SIGNATURE]], i64 0, i64 0),
88+
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @".str.7.@16@0:8", i64 0, i64 0),
9389
// CHECK-noptrauth: i8* bitcast ([[OPAQUE:.*]]* ([[OPAQUE:.*]]*, i8*)* @"$s11objc_bridge3BasCACycfcTo" to i8*)
9490
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasCACycfcTo.ptrauth" to i8*)
9591
// CHECK: },
9692
// CHECK: { i8*, i8*, i8* } {
9793
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @"\01L_selector_data(dealloc)", i64 0, i64 0),
98-
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[DEALLOC_SIGNATURE]], i64 0, i64 0),
94+
// CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @".str.7.v16@0:8", i64 0, i64 0),
9995
// CHECK-noptrauth: i8* bitcast (void ([[OPAQUE:.*]]*, i8*)* @"$s11objc_bridge3BasCfDTo" to i8*)
10096
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasCfDTo.ptrauth" to i8*)
10197
// CHECK: },
10298
// CHECK: { i8*, i8*, i8* } {
10399
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @"\01L_selector_data(acceptSet:)", i64 0, i64 0),
104-
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.{{[0-9]+}}, i64 0, i64 0),
100+
// CHECK: i8* getelementptr inbounds ([11 x i8], [11 x i8]* @".str.10.v24@0:8@16", i64 0, i64 0),
105101
// CHECK-noptrauth: i8* bitcast (void (%3*, i8*, %4*)* @"$s11objc_bridge3BasC9acceptSetyyShyACGFTo" to i8*)
106102
// CHECK-ptrauth: i8* bitcast ({ i8*, i32, i64, i64 }* @"$s11objc_bridge3BasC9acceptSetyyShyACGFTo.ptrauth" to i8*)
107103
// CHECK: }

test/IRGen/objc_bridged_generic_conformance.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
// CHECK-NOT: _TMnCSo
44

5-
// CHECK: @"$sSo6ThingyCyxG32objc_bridged_generic_conformance1PADMc" = hidden constant %swift.protocol_conformance_descriptor {{.*}} @.str
6-
7-
// CHECK: @.str = private constant [7 x i8] c"Thingy\00"
5+
// CHECK: @"$sSo6ThingyCyxG32objc_bridged_generic_conformance1PADMc" = hidden constant %swift.protocol_conformance_descriptor {{.*}} @.str.6.Thingy
86

97
// CHECK-NOT: _TMnCSo
108

0 commit comments

Comments
 (0)