[clang-tools-extra] [llvm] Add bazel support for clangd as a library. (PR #81556)

Jordan Rupprecht via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 14:10:43 PDT 2024


================
@@ -0,0 +1,45 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+cc_library(
+    name = "clangd_library",
+    srcs = [
+        "JSONTransport.cpp",
+        "Protocol.cpp",
+        "URI.cpp",
+        "index/SymbolID.cpp",
+        "support/Logger.cpp",
+        "support/Trace.cpp",
+        "support/MemoryTree.cpp",
+        "support/Context.cpp",
+        "support/Cancellation.cpp",
+        "support/ThreadCrashReporter.cpp",
+        "support/Shutdown.cpp",
+    ],
+    hdrs = [
+        "Transport.h",
+        "Protocol.h",
+        "URI.h",
+        "LSPBinder.h",
+        "index/SymbolID.h",
+        "support/Function.h",
+        "support/Cancellation.h",
+        "support/ThreadCrashReporter.h",
+        "support/Logger.h",
+        "support/Trace.h",
+        "support/MemoryTree.h",
+        "support/Context.h",
+        "support/Shutdown.h",
+    ],
----------------
rupprecht wrote:

clangd/CMakeLists.txt lists many other files needed by the clangDaemon target.

I think this is totally fine to submit as-is, as maybe this is the minimal set of files that one needs for basic clangd functionality, but we should probably have a TODO to pick up other files (e.g. `glob(["*.cpp", "dir/**/*.cpp", ...])`) for more complete functionality. (I'm not a clangd expert, so I'm not sure what the implication of leaving out all those other files is).

https://github.com/llvm/llvm-project/pull/81556


More information about the cfe-commits mailing list