Skip to content

Commit e5ed7b6

Browse files
authored
[clang] Extend define-target-os-macros to support XROS. (#82833)
Updates the extension feature `define-target-os-macros` to support the recently-added XROS target (TARGET_OS_VISION).
1 parent 0e0bee2 commit e5ed7b6

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

clang/include/clang/Basic/TargetOSMacros.def

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,19 @@ TARGET_OS(TARGET_OS_UNIX, Triple.isOSNetBSD() ||
3434
TARGET_OS(TARGET_OS_MAC, Triple.isOSDarwin())
3535
TARGET_OS(TARGET_OS_OSX, Triple.isMacOSX())
3636
TARGET_OS(TARGET_OS_IPHONE, Triple.isiOS() || Triple.isTvOS() ||
37-
Triple.isWatchOS())
37+
Triple.isWatchOS() || Triple.isXROS())
3838
// Triple::isiOS() also includes tvOS
3939
TARGET_OS(TARGET_OS_IOS, Triple.getOS() == llvm::Triple::IOS)
4040
TARGET_OS(TARGET_OS_TV, Triple.isTvOS())
4141
TARGET_OS(TARGET_OS_WATCH, Triple.isWatchOS())
42+
TARGET_OS(TARGET_OS_VISION, Triple.isXROS())
4243
TARGET_OS(TARGET_OS_DRIVERKIT, Triple.isDriverKit())
4344
TARGET_OS(TARGET_OS_MACCATALYST, Triple.isMacCatalystEnvironment())
4445
TARGET_OS(TARGET_OS_SIMULATOR, Triple.isSimulatorEnvironment())
4546

4647
// Deprecated Apple target conditionals.
4748
TARGET_OS(TARGET_OS_EMBEDDED, (Triple.isiOS() || Triple.isTvOS() \
48-
|| Triple.isWatchOS()) \
49+
|| Triple.isWatchOS() || Triple.isXROS()) \
4950
&& !Triple.isMacCatalystEnvironment() \
5051
&& !Triple.isSimulatorEnvironment())
5152
TARGET_OS(TARGET_OS_NANO, Triple.isWatchOS())

