summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c++/4.2.1/arm64-apple-darwin10/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v6/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v7/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.0.0/powerpc-apple-darwin10/ppc64/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.2.1/powerpc-apple-darwin10/ppc64/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.0.0/i686-apple-darwin8/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/include/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/include/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_usr/usr/include/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_usr/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/include/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/include/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/include/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_toolchain/usr/bin/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_toolchain/usr/include/c++/v1/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin/.keep0
-rw-r--r--clang/test/Driver/darwin-header-search-libcxx.cpp78
-rw-r--r--clang/test/Driver/darwin-header-search-libstdcxx.cpp118
-rw-r--r--clang/test/Driver/darwin-header-search-system.cpp80
-rw-r--r--clang/test/Driver/darwin-stdlib.cpp11
-rw-r--r--clang/test/Frontend/warning-stdlibcxx-darwin.cpp6
31 files changed, 278 insertions, 15 deletions
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c++/4.2.1/arm64-apple-darwin10/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c++/4.2.1/arm64-apple-darwin10/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c++/4.2.1/arm64-apple-darwin10/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v6/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v6/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v6/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v7/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v7/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v7/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.0.0/powerpc-apple-darwin10/ppc64/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.0.0/powerpc-apple-darwin10/ppc64/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.0.0/powerpc-apple-darwin10/ppc64/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.2.1/powerpc-apple-darwin10/ppc64/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.2.1/powerpc-apple-darwin10/ppc64/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.2.1/powerpc-apple-darwin10/ppc64/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.0.0/i686-apple-darwin8/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.0.0/i686-apple-darwin8/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.0.0/i686-apple-darwin8/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/include/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/include/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/include/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/include/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/include/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/include/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_usr/usr/include/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_usr/usr/include/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_usr/usr/include/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_usr/usr/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_usr/usr/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_usr/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/include/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/include/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/include/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/include/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/include/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/include/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/include/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/include/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/include/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/lib/.keep b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/lib/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_toolchain/usr/bin/.keep b/clang/test/Driver/Inputs/basic_darwin_toolchain/usr/bin/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_toolchain/usr/bin/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_toolchain/usr/include/c++/v1/.keep b/clang/test/Driver/Inputs/basic_darwin_toolchain/usr/include/c++/v1/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_toolchain/usr/include/c++/v1/.keep
diff --git a/clang/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin/.keep b/clang/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin/.keep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin/.keep
diff --git a/clang/test/Driver/darwin-header-search-libcxx.cpp b/clang/test/Driver/darwin-header-search-libcxx.cpp
new file mode 100644
index 00000000000..6111ac8f091
--- /dev/null
+++ b/clang/test/Driver/darwin-header-search-libcxx.cpp
@@ -0,0 +1,78 @@
+// General tests that the header search paths for libc++ detected by the driver
+// and passed to CC1 are correct on Darwin platforms.
+
+// Check without a sysroot and without headers alongside the installation
+// (no include path should be added, and no warning or error).
+//
+// 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_no_libcxx/usr/bin \
+// RUN: | FileCheck --check-prefix=CHECK-LIBCXX-NONE %s
+// CHECK-LIBCXX-NONE: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+
+// Check with only headers alongside the installation (those should be used,
+// but we should still add /usr/include/c++/v1 after to preserve legacy).
+//
+// 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: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain --check-prefix=CHECK-LIBCXX-TOOLCHAIN-1 %s
+// CHECK-LIBCXX-TOOLCHAIN-1: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBCXX-TOOLCHAIN-1: "-internal-isystem" "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
+// CHECK-LIBCXX-TOOLCHAIN-1: "-internal-isystem" "/usr/include/c++/v1"
+//
+// 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: -isysroot %S/Inputs/basic_darwin_sdk_no_libcxx \
+// RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain --check-prefix=CHECK-LIBCXX-TOOLCHAIN-2 %s
+// CHECK-LIBCXX-TOOLCHAIN-2: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBCXX-TOOLCHAIN-2: "-internal-isystem" "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
+
+// Check with both headers in the sysroot and headers alongside the installation
+// (the headers in <sysroot> should be added after the toolchain headers).
+//
+// 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: | 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"
+
+// Make sure that using -nostdinc or -nostdlibinc will drop the non-toolchain
+// C++ library include paths (so all except <toolchain>/usr/bin/../include/c++/v1).
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// 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: -nostdinc \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr \
+// RUN: -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \
+// RUN: --check-prefix=CHECK-LIBCXX-NOSTDINC %s
+// CHECK-LIBCXX-NOSTDINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBCXX-NOSTDINC: "-internal-isystem" "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
+// CHECK-LIBCXX-NOSTDINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// 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: -nostdinc \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr \
+// RUN: -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \
+// RUN: --check-prefix=CHECK-LIBCXX-NOSTDLIBINC %s
+// CHECK-LIBCXX-NOSTDLIBINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBCXX-NOSTDLIBINC: "-internal-isystem" "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
+// CHECK-LIBCXX-NOSTDLIBINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"
diff --git a/clang/test/Driver/darwin-header-search-libstdcxx.cpp b/clang/test/Driver/darwin-header-search-libstdcxx.cpp
new file mode 100644
index 00000000000..66dff673011
--- /dev/null
+++ b/clang/test/Driver/darwin-header-search-libstdcxx.cpp
@@ -0,0 +1,118 @@
+// General tests that the header search paths for libstdc++ detected by the
+// driver and passed to CC1 are correct on Darwin platforms.
+
+// Check ppc and ppc64
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target ppc-apple-darwin \
+// RUN: -stdlib=libstdc++ \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_ppc \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_ppc --check-prefix=CHECK-LIBSTDCXX-PPC %s
+// CHECK-LIBSTDCXX-PPC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBSTDCXX-PPC: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1
+// CHECK-LIBSTDCXX-PPC: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/powerpc-apple-darwin10"
+// CHECK-LIBSTDCXX-PPC: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
+// CHECK-LIBSTDCXX-PPC: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0"
+// CHECK-LIBSTDCXX-PPC: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/powerpc-apple-darwin10"
+// CHECK-LIBSTDCXX-PPC: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target ppc64-apple-darwin \
+// RUN: -stdlib=libstdc++ \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_ppc \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_ppc --check-prefix=CHECK-LIBSTDCXX-PPC64 %s
+// CHECK-LIBSTDCXX-PPC64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBSTDCXX-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
+// CHECK-LIBSTDCXX-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/powerpc-apple-darwin10/ppc64"
+// CHECK-LIBSTDCXX-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
+// CHECK-LIBSTDCXX-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0"
+// CHECK-LIBSTDCXX-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/powerpc-apple-darwin10/ppc64"
+// CHECK-LIBSTDCXX-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
+
+// Check x86 and x86_64
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target i686-apple-darwin \
+// RUN: -stdlib=libstdc++ \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_x86 \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_x86 --check-prefix=CHECK-LIBSTDCXX-X86 %s
+// CHECK-LIBSTDCXX-X86: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
+// CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/i686-apple-darwin10"
+// CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
+// CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0"
+// CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/i686-apple-darwin8"
+// CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -stdlib=libstdc++ \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_x86 \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_x86 --check-prefix=CHECK-LIBSTDCXX-X86_64 %s
+// CHECK-LIBSTDCXX-X86_64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
+// CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64"
+// CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
+// CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0"
+// CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/i686-apple-darwin8"
+// CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
+
+// Check arm and thumb
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target arm-apple-darwin \
+// RUN: -stdlib=libstdc++ \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_arm \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_arm --check-prefix=CHECK-LIBSTDCXX-ARM %s
+// CHECK-LIBSTDCXX-ARM: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
+// CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v7"
+// CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
+// CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
+// CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v6"
+// CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target arm-apple-darwin \
+// RUN: -stdlib=libstdc++ \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_arm \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_arm --check-prefix=CHECK-LIBSTDCXX-THUMB %s
+// CHECK-LIBSTDCXX-THUMB: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
+// CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v7"
+// CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
+// CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
+// CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v6"
+// CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
+
+// Check aarch64
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target arm64-apple-darwin \
+// RUN: -stdlib=libstdc++ \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_aarch64 \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_aarch64 --check-prefix=CHECK-LIBSTDCXX-AARCH64 %s
+// CHECK-LIBSTDCXX-AARCH64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-LIBSTDCXX-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
+// CHECK-LIBSTDCXX-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm64-apple-darwin10"
+// CHECK-LIBSTDCXX-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
+
+// Make sure we issue a warning when we can't find the path
+//
+// RUN: %clang -no-canonical-prefixes %s -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -stdlib=libstdc++ \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_no_libstdcxx \
+// RUN: | FileCheck --check-prefix=CHECK-LIBSTDCXX-MISSING %s
+// CHECK-LIBSTDCXX-MISSING: clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead
+//
+// RUN: %clang %s -target x86_64-apple-darwin -fsyntax-only 2>&1 \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_no_libstdcxx \
+// RUN: -stdlib=libc++ \
+// RUN: | FileCheck -allow-empty --check-prefix=CHECK-LIBSTDCXX-MISSING-1 %s
+// CHECK-LIBSTDCXX-MISSING-1-NOT: warning
+//
+// RUN: %clang %s -target x86_64-apple-darwin -fsyntax-only 2>&1 \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_no_libstdcxx \
+// RUN: | FileCheck -allow-empty --check-prefix=CHECK-LIBSTDCXX-MISSING-2 %s
+// CHECK-LIBSTDCXX-MISSING-2-NOT: warning
diff --git a/clang/test/Driver/darwin-header-search-system.cpp b/clang/test/Driver/darwin-header-search-system.cpp
new file mode 100644
index 00000000000..790be505964
--- /dev/null
+++ b/clang/test/Driver/darwin-header-search-system.cpp
@@ -0,0 +1,80 @@
+// General tests that the system header search paths detected by the driver
+// and passed to CC1 are correct on Darwin platforms.
+
+// Check system headers (everything below <sysroot> and <resource-dir>)
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -DRESOURCE=%S/Inputs/resource_dir \
+// RUN: --check-prefix=CHECK-SYSTEM %s
+// CHECK-SYSTEM: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-SYSTEM: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-SYSTEM: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-SYSTEM: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// Make sure that using -nobuiltininc will drop resource headers
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nobuiltininc \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -DRESOURCE=%S/Inputs/resource_dir \
+// RUN: --check-prefix=CHECK-NOBUILTININC %s
+// CHECK-NOBUILTININC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOBUILTININC: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-NOBUILTININC-NOT: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOBUILTININC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// Make sure that using -nostdlibinc will drop <sysroot>/usr/local/include and
+// <sysroot>/usr/include.
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nostdlibinc \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -DRESOURCE=%S/Inputs/resource_dir \
+// RUN: --check-prefix=CHECK-NOSTDLIBINC %s
+// CHECK-NOSTDLIBINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOSTDLIBINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-NOSTDLIBINC: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOSTDLIBINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// Make sure that -nostdinc drops all the system include paths, including
+// <resource>/include.
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nostdinc \
+// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -DRESOURCE=%S/Inputs/resource_dir \
+// RUN: --check-prefix=CHECK-NOSTDINC %s
+// CHECK-NOSTDINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOSTDINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-NOSTDINC-NOT: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOSTDINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// Check search paths without -isysroot
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: | FileCheck -DRESOURCE=%S/Inputs/resource_dir \
+// RUN: --check-prefix=CHECK-NOSYSROOT %s
+// CHECK-NOSYSROOT: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOSYSROOT: "-internal-isystem" "/usr/local/include"
+// CHECK-NOSYSROOT: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOSYSROOT: "-internal-externc-isystem" "/usr/include"
diff --git a/clang/test/Driver/darwin-stdlib.cpp b/clang/test/Driver/darwin-stdlib.cpp
index 3e89bd1ec99..0538a42ecd5 100644
--- a/clang/test/Driver/darwin-stdlib.cpp
+++ b/clang/test/Driver/darwin-stdlib.cpp
@@ -3,19 +3,12 @@
// XFAIL: default-cxx-stdlib-set
// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch arm64 -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.8 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.8 -Wno-stdlibcxx-not-found %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.9 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=6.1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=6.1 -Wno-stdlibcxx-not-found %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7k %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
-// The purpose of this test is that the libc++ headers should be found
-// properly. We also pass -stdlib=libc++ to make sure the logic to add the
-// optional absolute include for libc++ from InitHeaderSearch.cpp also fires.
-
// CHECK-LIBCXX: "-stdlib=libc++"
-// CHECK-LIBCXX: "-internal-isystem" "{{[^"]*}}{{/|\\\\}}Inputs{{/|\\\\}}darwin_toolchain_tree{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
-
// CHECK-LIBSTDCXX-NOT: -stdlib=libc++
// CHECK-LIBSTDCXX-NOT: -stdlib=libstdc++
-// CHECK-LIBSTDCXX-NOT: -internal-isystem
diff --git a/clang/test/Frontend/warning-stdlibcxx-darwin.cpp b/clang/test/Frontend/warning-stdlibcxx-darwin.cpp
deleted file mode 100644
index 697fe27c730..00000000000
--- a/clang/test/Frontend/warning-stdlibcxx-darwin.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-// RUN: %clang -cc1 -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist %s 2>&1 | FileCheck %s
-// RUN: %clang -cc1 -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist -stdlib=libc++ %s -verify
-// RUN: %clang -cc1 -x c++-cpp-output -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist %s -verify
-// CHECK: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead
-
-// expected-no-diagnostics
OpenPOWER on IntegriCloud