Skip to content

Commit 545a106

Browse files
authored
Support for x86_64 watchOS simulator
* Start testing watchOS simulator x86_64 and i386 by default Users will require to install watchOS 6.2 or older simulator to support i386. 1. Install watchOS 6.2 or older simulator (Xcode -> Preferences -> Components -> Simulators). 2. Create a 32-bit watchOS device. 3. Run: `xcrun simctl create 'Apple Watch Series 2 - 42mm' com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-42mm com.apple.CoreSimulator.SimRuntime.watchOS-6-2` (cherry picked from commit b5a01ba) * Update IRGen abitypes test to support watchOS simulator x86_64 (cherry picked from commit 2f6139c)
1 parent ecc8b4c commit 545a106

16 files changed

+109
-6
lines changed

cmake/modules/DarwinSDKs.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ endif()
1313
set(SUPPORTED_TVOS_ARCHS "arm64")
1414
set(SUPPORTED_TVOS_SIMULATOR_ARCHS "x86_64;arm64")
1515
set(SUPPORTED_WATCHOS_ARCHS "armv7k")
16-
set(SUPPORTED_WATCHOS_SIMULATOR_ARCHS "i386;arm64")
16+
set(SUPPORTED_WATCHOS_SIMULATOR_ARCHS "i386;x86_64;arm64")
1717
set(SUPPORTED_OSX_ARCHS "x86_64;arm64;arm64e")
1818

1919
is_sdk_requested(OSX swift_build_osx)

