diff --git a/clang-tools-extra/clangd/test/CMakeLists.txt b/clang-tools-extra/clangd/test/CMakeLists.txt --- a/clang-tools-extra/clangd/test/CMakeLists.txt +++ b/clang-tools-extra/clangd/test/CMakeLists.txt @@ -28,6 +28,16 @@ ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py ) +# Copy an empty compile_commands.json to override the compile_commands.json +# in the top level build directory. Or if a clangd test involves creating a +# temporary source file in the build directory and run clangd to check it, +# it can pick up unrecognizable command options when LLVM is built with +# another compiler or a different version of Clang. +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json + ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json +) + add_lit_testsuite(check-clangd "Running the Clangd regression tests" # clangd doesn't put unittest configs in test/unit like every other project. # Because of that, this needs to pass two folders here, while every other diff --git a/clang-tools-extra/clangd/test/compile_commands.json b/clang-tools-extra/clangd/test/compile_commands.json new file mode 100644 --- /dev/null +++ b/clang-tools-extra/clangd/test/compile_commands.json @@ -0,0 +1 @@ +[]