summaryrefslogtreecommitdiff
path: root/clang/test
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2019-01-15 19:05:50 +0000
committerHaojian Wu <hokein@google.com>2019-01-15 19:05:50 +0000
commitef217a8803a271823b01d4efc1249674d46961e0 (patch)
tree74609b30ede4a66bc9c603a7ef2f4048c69e39d0 /clang/test
parente051d64457a6d1d1b2a06e4d12d75b9126831d29 (diff)
[Tooling] Make clang-tool find libc++ dir on mac when running on a file without compilation database.
Summary: This is a regression of r348365. When clang-tools run on a file without a complation database (`clang-check /tmp/t.cc`), we will use fixed compilation database as a fallback. However the actual compiler path in the fallback complation command is just `clang-tool` which is insufficient to detect the libc++ dir. Reviewers: ilya-biryukov, EricWF Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56680
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp b/clang/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
new file mode 100644
index 00000000000..b072380c04e
--- /dev/null
+++ b/clang/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
@@ -0,0 +1,16 @@
+// Clang on MacOS can find libc++ living beside the installed compiler.
+// This test makes sure our libTooling-based tools emulate this properly with
+// fixed compilation database.
+//
+// RUN: rm -rf %t
+// RUN: mkdir %t
+//
+// Install the mock libc++ (simulates the libc++ directory structure).
+// RUN: cp -r %S/Inputs/mock-libcxx %t/
+//
+// RUN: cp clang-check %t/mock-libcxx/bin/
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: %t/mock-libcxx/bin/clang-check -p "%t" "%t/test.cpp" -- -stdlib=libc++
+
+#include <mock_vector>
+vector v;