summaryrefslogtreecommitdiffstats
path: root/clang/test/Driver/darwin-header-search-libcxx.cpp
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2019-05-22 20:39:51 +0000
committerJames Y Knight <jyknight@google.com>2019-05-22 20:39:51 +0000
commitb2ece169ed609b9111c290254d831101d21cbf8f (patch)
tree823071454efcb255f7f87d11641e98717c4d45fa /clang/test/Driver/darwin-header-search-libcxx.cpp
parent275a55cb5a622491269bf89ba717d73766acaac6 (diff)
downloadbcm5719-llvm-b2ece169ed609b9111c290254d831101d21cbf8f.tar.gz
bcm5719-llvm-b2ece169ed609b9111c290254d831101d21cbf8f.zip
Add back --sysroot support for darwin header search.
Before e97b5f5cf37e ([clang][Darwin] Refactor header search path logic into the driver), both --sysroot and -isysroot worked to specify where to look for system and C++ headers on Darwin. However, that change caused clang to start ignoring --sysroot. This fixes the regression, and adds tests. (I also note that on all other platforms, clang seems to almost completely ignore -isysroot, but that's another issue...) Differential Revision: https://reviews.llvm.org/D62268 llvm-svn: 361429
Diffstat (limited to 'clang/test/Driver/darwin-header-search-libcxx.cpp')
-rw-r--r--clang/test/Driver/darwin-header-search-libcxx.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Driver/darwin-header-search-libcxx.cpp b/clang/test/Driver/darwin-header-search-libcxx.cpp
index 9113b291e70..d22b8a8cbe3 100644
--- a/clang/test/Driver/darwin-header-search-libcxx.cpp
+++ b/clang/test/Driver/darwin-header-search-libcxx.cpp
@@ -36,6 +36,7 @@
// Check with both headers in the sysroot and headers alongside the installation
// (the headers in <sysroot> should be added after the toolchain headers).
+// Ensure that both -isysroot and --sysroot work, and that isysroot has precedence.
//
// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
// RUN: -target x86_64-apple-darwin \
@@ -46,6 +47,28 @@
// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr \
// RUN: -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \
// RUN: --check-prefix=CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1 %s
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -stdlib=libc++ \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot %S/Inputs/basic_darwin_sdk_usr \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr \
+// RUN: -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \
+// RUN: --check-prefix=CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1 %s
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -stdlib=libc++ \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr \
+// RUN: --sysroot %S/Inputs/basic_darwin_sdk_no_libcxx \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr \
+// RUN: -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \
+// RUN: --check-prefix=CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1 %s
+//
// CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
// CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1: "-internal-isystem" "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
// CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"
OpenPOWER on IntegriCloud