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

2023-05-16 Thread Xi Ruoyao via Phabricator via cfe-commits
xry111 added a comment.

Hmm, I'd tested the change before creating this but it seems those tests are 
"UNSUPPORTED" on my system :(.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150582

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2023-05-16 Thread Sam James via Phabricator via cfe-commits
thesamesam added a comment.

Sure & thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150582

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2023-05-16 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

This broke buildbots 
 because 
`compile_commands.json` being `empty` has other consequences.
Fixing forward in 9ffef0f24de0fc05b946e662a7b233a32ad058e3 
. Please 
don't let such infrastructure changes without approvals from code owners in the 
future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150582

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2023-05-15 Thread Sam James via Phabricator via cfe-commits
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 its 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


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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2023-05-15 Thread Sam James via Phabricator via cfe-commits
thesamesam accepted this revision.
thesamesam added a comment.
This revision is now accepted and ready to land.

(I even struggled to find docs for the fix we used for clang-tidy, although it 
obviously works.)

Thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150582

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2023-05-15 Thread Xi Ruoyao via Phabricator via cfe-commits
xry111 created this revision.
xry111 added reviewers: thesamesam, MaskRay, uabelho.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
xry111 requested review of this revision.
Herald added subscribers: cfe-commits, ilya-biryukov.
Herald added a project: clang-tools-extra.

If LLVM is built with a compiler other than clang, the `compile_commands.json`
file may contain compiler flags unknown by clang.  When a clangd test is copied
into the build directory and checked, clangd will pick the unknown flag from
the file and cause a test failure.  Create an empty `compile_commands.json` in
the test directory nested in the build directory to override it.


Repository:
  rG LLVM Github Monorepo

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


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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits