aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrohit-rao <rohitrao@google.com>2024-02-27 15:23:00 -0500
committerGitHub <noreply@github.com>2024-02-27 15:23:00 -0500
commite5ed7b6e2fd368b722b6359556cd0125881e7638 (patch)
treeec73803910eeb13df6d964e765b2262297386d01
parent0e0bee26e7f33c065eebef9a674b2f19bb156414 (diff)
downloadllvm-e5ed7b6e2fd368b722b6359556cd0125881e7638.zip
llvm-e5ed7b6e2fd368b722b6359556cd0125881e7638.tar.gz
llvm-e5ed7b6e2fd368b722b6359556cd0125881e7638.tar.bz2
[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).
-rw-r--r--clang/include/clang/Basic/TargetOSMacros.def5
-rw-r--r--clang/test/Driver/fdefine-target-os-macros.c46
2 files changed, 49 insertions, 2 deletions
diff --git a/clang/include/clang/Basic/TargetOSMacros.def b/clang/include/clang/Basic/TargetOSMacros.def
index dfc2e03..58dce33 100644
--- a/clang/include/clang/Basic/TargetOSMacros.def
+++ b/clang/include/clang/Basic/TargetOSMacros.def
@@ -34,18 +34,19 @@ TARGET_OS(TARGET_OS_UNIX, Triple.isOSNetBSD() ||
TARGET_OS(TARGET_OS_MAC, Triple.isOSDarwin())
TARGET_OS(TARGET_OS_OSX, Triple.isMacOSX())
TARGET_OS(TARGET_OS_IPHONE, Triple.isiOS() || Triple.isTvOS() ||
- Triple.isWatchOS())
+ Triple.isWatchOS() || Triple.isXROS())
// Triple::isiOS() also includes tvOS
TARGET_OS(TARGET_OS_IOS, Triple.getOS() == llvm::Triple::IOS)
TARGET_OS(TARGET_OS_TV, Triple.isTvOS())
TARGET_OS(TARGET_OS_WATCH, Triple.isWatchOS())
+TARGET_OS(TARGET_OS_VISION, Triple.isXROS())
TARGET_OS(TARGET_OS_DRIVERKIT, Triple.isDriverKit())
TARGET_OS(TARGET_OS_MACCATALYST, Triple.isMacCatalystEnvironment())
TARGET_OS(TARGET_OS_SIMULATOR, Triple.isSimulatorEnvironment())
// Deprecated Apple target conditionals.
TARGET_OS(TARGET_OS_EMBEDDED, (Triple.isiOS() || Triple.isTvOS() \
- || Triple.isWatchOS()) \
+ || Triple.isWatchOS() || Triple.isXROS()) \
&& !Triple.isMacCatalystEnvironment() \
&& !Triple.isSimulatorEnvironment())
TARGET_OS(TARGET_OS_NANO, Triple.isWatchOS())
diff --git a/clang/test/Driver/fdefine-target-os-macros.c b/clang/test/Driver/fdefine-target-os-macros.c
index d7379dd..a4de51e 100644
--- a/clang/test/Driver/fdefine-target-os-macros.c
+++ b/clang/test/Driver/fdefine-target-os-macros.c
@@ -12,6 +12,7 @@
// RUN: -DIOS=0 \
// RUN: -DTV=0 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=0 \
@@ -27,6 +28,7 @@
// RUN: -DIOS=1 \
// RUN: -DTV=0 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=1 \
@@ -42,6 +44,7 @@
// RUN: -DIOS=1 \
// RUN: -DTV=0 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=1 \
// RUN: -DEMBEDDED=0 \
@@ -57,6 +60,7 @@
// RUN: -DIOS=1 \
// RUN: -DTV=0 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=0 \
@@ -72,6 +76,7 @@
// RUN: -DIOS=0 \
// RUN: -DTV=1 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=1 \
@@ -87,6 +92,7 @@
// RUN: -DIOS=0 \
// RUN: -DTV=1 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=0 \
@@ -102,6 +108,7 @@
// RUN: -DIOS=0 \
// RUN: -DTV=0 \
// RUN: -DWATCH=1 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=1 \
@@ -117,6 +124,39 @@
// RUN: -DIOS=0 \
// RUN: -DTV=0 \
// RUN: -DWATCH=1 \
+// RUN: -DVISION=0 \
+// RUN: -DDRIVERKIT=0 \
+// RUN: -DMACCATALYST=0 \
+// RUN: -DEMBEDDED=0 \
+// RUN: -DSIMULATOR=1 \
+// RUN: -DWINDOWS=0 \
+// RUN: -DLINUX=0 \
+// RUN: -DUNIX=0
+
+// RUN: %clang -dM -E --target=arm64-apple-xros %s 2>&1 \
+// RUN: | FileCheck %s -DMAC=1 \
+// RUN: -DOSX=0 \
+// RUN: -DIPHONE=1 \
+// RUN: -DIOS=0 \
+// RUN: -DTV=0 \
+// RUN: -DWATCH=0 \
+// RUN: -DVISION=1 \
+// RUN: -DDRIVERKIT=0 \
+// RUN: -DMACCATALYST=0 \
+// RUN: -DEMBEDDED=1 \
+// RUN: -DSIMULATOR=0 \
+// RUN: -DWINDOWS=0 \
+// RUN: -DLINUX=0 \
+// RUN: -DUNIX=0
+
+// RUN: %clang -dM -E --target=arm64-apple-xros-simulator %s 2>&1 \
+// RUN: | FileCheck %s -DMAC=1 \
+// RUN: -DOSX=0 \
+// RUN: -DIPHONE=1 \
+// RUN: -DIOS=0 \
+// RUN: -DTV=0 \
+// RUN: -DWATCH=0 \
+// RUN: -DVISION=1 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=0 \
@@ -132,6 +172,7 @@
// RUN: -DIOS=0 \
// RUN: -DTV=0 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=1 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=0 \
@@ -148,6 +189,7 @@
// RUN: -DIOS=0 \
// RUN: -DTV=0 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=0 \
@@ -164,6 +206,7 @@
// RUN: -DIOS=0 \
// RUN: -DTV=0 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=0 \
@@ -180,6 +223,7 @@
// RUN: -DIOS=0 \
// RUN: -DTV=0 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=0 \
@@ -196,6 +240,7 @@
// RUN: -DIOS=0 \
// RUN: -DTV=0 \
// RUN: -DWATCH=0 \
+// RUN: -DVISION=0 \
// RUN: -DDRIVERKIT=0 \
// RUN: -DMACCATALYST=0 \
// RUN: -DEMBEDDED=0 \
@@ -226,6 +271,7 @@
// CHECK-DAG: #define TARGET_OS_IOS [[IOS]]
// CHECK-DAG: #define TARGET_OS_TV [[TV]]
// CHECK-DAG: #define TARGET_OS_WATCH [[WATCH]]
+// CHECK-DAG: #define TARGET_OS_VISION [[VISION]]
// CHECK-DAG: #define TARGET_OS_DRIVERKIT [[DRIVERKIT]]
// CHECK-DAG: #define TARGET_OS_MACCATALYST [[MACCATALYST]]
// CHECK-DAG: #define TARGET_OS_SIMULATOR [[SIMULATOR]]