[driver][xray] fix the macOS support checker by supporting -macos
authorAlex Lorenz <arphaman@gmail.com>
Tue, 27 Aug 2019 18:26:36 +0000 (18:26 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 27 Aug 2019 18:26:36 +0000 (18:26 +0000)
triple in addition to -darwin

The previous check incorrectly checked for macOS support by
allowing -darwin triples only, and -macos triple was not supported.

Differential Revision: https://reviews.llvm.org/D61758

llvm-svn: 370093

clang/lib/Driver/XRayArgs.cpp
clang/test/Driver/XRay/xray-instrument-macos.c [new file with mode: 0644]

index 45ef96e12b3b71692137dd00919ee19c43155f52..16e7c7ecf36b479d0c22992824f431fee7bb0037 100644 (file)
@@ -52,7 +52,7 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) {
     } else if (Triple.isOSFreeBSD() ||
                Triple.isOSOpenBSD() ||
                Triple.isOSNetBSD() ||
-               Triple.getOS() == llvm::Triple::Darwin) {
+               Triple.isMacOSX()) {
       if (Triple.getArch() != llvm::Triple::x86_64) {
         D.Diag(diag::err_drv_clang_unsupported)
             << (std::string(XRayInstrumentOption) + " on " + Triple.str());
diff --git a/clang/test/Driver/XRay/xray-instrument-macos.c b/clang/test/Driver/XRay/xray-instrument-macos.c
new file mode 100644 (file)
index 0000000..afccc62
--- /dev/null
@@ -0,0 +1,4 @@
+// RUN: %clang -o /dev/null -v -fxray-instrument -target x86_64-apple-macos10.11 -c %s
+// RUN: %clang -o /dev/null -v -fxray-instrument -target x86_64-apple-darwin15 -c %s
+// REQUIRES-ANY: x86_64, x86_64h
+typedef int a;