[clang] [clang][driver] Fix -print-target-triple OS version for apple targets (PR #104037)
Louis Dionne via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 14 10:04:20 PDT 2024
================
@@ -0,0 +1,35 @@
+// Test the output of -print-target-triple on Darwin.
+
+//
+// All platforms
+//
+
+// RUN: %clang -print-target-triple \
+// RUN: --target=x86_64-apple-macos -mmacos-version-min=15 \
+// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-MACOS %s
+// CHECK-CLANGRT-MACOS: x86_64-apple-macosx15.0.0
+
+// RUN: %clang -print-target-triple \
+// RUN: --target=arm64-apple-ios -mios-version-min=9 \
+// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-IOS %s
+// CHECK-CLANGRT-IOS: arm64-apple-ios9.0.0
+
+// RUN: %clang -print-target-triple \
+// RUN: --target=arm64-apple-watchos -mwatchos-version-min=3 \
+// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-WATCHOS %s
+// CHECK-CLANGRT-WATCHOS: arm64-apple-watchos3.0.0
----------------
ldionne wrote:
I'm curious to know how this behaves for architectures like `armv7k`. Maybe add this?
```c++
// RUN: %clang -print-target-triple \
// RUN: --target=armv7k-apple-watchos -mwatchos-version-min=3 \
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-WATCHOS-ARMV7K %s
// CHECK-CLANGRT-WATCHOS-ARMV7K: armv7k-apple-watchos3.0.0
```
That's because I have seen weird behavior with armv7k on watchOS being translated to thumbv7k and causing issues in the past.
https://github.com/llvm/llvm-project/pull/104037
More information about the cfe-commits
mailing list