xref: /llvm-project/clang/test/Tooling/clang-check-mac-libcxx-relpath.cpp (revision 44a40046c8137638be12d0ca19eeb3cb3174ce56)
1*44a40046SIlya Biryukov // Clang on MacOS can find libc++ living beside the installed compiler.
2*44a40046SIlya Biryukov // This test makes sure our libTooling-based tools emulate this properly.
3*44a40046SIlya Biryukov //
4*44a40046SIlya Biryukov // RUN: rm -rf %t
5*44a40046SIlya Biryukov // RUN: mkdir %t
6*44a40046SIlya Biryukov //
7*44a40046SIlya Biryukov // Install the mock libc++ (simulates the libc++ directory structure).
8*44a40046SIlya Biryukov // RUN: cp -r %S/Inputs/mock-libcxx %t/
9*44a40046SIlya Biryukov //
10*44a40046SIlya Biryukov // Pretend clang is installed beside the mock library that we provided.
11*44a40046SIlya Biryukov // RUN: echo '[{"directory":"%t","command":"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
12*44a40046SIlya Biryukov // RUN: cp "%s" "%t/test.cpp"
13*44a40046SIlya Biryukov // clang-check will produce an error code if the mock library is not found.
14*44a40046SIlya Biryukov // RUN: clang-check -p "%t" "%t/test.cpp"
15*44a40046SIlya Biryukov 
16*44a40046SIlya Biryukov #include <mock_vector>
17*44a40046SIlya Biryukov vector v;
18