lib/AST/Availability.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ AvailabilityContext ASTContext::getSwift50Availability() {
259259
return AvailabilityContext(
260260
VersionRange::allGTE(llvm::VersionTuple(12,2)));
261261
} else if (target.isWatchOS()) {
262+
if (target.getArch() == llvm::Triple::ArchType::x86_64)
263+
return AvailabilityContext::alwaysAvailable();
264+
262265
return AvailabilityContext(
263266
VersionRange::allGTE(llvm::VersionTuple(5,2)));
264267
} else {

test/IRGen/abitypes.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class Foo {
4040
// i386-watchos: define hidden void @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}FTo"(%TSo6MyRectV* noalias nocapture sret({{.*}}) %0, i8* %1, i8* %2) {{[#0-9]*}} {
4141
// armv7k-watchos: define hidden swiftcc { float, float, float, float } @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}F"(%T8abitypes3FooC* swiftself %0) {{.*}} {
4242
// armv7k-watchos: define hidden [[ARMV7K_MYRECT]] @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}FTo"(i8* %0, i8* %1) {{[#0-9]*}} {
43+
// x86_64-watchos: define hidden swiftcc { float, float, float, float } @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}F"(%T8abitypes3FooC* swiftself %0) {{.*}} {
44+
// x86_64-watchos: define hidden { <2 x float>, <2 x float> } @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}FTo"(i8* %0, i8* %1) {{[#0-9]*}} {
4345
@objc dynamic func bar() -> MyRect {
4446
return MyRect(x: 1, y: 2, width: 3, height: 4)
4547
}

test/IRGen/class_update_callback_with_fixed_layout.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
// REQUIRES: objc_interop
1414
// REQUIRES: CPU=x86_64
15+
// UNSUPPORTED: swift_only_stable_abi
1516

1617
sil_stage canonical
1718

test/IRGen/metadata.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ enum Singleton {
1212
// Check that the instance start is after the header (at 8 or 16).
1313
// CHECK-macosx: _DATA__TtC1A1G = internal constant {{.*}} { i32 {{(128|129)}}, i32 {{(16|8|40)}}
1414
// CHECK-ios: _DATA__TtC1A1G = internal constant {{.*}} { i32 {{(128|129)}}, i32 {{(16|8|40)}}
15-
// CHECK-watchos: _DATA__TtC1A1G = internal constant {{.*}} { i32 128, i32 {{(16|8)}}
15+
// CHECK-watchos: _DATA__TtC1A1G = internal constant {{.*}} { i32 {{(128|129)}}, i32 {{(16|8|40)}}
1616
// CHECK-tvos: _DATA__TtC1A1G = internal constant {{.*}} { i32 128, i32 {{(16|8)}}
1717

1818
class G {

test/IRGen/objc_methods.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %build-irgen-test-overlays
3-
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-os %s
3+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-os-abi %s
44

55
// REQUIRES: CPU=x86_64
66
// REQUIRES: objc_interop
77

8+
// rdar://76863553
9+
// UNSUPPORTED: OS=watchos && CPU=x86_64
10+
811
import Foundation
912

1013
// Protocol methods require extended method type encodings to capture block
@@ -50,6 +53,7 @@ class ObjcDestructible: NSObject {
5053
// CHECK-macosx: [[FAIL_SIGNATURE:@.*]] = private unnamed_addr constant [12 x i8] c"c24@0:8^@16\00"
5154
// CHECK-ios: [[FAIL_SIGNATURE:@.*]] = private unnamed_addr constant [12 x i8] c"B24@0:8^@16\00"
5255
// CHECK-tvos: [[FAIL_SIGNATURE:@.*]] = private unnamed_addr constant [12 x i8] c"B24@0:8^@16\00"
56+
// CHECK-watchos: [[FAIL_SIGNATURE:@.*]] = private unnamed_addr constant [12 x i8] c"B24@0:8^@16\00"
5357
// CHECK: @_INSTANCE_METHODS__TtC12objc_methods3Foo = internal constant { {{.*}}] } {
5458
// CHECK: i32 24,
5559
// CHECK: i32 10,

test/IRGen/objc_type_encoding.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// REQUIRES: CPU=x86_64
66
// REQUIRES: objc_interop
77

8+
// rdar://76863553
9+
// UNSUPPORTED: OS=watchos && CPU=x86_64
10+
811
import ObjectiveC
912
import Foundation
1013
import gizmo
@@ -16,59 +19,70 @@ import gizmo
1619
// CHECK-macosx: private unnamed_addr constant [8 x i8] c"#16@0:8\00"
1720
// CHECK-ios: private unnamed_addr constant [8 x i8] c"#16@0:8\00"
1821
// CHECK-tvos: private unnamed_addr constant [8 x i8] c"#16@0:8\00"
22+
// CHECK-watchos: private unnamed_addr constant [8 x i8] c"#16@0:8\00"
1923

2024
@objc class Methods {
2125
@objc func testSizedUnsignedTypes(_ a: UInt8, b: UInt16, c: UInt32, d: UInt64) {}
2226
// CHECK-macosx: private unnamed_addr constant [20 x i8] c"v36@0:8C16S20I24Q28\00"
2327
// CHECK-ios: private unnamed_addr constant [20 x i8] c"v36@0:8C16S20I24Q28\00"
2428
// CHECK-tvos: private unnamed_addr constant [20 x i8] c"v36@0:8C16S20I24Q28\00"
29+
// CHECK-watchos: private unnamed_addr constant [20 x i8] c"v36@0:8C16S20I24Q28\00"
2530

2631
@objc func testSizedFloats(_ a: Float32, b: Float64) {}
2732
// CHECK-macosx: private unnamed_addr constant [14 x i8] c"v28@0:8f16d20\00"
2833
// CHECK-ios: private unnamed_addr constant [14 x i8] c"v28@0:8f16d20\00"
2934
// CHECK-tvos: private unnamed_addr constant [14 x i8] c"v28@0:8f16d20\00"
35+
// CHECK-watchos: private unnamed_addr constant [14 x i8] c"v28@0:8f16d20\00"
3036

3137
@objc func testParens(_ a: ((Int))) {}
3238
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"v24@0:8q16\00"
3339
// CHECK-ios: private unnamed_addr constant [11 x i8] c"v24@0:8q16\00"
3440
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"v24@0:8q16\00"
41+
// CHECK-watchos: private unnamed_addr constant [11 x i8] c"v24@0:8q16\00"
3542

3643
@objc func testPrimitives(_ b: CBool, i: Int, f: Float, d: Double)
3744
-> OpaquePointer { fatalError() }
3845
// CHECK-macosx: private unnamed_addr constant [21 x i8] c"^v40@0:8c16q20f28d32\00"
3946
// CHECK-ios: private unnamed_addr constant [21 x i8] c"^v40@0:8B16q20f28d32\00"
4047
// CHECK-tvos: private unnamed_addr constant [21 x i8] c"^v40@0:8B16q20f28d32\00"
48+
// CHECK-watchos: private unnamed_addr constant [21 x i8] c"^v40@0:8B16q20f28d32\00"
4149

4250
@objc func testOptionalPrimitives()
4351
-> OpaquePointer? { return nil }
4452
// CHECK-macosx: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
4553
// CHECK-ios: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
4654
// CHECK-tvos: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
55+
// CHECK-watchos: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
4756

4857
@objc func testCSignedTypes(_ a: CSignedChar, b: CShort, c: CInt, d: CLong, e: CLongLong) {}
4958
// CHECK-macosx: private unnamed_addr constant [23 x i8] c"v44@0:8c16s20i24q28q36\00"
5059
// CHECK-ios: private unnamed_addr constant [23 x i8] c"v44@0:8c16s20i24q28q36\00"
5160
// CHECK-tvos: private unnamed_addr constant [23 x i8] c"v44@0:8c16s20i24q28q36\00"
61+
// CHECK-watchos: private unnamed_addr constant [23 x i8] c"v44@0:8c16s20i24q28q36\00"
5262

5363
@objc func testCUnsignedTypes(_ a: CUnsignedChar, b: CUnsignedShort, c: CUnsignedInt, d: CUnsignedLong, e: CUnsignedLongLong) {}
5464
// CHECK-macosx: private unnamed_addr constant [23 x i8] c"v44@0:8C16S20I24Q28Q36\00"
5565
// CHECK-ios: private unnamed_addr constant [23 x i8] c"v44@0:8C16S20I24Q28Q36\00"
5666
// CHECK-tvos: private unnamed_addr constant [23 x i8] c"v44@0:8C16S20I24Q28Q36\00"
67+
// CHECK-watchos: private unnamed_addr constant [23 x i8] c"v44@0:8C16S20I24Q28Q36\00"
5768

5869
@objc func testCChars(_ basic: CChar, wchar wide: CWideChar, char16: CChar16, char32: CChar32) {}
5970
// CHECK-macosx: private unnamed_addr constant [20 x i8] c"v32@0:8c16i20S24i28\00"
6071
// CHECK-ios: private unnamed_addr constant [20 x i8] c"v32@0:8c16i20S24i28\00"
6172
// CHECK-tvos: private unnamed_addr constant [20 x i8] c"v32@0:8c16i20S24i28\00"
73+
// CHECK-watchos: private unnamed_addr constant [20 x i8] c"v32@0:8c16i20S24i28\00"
6274

6375
@objc func testCBool(_ a: CBool) {}
6476
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"v20@0:8c16\00"
6577
// CHECK-ios: private unnamed_addr constant [11 x i8] c"v20@0:8B16\00"
6678
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"v20@0:8B16\00"
79+
// CHECK-watchos: private unnamed_addr constant [11 x i8] c"v20@0:8B16\00"
6780

6881
@objc func testSizedSignedTypes(_ a: Int8, b: Int16, c: Int32, d: Int64) {}
6982
// CHECK-macosx: private unnamed_addr constant [20 x i8] c"v36@0:8c16s20i24q28\00"
7083
// CHECK-ios: private unnamed_addr constant [20 x i8] c"v36@0:8c16s20i24q28\00"
7184
// CHECK-tvos: private unnamed_addr constant [20 x i8] c"v36@0:8c16s20i24q28\00"
85+
// CHECK-watchos: private unnamed_addr constant [20 x i8] c"v36@0:8c16s20i24q28\00"
7286

7387
@objc class func getSelf() -> Methods.Type { return self }
7488
// These strings are required for another purpose and so are tested above.
@@ -77,61 +91,72 @@ import gizmo
7791
// CHECK-macosx: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
7892
// CHECK-ios: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
7993
// CHECK-tvos: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
94+
// CHECK-watchos: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
8095

8196
@objc func testId(_ s: AnyObject) -> AnyObject { return self }
8297
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"@24@0:8@16\00"
8398
// CHECK-ios: private unnamed_addr constant [11 x i8] c"@24@0:8@16\00"
8499
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"@24@0:8@16\00"
100+
// CHECK-watchos: private unnamed_addr constant [11 x i8] c"@24@0:8@16\00"
85101

86102
@objc func comp1(_ a: P1 & P2, b: P1 & P2 & P3) -> P1 & P2 { return a }
87103
// CHECK-macosx: private unnamed_addr constant [14 x i8] c"@32@0:8@16@24\00"
88104
// CHECK-ios: private unnamed_addr constant [14 x i8] c"@32@0:8@16@24\00"
89105
// CHECK-tvos: private unnamed_addr constant [14 x i8] c"@32@0:8@16@24\00"
106+
// CHECK-watchos: private unnamed_addr constant [14 x i8] c"@32@0:8@16@24\00"
90107

91108
@objc func returnsBool(_ b : Bool) -> Bool { return b }
92109
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"c20@0:8c16\00"
93110
// CHECK-ios: private unnamed_addr constant [11 x i8] c"B20@0:8B16\00"
94111
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"B20@0:8B16\00"
112+
// CHECK-watchos: private unnamed_addr constant [11 x i8] c"B20@0:8B16\00"
95113

96114
@objc func comp1(_ a: Methods, b: Methods, c: Methods) -> Methods { return a }
97115
// CHECK-macosx: private unnamed_addr constant [17 x i8] c"@40@0:8@16@24@32\00"
98116
// CHECK-ios: private unnamed_addr constant [17 x i8] c"@40@0:8@16@24@32\00"
99117
// CHECK-tvos: private unnamed_addr constant [17 x i8] c"@40@0:8@16@24@32\00"
118+
// CHECK-watchos: private unnamed_addr constant [17 x i8] c"@40@0:8@16@24@32\00"
100119

101120
@objc func passSelector(_ aSelector : Selector) {}
102121
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"v24@0:8:16\00"
103122
// CHECK-ios: private unnamed_addr constant [11 x i8] c"v24@0:8:16\00"
104123
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"v24@0:8:16\00"
124+
// CHECK-watchos: private unnamed_addr constant [11 x i8] c"v24@0:8:16\00"
105125

106126
@objc func copyUnsafeMutablePointer(_ p: UnsafeMutablePointer<Int32>) -> UnsafeMutablePointer<Int32> { return p }
107127
// CHECK-macosx: private unnamed_addr constant [13 x i8] c"^i24@0:8^i16\00"
108128
// CHECK-ios: private unnamed_addr constant [13 x i8] c"^i24@0:8^i16\00"
109129
// CHECK-tvos: private unnamed_addr constant [13 x i8] c"^i24@0:8^i16\00"
130+
// CHECK-watchos: private unnamed_addr constant [13 x i8] c"^i24@0:8^i16\00"
110131

111132
@objc func copyUnsafeMutablePointerInt(_ p: UnsafeMutablePointer<Int>) -> UnsafeMutablePointer<Int> { return p }
112133
// CHECK-macosx: private unnamed_addr constant [13 x i8] c"^q24@0:8^q16\00"
113134
// CHECK-ios: private unnamed_addr constant [13 x i8] c"^q24@0:8^q16\00"
114135
// CHECK-tvos: private unnamed_addr constant [13 x i8] c"^q24@0:8^q16\00"
136+
// CHECK-watchos: private unnamed_addr constant [13 x i8] c"^q24@0:8^q16\00"
115137

116138
@objc func testArchetype(_ work: P3) {
117139
}
118140
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"v24@0:8@16\00"
119141
// CHECK-ios: private unnamed_addr constant [11 x i8] c"v24@0:8@16\00"
120142
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"v24@0:8@16\00"
143+
// CHECK-watchos: private unnamed_addr constant [11 x i8] c"v24@0:8@16\00"
121144

122145
@objc func foo(_ x: (Int) -> Int) -> Int {
123146
return 1
124147
}
125148
// CHECK-macosx: private unnamed_addr constant [12 x i8] c"q24@0:8@?16\00"
126149
// CHECK-ios: private unnamed_addr constant [12 x i8] c"q24@0:8@?16\00"
127150
// CHECK-tvos: private unnamed_addr constant [12 x i8] c"q24@0:8@?16\00"
151+
// CHECK-watchos: private unnamed_addr constant [12 x i8] c"q24@0:8@?16\00"
128152

129153
@objc func returnNSRadixedOptions() -> NSRadixedOptions {
130154
return .octal
131155
}
132156
// CHECK-macosx: [[ENUMENCODING:@.*]] = private unnamed_addr constant [8 x i8] c"i16@0:8\00"
133157
// CHECK-ios: [[ENUMENCODING:@.*]] = private unnamed_addr constant [8 x i8] c"i16@0:8\00"
134158
// CHECK-tvos: [[ENUMENCODING:@.*]] = private unnamed_addr constant [8 x i8] c"i16@0:8\00"
159+
// CHECK-watchos: [[ENUMENCODING:@.*]] = private unnamed_addr constant [8 x i8] c"i16@0:8\00"
135160

136161
@objc func returnChoseNSRadixedOptions(_ choice: NSRadixedOptions) -> NSRadixedOptions {
137162
switch choice {
@@ -142,6 +167,7 @@ import gizmo
142167
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"i20@0:8i16\00"
143168
// CHECK-ios: private unnamed_addr constant [11 x i8] c"i20@0:8i16\00"
144169
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"i20@0:8i16\00"
170+
// CHECK-watchos: private unnamed_addr constant [11 x i8] c"i20@0:8i16\00"
145171

146172
@objc func getRawEnumInGizmo() -> RawEnumInGizmo {
147173
return InGizmoTwo
@@ -152,6 +178,8 @@ import gizmo
152178
// CHECK-ios: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[ENUMENCODING]], i64 0, i64 0)
153179
// CHECK-tvos: { i8* getelementptr inbounds ([18 x i8], [18 x i8]* @"\01L_selector_data(getRawEnumInGizmo)", i64 0, i64 0),
154180
// CHECK-tvos: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[ENUMENCODING]], i64 0, i64 0)
181+
// CHECK-watchos: { i8* getelementptr inbounds ([18 x i8], [18 x i8]* @"\01L_selector_data(getRawEnumInGizmo)", i64 0, i64 0),
182+
// CHECK-watchos: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[ENUMENCODING]], i64 0, i64 0)
155183

156184
}
157185

@@ -182,6 +210,11 @@ import gizmo
182210
// CHECK-tvos: [[ENC3:@.*]] = private unnamed_addr constant [53 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject\2216\00"
183211
// CHECK-tvos: [[ENC4:@.*]] = private unnamed_addr constant [75 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject<NSFunging><NSRuncing>\2216\00"
184212
// CHECK-tvos: @_PROTOCOL_METHOD_TYPES__TtP18objc_type_encoding10MyProtocol_ = internal constant [4 x i8*] [i8* getelementptr inbounds ([35 x i8], [35 x i8]* [[ENC1]], i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* [[ENC2]], i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* [[ENC3]], i64 0, i64 0), i8* getelementptr inbounds ([75 x i8], [75 x i8]* [[ENC4]], i64 0, i64 0)]
213+
// CHECK-watchos: [[ENC1:@.*]] = private unnamed_addr constant [35 x i8] c"v24@0:8@\22<NSFunging><NSRuncing>\2216\00"
214+
// CHECK-watchos: [[ENC2:@.*]] = private unnamed_addr constant [46 x i8] c"v32@0:8@\22Gizmo\2216@?<v@?@\22NSView\22@\22NSSpoon\22>24\00"
215+
// CHECK-watchos: [[ENC3:@.*]] = private unnamed_addr constant [53 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject\2216\00"
216+
// CHECK-watchos: [[ENC4:@.*]] = private unnamed_addr constant [75 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject<NSFunging><NSRuncing>\2216\00"
217+
// CHECK-watchos: @_PROTOCOL_METHOD_TYPES__TtP18objc_type_encoding10MyProtocol_ = internal constant [4 x i8*] [i8* getelementptr inbounds ([35 x i8], [35 x i8]* [[ENC1]], i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* [[ENC2]], i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* [[ENC3]], i64 0, i64 0), i8* getelementptr inbounds ([75 x i8], [75 x i8]* [[ENC4]], i64 0, i64 0)]
185218

186219
class C: P {
187220
func stuff() {}

test/IRGen/opaque_result_type.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: %{python} %utils/chex.py < %s > %t/opaque_result_type.swift
33
// RUN: %target-swift-frontend -enable-implicit-dynamic -disable-availability-checking -emit-ir %t/opaque_result_type.swift | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-NODEBUG %t/opaque_result_type.swift
44

5+
// rdar://76863553
6+
// UNSUPPORTED: OS=watchos && CPU=x86_64
7+
58
public protocol O {
69
func bar()
710
}

test/lit.cfg

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def darwin_get_ios_sim_vers():
7575
ios_version_str = re.findall(r'iOS \d+\.*\d*', sim_output.decode('utf-8'))
7676
return [float(v.strip('iOS')) for v in ios_version_str]
7777

78+
def darwin_get_watchos_sim_vers():
79+
sim_output = subprocess.check_output(['xcrun', 'simctl', 'list', 'runtimes'])
80+
watchos_version_str = re.findall(r'watchOS \d+\.*\d*', sim_output.decode('utf-8'))
81+
return [float(v.strip('watchOS')) for v in watchos_version_str]
82+
7883
# Returns the "prefix" command that should be prepended to the command line to
7984
# run an executable compiled for iOS or AppleTV simulator.
8085
def get_simulator_command(run_os, run_cpu, sdk_path):
@@ -94,7 +99,17 @@ def get_simulator_command(run_os, run_cpu, sdk_path):
9499
elif run_os == 'tvos':
95100
return "simctl spawn --standalone 'Apple TV 4K'"
96101
elif run_os == 'watchos':
97-
return "simctl spawn --standalone 'Apple Watch Series 5 - 44mm'"
102+
if run_cpu == "i386":
103+
if min(darwin_get_watchos_sim_vers()) > 6.2:
104+
print("ERROR: Your system does not have a 32-bit watchOS simulator installed.")
105+
print("INFO: 1. Install watchOS 6.2 or older simulator (Xcode -> Preferences -> Components -> Simulators).")
106+
print("INFO: 2. Create a 32-bit watchOS device. Run:")
107+
print("INFO: $ xcrun simctl create 'Apple Watch Series 2 - 42mm' com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-42mm com.apple.CoreSimulator.SimRuntime.watchOS-6-2")
108+
sys.exit(1)
109+
else:
110+
return "simctl spawn --standalone 'Apple Watch Series 2 - 42mm'"
111+
else:
112+
return "simctl spawn --standalone 'Apple Watch Series 5 - 44mm'"
98113
else:
99114
lit_config.fatal("Unknown simulator OS %r" % run_os)
100115

@@ -727,7 +742,8 @@ config.substitutions.append(('%target-cpu', run_cpu))
727742
target_os_abi = run_os
728743
target_os_is_maccatalyst = "FALSE"
729744
target_mandates_stable_abi = "FALSE"
730-
if run_cpu in ('arm64e',):
745+
if (run_cpu in ('arm64e',) or \
746+
(run_os == 'watchos' and run_cpu == 'x86_64')):
731747
target_mandates_stable_abi = "TRUE"
732748
config.available_features.add('swift_only_stable_abi')
733749
if run_os in ('maccatalyst',):

utils/build-script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ _SUPPORTED_XCODE_BUILDS = [
5858
("12.2", "12B45b"),
5959
("12.3", "12C33"),
6060
("12.4", "12D4e"),
61+
("12.5 beta 3", "12E5244e")
6162
]
6263

6364
# -----------------------------------------------------------------------------

utils/build-script-impl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ function verify_host_is_supported() {
420420
| appletvsimulator-arm64 \
421421
| appletvos-arm64 \
422422
| watchsimulator-i386 \
423+
| watchsimulator-x86_64 \
423424
| watchsimulator-arm64 \
424425
| watchos-armv7k \
425426
| android-armv7 \
@@ -625,6 +626,13 @@ function set_build_options_for_host() {
625626
SWIFT_HOST_TRIPLE="i386-apple-watchos${DARWIN_DEPLOYMENT_VERSION_WATCHOS}-simulator"
626627
llvm_target_arch="X86"
627628

629+
SWIFT_HOST_VARIANT_SDK="WATCHOS_SIMULATOR"
630+
cmake_osx_deployment_target=""
631+
;;
632+
watchsimulator-x86_64)
633+
SWIFT_HOST_TRIPLE="x86_64-apple-watchos${DARWIN_DEPLOYMENT_VERSION_WATCHOS}-simulator"
634+
llvm_target_arch="X86"
635+
628636
SWIFT_HOST_VARIANT_SDK="WATCHOS_SIMULATOR"
629637
cmake_osx_deployment_target=""
630638
;;

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,10 @@ def create_argument_parser():
10001000
toggle_false('test_ios_32bit_simulator'),
10011001
default=False,
10021002
help='skip testing iOS 32 bit simulator targets')
1003+
option('--skip-test-watchos-32bit-simulator',
1004+
toggle_false('test_watchos_32bit_simulator'),
1005+
default=True,
1006+
help='skip testing watchOS 32 bit simulator targets')
10031007
option('--skip-test-ios-host',
10041008
toggle_false('test_ios_host'),
10051009
help='skip testing iOS device targets on the host machine (the '

0 commit comments

Comments
 (0)