xref: /llvm-project/clang/test/Tooling/auto-detect-from-source.cpp (revision 9d3530bd4ebaa7dc02494db440026f87f2bb8bc4)
165fd0e1fSManuel Klimek // RUN: rm -rf %t
265fd0e1fSManuel Klimek // RUN: mkdir %t
3*9d3530bdSSam McCall // RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -DSECRET=XYZZY -c %/t/test.cpp\",\"file\":\"%/t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json
465fd0e1fSManuel Klimek // RUN: cp "%s" "%t/test.cpp"
5925213b0SRafael Espindola // RUN: not clang-check "%t/test.cpp" 2>&1 | FileCheck %s
665fd0e1fSManuel Klimek 
7*9d3530bdSSam McCall // CHECK: XYZZY
8*9d3530bdSSam McCall SECRET;
9*9d3530bdSSam McCall 
10*9d3530bdSSam McCall // Copy to a different file, and rely on the command being inferred.
11*9d3530bdSSam McCall // RUN: cp "%s" "%t/other.cpp"
12*9d3530bdSSam McCall // RUN: not clang-check "%t/other.cpp" 2>&1 | FileCheck %s
13