[PATCH] D150582: [clangd] Fix test failure when it's built with compiler flags unknown by clang

Sam James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 15 19:56:40 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4ddae8b94139: [clangd] Fix test failure when it's built with compiler flags unknown by clang (authored by xry111, committed by thesamesam).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150582/new/

https://reviews.llvm.org/D150582

Files:
  clang-tools-extra/clangd/test/CMakeLists.txt
  clang-tools-extra/clangd/test/compile_commands.json


Index: clang-tools-extra/clangd/test/compile_commands.json
===================================================================
--- /dev/null
+++ clang-tools-extra/clangd/test/compile_commands.json
@@ -0,0 +1 @@
+[]
Index: clang-tools-extra/clangd/test/CMakeLists.txt
===================================================================
--- clang-tools-extra/clangd/test/CMakeLists.txt
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150582.522412.patch
Type: text/x-patch
Size: 1213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230516/84ec22fa/attachment.bin>


More information about the cfe-commits mailing list