|
9 | 9 |
|
10 | 10 | @_weakLinked import has_symbol_helper
|
11 | 11 |
|
12 |
| -func testGlobalFunctions() { |
| 12 | +public func testGlobalFunctions() { |
| 13 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper8function4withySi_tFTwS"() |
13 | 14 | if #_hasSymbol(function(with:)) {}
|
14 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper8function4withySi_tFTwS"() |
15 |
| - // CHECK: ret i1 icmp ne (void ({{i32|i64}})* @"$s17has_symbol_helper8function4withySi_tF", void (i64)* null) |
16 | 15 |
|
| 16 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper12throwingFuncyyKFTwS"() |
17 | 17 | if #_hasSymbol(throwingFunc) {}
|
18 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper12throwingFuncyyKFTwS"() |
19 |
| - // CHECK: ret i1 icmp ne (void (%swift.refcounted*, %swift.error**)* @"$s17has_symbol_helper12throwingFuncyyKF", void (%swift.refcounted*, %swift.error**)* null) |
20 | 18 |
|
| 19 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper11genericFuncyyxAA1PRzlFTwS"() |
21 | 20 | if #_hasSymbol(genericFunc(_:) as (S) -> Void) {}
|
22 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper11genericFuncyyxAA1PRzlFTwS"() |
23 |
| - // CHECK: ret i1 icmp ne (void (%swift.opaque*, %swift.type*, i8**)* @"$s17has_symbol_helper11genericFuncyyxAA1PRzlF", void (%swift.opaque*, %swift.type*, i8**)* null) |
24 | 21 |
|
| 22 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper20funcWithOpaqueResultQryFTwS"() |
25 | 23 | if #_hasSymbol(funcWithOpaqueResult) {}
|
26 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper20funcWithOpaqueResultQryFTwS"() |
27 |
| - // CHECK: ret i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper20funcWithOpaqueResultQryFQOMQ", %swift.type_descriptor* null), i1 icmp ne (void (%swift.opaque*)* @"$s17has_symbol_helper20funcWithOpaqueResultQryF", void (%swift.opaque*)* null)) |
28 | 24 |
|
| 25 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper9cdeclFuncyyFTwS"() |
29 | 26 | if #_hasSymbol(cdeclFunc) {}
|
30 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper9cdeclFuncyyFTwS"() |
31 |
| - // CHECK: ret i1 and (i1 icmp ne (void ()* @"$s17has_symbol_helper9cdeclFuncyyF", void ()* null), i1 icmp ne (void ()* @cdecl_func, void ()* null)) |
32 | 27 |
|
| 28 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper19forwardDeclaredFuncyyFTwS"() |
33 | 29 | if #_hasSymbol(forwardDeclaredFunc) {}
|
34 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper19forwardDeclaredFuncyyFTwS"() |
35 |
| - // CHECK: ret i1 icmp ne (void ()* @forward_declared_func, void ()* null) |
36 |
| - |
| 30 | + |
37 | 31 | // FIXME: Test `dynamic` functions
|
38 | 32 | // FIXME: Test `dynamic` functions with opaque return types
|
39 | 33 | }
|
40 | 34 |
|
41 |
| -func testVars() { |
| 35 | +// --- function(with:) --- |
| 36 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper8function4withySi_tFTwS"() |
| 37 | +// CHECK: ret i1 icmp ne (void ({{i32|i64}})* @"$s17has_symbol_helper8function4withySi_tF", void (i64)* null) |
| 38 | + |
| 39 | +// --- throwingFunc() --- |
| 40 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper12throwingFuncyyKFTwS"() |
| 41 | +// CHECK: ret i1 icmp ne (void (%swift.refcounted*, %swift.error**)* @"$s17has_symbol_helper12throwingFuncyyKF", void (%swift.refcounted*, %swift.error**)* null) |
| 42 | + |
| 43 | +// --- genericFunc(_:) --- |
| 44 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper11genericFuncyyxAA1PRzlFTwS"() |
| 45 | +// CHECK: ret i1 icmp ne (void (%swift.opaque*, %swift.type*, i8**)* @"$s17has_symbol_helper11genericFuncyyxAA1PRzlF", void (%swift.opaque*, %swift.type*, i8**)* null) |
| 46 | + |
| 47 | +// --- funcWithOpaqueResult() --- |
| 48 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper20funcWithOpaqueResultQryFTwS"() |
| 49 | +// CHECK: ret i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper20funcWithOpaqueResultQryFQOMQ", %swift.type_descriptor* null), i1 icmp ne (void (%swift.opaque*)* @"$s17has_symbol_helper20funcWithOpaqueResultQryF", void (%swift.opaque*)* null)) |
| 50 | + |
| 51 | +// --- cdeclFunc() --- |
| 52 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper9cdeclFuncyyFTwS"() |
| 53 | +// CHECK: ret i1 and (i1 icmp ne (void ()* @"$s17has_symbol_helper9cdeclFuncyyF", void ()* null), i1 icmp ne (void ()* @cdecl_func, void ()* null)) |
| 54 | + |
| 55 | +// --- forwardDeclaredFunc() --- |
| 56 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper19forwardDeclaredFuncyyFTwS"() |
| 57 | +// CHECK: ret i1 icmp ne (void ()* @forward_declared_func, void ()* null) |
| 58 | + |
| 59 | +public func testVars() { |
| 60 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper6globalSivpTwS"() |
42 | 61 | if #_hasSymbol(global) {}
|
43 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper6globalSivpTwS"() |
44 |
| - // CHECK: ret i1 icmp ne (i64 ()* @"$s17has_symbol_helper6globalSivg", i64 ()* null) |
45 | 62 | }
|
46 | 63 |
|
47 |
| -func testClass(_ c: C) { |
| 64 | +// --- global --- |
| 65 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper6globalSivpTwS"() |
| 66 | +// CHECK: ret i1 icmp ne (i64 ()* @"$s17has_symbol_helper6globalSivg", i64 ()* null) |
| 67 | + |
| 68 | +public func testClass(_ c: C) { |
| 69 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1CCACycfcTwS"() |
48 | 70 | if #_hasSymbol(C.init) {}
|
49 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1CCACycfcTwS"() |
50 |
| - // CHECK: ret i1 and (i1 icmp ne (%T17has_symbol_helper1CC* (%T17has_symbol_helper1CC*)* @"$s17has_symbol_helper1CCACycfc", %T17has_symbol_helper1CC* (%T17has_symbol_helper1CC*)* null), i1 icmp ne (%T17has_symbol_helper1CC* (%swift.type*)* @"$s17has_symbol_helper1CCACycfC", %T17has_symbol_helper1CC* (%swift.type*)* null)) |
51 | 71 |
|
| 72 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1CC6method4withySi_tFTwS"() |
52 | 73 | if #_hasSymbol(c.method(with:)) {}
|
53 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1CC6method4withySi_tFTwS"() |
54 |
| - // CHECK: ret i1 and (i1 icmp ne (void (i64, %T17has_symbol_helper1CC*)* @"$s17has_symbol_helper1CC6method4withySi_tFTj", void (i64, %T17has_symbol_helper1CC*)* null), i1 icmp ne (%swift.method_descriptor* @"$s17has_symbol_helper1CC6method4withySi_tFTq", %swift.method_descriptor* null)) |
55 | 74 | }
|
56 | 75 |
|
57 |
| -func testStruct(_ s: S) { |
| 76 | +// --- C.init() --- |
| 77 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1CCACycfcTwS"() |
| 78 | +// CHECK: ret i1 and (i1 icmp ne (%T17has_symbol_helper1CC* (%T17has_symbol_helper1CC*)* @"$s17has_symbol_helper1CCACycfc", %T17has_symbol_helper1CC* (%T17has_symbol_helper1CC*)* null), i1 icmp ne (%T17has_symbol_helper1CC* (%swift.type*)* @"$s17has_symbol_helper1CCACycfC", %T17has_symbol_helper1CC* (%swift.type*)* null)) |
| 79 | + |
| 80 | +// --- C.method(with:) --- |
| 81 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1CC6method4withySi_tFTwS"() |
| 82 | +// CHECK: ret i1 and (i1 icmp ne (void (i64, %T17has_symbol_helper1CC*)* @"$s17has_symbol_helper1CC6method4withySi_tFTj", void (i64, %T17has_symbol_helper1CC*)* null), i1 icmp ne (%swift.method_descriptor* @"$s17has_symbol_helper1CC6method4withySi_tFTq", %swift.method_descriptor* null)) |
| 83 | + |
| 84 | +public func testStruct(_ s: S) { |
| 85 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1SV6memberSivpTwS"() |
58 | 86 | if #_hasSymbol(s.member) {}
|
59 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1SV6memberSivpTwS"() |
60 |
| - // CHECK: ret i1 and (i1 and (i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper1SV6memberSivpMV", %swift.type_descriptor* null), i1 icmp ne (i64 (%swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivg", i64 (%swift.opaque*)* null)), i1 icmp ne (void (i64, %swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivs", void (i64, %swift.opaque*)* null)), i1 icmp ne ({ i8*, %TSi* } (i8*, %swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivM", { i8*, %TSi* } (i8*, %swift.opaque*)* null)) |
61 | 87 |
|
| 88 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1SV6method4withySi_tFTwS"() |
62 | 89 | if #_hasSymbol(s.method(with:)) {}
|
63 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1SV6method4withySi_tFTwS"() |
64 |
| - // CHECK: ret i1 icmp ne (void (i64, %swift.opaque*)* @"$s17has_symbol_helper1SV6method4withySi_tF", void (i64, %swift.opaque*)* null) |
65 | 90 | }
|
66 | 91 |
|
67 |
| -func testEnum(_ e: E) { |
| 92 | +// --- S.member --- |
| 93 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1SV6memberSivpTwS"() |
| 94 | +// CHECK: ret i1 and (i1 and (i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper1SV6memberSivpMV", %swift.type_descriptor* null), i1 icmp ne (i64 (%swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivg", i64 (%swift.opaque*)* null)), i1 icmp ne (void (i64, %swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivs", void (i64, %swift.opaque*)* null)), i1 icmp ne ({ i8*, %TSi* } (i8*, %swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivM", { i8*, %TSi* } (i8*, %swift.opaque*)* null)) |
| 95 | + |
| 96 | +// --- S.method(with:) --- |
| 97 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1SV6method4withySi_tFTwS"() |
| 98 | +// CHECK: ret i1 icmp ne (void (i64, %swift.opaque*)* @"$s17has_symbol_helper1SV6method4withySi_tF", void (i64, %swift.opaque*)* null) |
| 99 | + |
| 100 | +public func testEnum(_ e: E) { |
| 101 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1EO9basicCaseyA2CmFTwS"() |
68 | 102 | if #_hasSymbol(E.basicCase) {}
|
69 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1EO9basicCaseyA2CmFTwS"() |
70 |
| - // CHECK: ret i1 icmp ne (i32* @"$s17has_symbol_helper1EO9basicCaseyA2CmFWC", i32* null) |
71 | 103 |
|
| 104 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFTwS"() |
72 | 105 | if #_hasSymbol(E.payloadCase) {}
|
73 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFTwS"() |
74 |
| - // CHECK: ret i1 icmp ne (i32* @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFWC", i32* null) |
75 | 106 | }
|
76 | 107 |
|
77 |
| -func testMetatypes() { |
| 108 | +// --- E.basicCase --- |
| 109 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1EO9basicCaseyA2CmFTwS"() |
| 110 | +// CHECK: ret i1 icmp ne (i32* @"$s17has_symbol_helper1EO9basicCaseyA2CmFWC", i32* null) |
| 111 | + |
| 112 | +// --- E.payloadCase(_:) --- |
| 113 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFTwS"() |
| 114 | +// CHECK: ret i1 icmp ne (i32* @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFWC", i32* null) |
| 115 | + |
| 116 | +public func testMetatypes() { |
| 117 | + // CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1SVTwS"() |
78 | 118 | if #_hasSymbol(S.self) {}
|
79 |
| - // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1SVTwS"() |
80 |
| - // CHECK: ret i1 and (i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper1SVMn", %swift.type_descriptor* null), i1 icmp ne (%swift.type* @"$s17has_symbol_helper1SVN", %swift.type* null)), i1 icmp ne (%swift.metadata_response (i64)* @"$s17has_symbol_helper1SVMa", %swift.metadata_response (i64)* null)) |
81 | 119 | }
|
| 120 | + |
| 121 | +// --- S.self --- |
| 122 | +// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1SVTwS"() |
| 123 | +// CHECK: ret i1 and (i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper1SVMn", %swift.type_descriptor* null), i1 icmp ne (%swift.type* @"$s17has_symbol_helper1SVN", %swift.type* null)), i1 icmp ne (%swift.metadata_response (i64)* @"$s17has_symbol_helper1SVMa", %swift.metadata_response (i64)* null)) |
0 commit comments