[clang-tools-extra] r346653 - Add a test checking clang-tidy can find libc++ on Mac
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 12 05:56:09 PST 2018
Author: ibiryukov
Date: Mon Nov 12 05:56:09 2018
New Revision: 346653
URL: http://llvm.org/viewvc/llvm-project?rev=346653&view=rev
Log:
Add a test checking clang-tidy can find libc++ on Mac
Reviewers: sammccall, arphaman, EricWF
Reviewed By: sammccall
Subscribers: christof, cfe-commits
Differential Revision: https://reviews.llvm.org/D54311
Added:
clang-tools-extra/trunk/test/clang-tidy/Inputs/mock-libcxx/
clang-tools-extra/trunk/test/clang-tidy/Inputs/mock-libcxx/include/
clang-tools-extra/trunk/test/clang-tidy/Inputs/mock-libcxx/include/c++/
clang-tools-extra/trunk/test/clang-tidy/Inputs/mock-libcxx/include/c++/v1/
clang-tools-extra/trunk/test/clang-tidy/Inputs/mock-libcxx/include/c++/v1/mock_vector
clang-tools-extra/trunk/test/clang-tidy/clang-tidy-mac-libcxx.cpp
Added: clang-tools-extra/trunk/test/clang-tidy/Inputs/mock-libcxx/include/c++/v1/mock_vector
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/Inputs/mock-libcxx/include/c%2B%2B/v1/mock_vector?rev=346653&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/Inputs/mock-libcxx/include/c++/v1/mock_vector (added)
+++ clang-tools-extra/trunk/test/clang-tidy/Inputs/mock-libcxx/include/c++/v1/mock_vector Mon Nov 12 05:56:09 2018
@@ -0,0 +1,2 @@
+class vector {};
+typedef vector* vector_ptr;
Added: clang-tools-extra/trunk/test/clang-tidy/clang-tidy-mac-libcxx.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/clang-tidy-mac-libcxx.cpp?rev=346653&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/clang-tidy-mac-libcxx.cpp (added)
+++ clang-tools-extra/trunk/test/clang-tidy/clang-tidy-mac-libcxx.cpp Mon Nov 12 05:56:09 2018
@@ -0,0 +1,17 @@
+// Clang on MacOS can find libc++ living beside the installed compiler.
+// This test makes sure clang-tidy emulates this properly.
+//
+// RUN: rm -rf %t
+// RUN: mkdir %t
+//
+// Install the mock libc++ (simulates the libc++ directory structure).
+// RUN: cp -r %S/Inputs/mock-libcxx %t/
+//
+// Pretend clang is installed beside the mock library that we provided.
+// RUN: echo '[{"directory":"%t","command":"%t/mock-libcxx/bin/clang++ -stdlib=libc++ -target x86_64-apple-darwin -c test.cpp","file":"test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: clang-tidy -header-filter='.*' -system-headers -checks='-*,modernize-use-using' "%t/test.cpp" | FileCheck %s
+// CHECK: mock_vector:{{[0-9]+}}:{{[0-9]+}}: warning: use 'using' instead of 'typedef'
+
+#include <mock_vector>
+typedef vector* vec_ptr;
More information about the cfe-commits
mailing list