clang/test/Driver/fdefine-target-os-macros.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// RUN: -DIOS=0 \
1313
// RUN: -DTV=0 \
1414
// RUN: -DWATCH=0 \
15+
// RUN: -DVISION=0 \
1516
// RUN: -DDRIVERKIT=0 \
1617
// RUN: -DMACCATALYST=0 \
1718
// RUN: -DEMBEDDED=0 \
@@ -27,6 +28,7 @@
2728
// RUN: -DIOS=1 \
2829
// RUN: -DTV=0 \
2930
// RUN: -DWATCH=0 \
31+
// RUN: -DVISION=0 \
3032
// RUN: -DDRIVERKIT=0 \
3133
// RUN: -DMACCATALYST=0 \
3234
// RUN: -DEMBEDDED=1 \
@@ -42,6 +44,7 @@
4244
// RUN: -DIOS=1 \
4345
// RUN: -DTV=0 \
4446
// RUN: -DWATCH=0 \
47+
// RUN: -DVISION=0 \
4548
// RUN: -DDRIVERKIT=0 \
4649
// RUN: -DMACCATALYST=1 \
4750
// RUN: -DEMBEDDED=0 \
@@ -57,6 +60,7 @@
5760
// RUN: -DIOS=1 \
5861
// RUN: -DTV=0 \
5962
// RUN: -DWATCH=0 \
63+
// RUN: -DVISION=0 \
6064
// RUN: -DDRIVERKIT=0 \
6165
// RUN: -DMACCATALYST=0 \
6266
// RUN: -DEMBEDDED=0 \
@@ -72,6 +76,7 @@
7276
// RUN: -DIOS=0 \
7377
// RUN: -DTV=1 \
7478
// RUN: -DWATCH=0 \
79+
// RUN: -DVISION=0 \
7580
// RUN: -DDRIVERKIT=0 \
7681
// RUN: -DMACCATALYST=0 \
7782
// RUN: -DEMBEDDED=1 \
@@ -87,6 +92,7 @@
8792
// RUN: -DIOS=0 \
8893
// RUN: -DTV=1 \
8994
// RUN: -DWATCH=0 \
95+
// RUN: -DVISION=0 \
9096
// RUN: -DDRIVERKIT=0 \
9197
// RUN: -DMACCATALYST=0 \
9298
// RUN: -DEMBEDDED=0 \
@@ -102,6 +108,7 @@
102108
// RUN: -DIOS=0 \
103109
// RUN: -DTV=0 \
104110
// RUN: -DWATCH=1 \
111+
// RUN: -DVISION=0 \
105112
// RUN: -DDRIVERKIT=0 \
106113
// RUN: -DMACCATALYST=0 \
107114
// RUN: -DEMBEDDED=1 \
@@ -117,6 +124,39 @@
117124
// RUN: -DIOS=0 \
118125
// RUN: -DTV=0 \
119126
// RUN: -DWATCH=1 \
127+
// RUN: -DVISION=0 \
128+
// RUN: -DDRIVERKIT=0 \
129+
// RUN: -DMACCATALYST=0 \
130+
// RUN: -DEMBEDDED=0 \
131+
// RUN: -DSIMULATOR=1 \
132+
// RUN: -DWINDOWS=0 \
133+
// RUN: -DLINUX=0 \
134+
// RUN: -DUNIX=0
135+
136+
// RUN: %clang -dM -E --target=arm64-apple-xros %s 2>&1 \
137+
// RUN: | FileCheck %s -DMAC=1 \
138+
// RUN: -DOSX=0 \
139+
// RUN: -DIPHONE=1 \
140+
// RUN: -DIOS=0 \
141+
// RUN: -DTV=0 \
142+
// RUN: -DWATCH=0 \
143+
// RUN: -DVISION=1 \
144+
// RUN: -DDRIVERKIT=0 \
145+
// RUN: -DMACCATALYST=0 \
146+
// RUN: -DEMBEDDED=1 \
147+
// RUN: -DSIMULATOR=0 \
148+
// RUN: -DWINDOWS=0 \
149+
// RUN: -DLINUX=0 \
150+
// RUN: -DUNIX=0
151+
152+
// RUN: %clang -dM -E --target=arm64-apple-xros-simulator %s 2>&1 \
153+
// RUN: | FileCheck %s -DMAC=1 \
154+
// RUN: -DOSX=0 \
155+
// RUN: -DIPHONE=1 \
156+
// RUN: -DIOS=0 \
157+
// RUN: -DTV=0 \
158+
// RUN: -DWATCH=0 \
159+
// RUN: -DVISION=1 \
120160
// RUN: -DDRIVERKIT=0 \
121161
// RUN: -DMACCATALYST=0 \
122162
// RUN: -DEMBEDDED=0 \
@@ -132,6 +172,7 @@
132172
// RUN: -DIOS=0 \
133173
// RUN: -DTV=0 \
134174
// RUN: -DWATCH=0 \
175+
// RUN: -DVISION=0 \
135176
// RUN: -DDRIVERKIT=1 \
136177
// RUN: -DMACCATALYST=0 \
137178
// RUN: -DEMBEDDED=0 \
@@ -148,6 +189,7 @@
148189
// RUN: -DIOS=0 \
149190
// RUN: -DTV=0 \
150191
// RUN: -DWATCH=0 \
192+
// RUN: -DVISION=0 \
151193
// RUN: -DDRIVERKIT=0 \
152194
// RUN: -DMACCATALYST=0 \
153195
// RUN: -DEMBEDDED=0 \
@@ -164,6 +206,7 @@
164206
// RUN: -DIOS=0 \
165207
// RUN: -DTV=0 \
166208
// RUN: -DWATCH=0 \
209+
// RUN: -DVISION=0 \
167210
// RUN: -DDRIVERKIT=0 \
168211
// RUN: -DMACCATALYST=0 \
169212
// RUN: -DEMBEDDED=0 \
@@ -180,6 +223,7 @@
180223
// RUN: -DIOS=0 \
181224
// RUN: -DTV=0 \
182225
// RUN: -DWATCH=0 \
226+
// RUN: -DVISION=0 \
183227
// RUN: -DDRIVERKIT=0 \
184228
// RUN: -DMACCATALYST=0 \
185229
// RUN: -DEMBEDDED=0 \
@@ -196,6 +240,7 @@
196240
// RUN: -DIOS=0 \
197241
// RUN: -DTV=0 \
198242
// RUN: -DWATCH=0 \
243+
// RUN: -DVISION=0 \
199244
// RUN: -DDRIVERKIT=0 \
200245
// RUN: -DMACCATALYST=0 \
201246
// RUN: -DEMBEDDED=0 \
@@ -226,6 +271,7 @@
226271
// CHECK-DAG: #define TARGET_OS_IOS [[IOS]]
227272
// CHECK-DAG: #define TARGET_OS_TV [[TV]]
228273
// CHECK-DAG: #define TARGET_OS_WATCH [[WATCH]]
274+
// CHECK-DAG: #define TARGET_OS_VISION [[VISION]]
229275
// CHECK-DAG: #define TARGET_OS_DRIVERKIT [[DRIVERKIT]]
230276
// CHECK-DAG: #define TARGET_OS_MACCATALYST [[MACCATALYST]]
231277
// CHECK-DAG: #define TARGET_OS_SIMULATOR [[SIMULATOR]]

0 commit comments

Comments
 (0)