[PATCH] D54311: Add a test checking clang-tidy can find libc++ on Mac

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 12 01:47:31 PST 2018


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: test/clang-tidy/clang-tidy-mac-libcxx.cpp:11
+// 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"
----------------
ilya-biryukov wrote:
> sammccall wrote:
> > should this be `"command":"clang++"...` with clang++ on the PATH?
> Both the relative and the absolute path should work, but cmake produces absolute paths. Hence the test.
Is there a test for the other case? (In the clang repo rather than here is fine)


================
Comment at: test/clang-tidy/clang-tidy-mac-libcxx.cpp:13
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: clang-tidy "%t/test.cpp"
+
----------------
ilya-biryukov wrote:
> sammccall wrote:
> > This should check a diagnostic rather than rely on the error code, I think
> Done. We rely on the absence of a diagnostic (the unresolved error for vector), error-code seemed like a simpler way to do this.
I think emitting a diagnostic would make this a much more robust test, but up to you.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54311





More information about the cfe-commits mailing list