[clang-tools-extra] [llvm] Add bazel support for clangd as a library. (PR #81556)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 12 16:10:12 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangd
Author: None (josh11b)
<details>
<summary>Changes</summary>
Both creates a `BUILD.bazel` file for the `clangd` directory in the project overlay, and removes an unnecessary `#include "Feature.h"` to reduce the dependencies from `Transport.h`.
This upstreams the patch that allows https://github.com/carbon-language/carbon-lang/tree/trunk/language_server to use `clangd` as a library. This was created as part of a Summer of Code project building a prototype Carbon language server. If this is not an appropriate architecture, I'm very open to alternative paths forward.
Thanks!
---
Full diff: https://github.com/llvm/llvm-project/pull/81556.diff
2 Files Affected:
- (modified) clang-tools-extra/clangd/Transport.h (-1)
- (added) utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel (+45)
``````````diff
diff --git a/clang-tools-extra/clangd/Transport.h b/clang-tools-extra/clangd/Transport.h
index 4e80ea95b8537d..f17441cfc1ef22 100644
--- a/clang-tools-extra/clangd/Transport.h
+++ b/clang-tools-extra/clangd/Transport.h
@@ -18,7 +18,6 @@
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRANSPORT_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRANSPORT_H
-#include "Feature.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel
new file mode 100644
index 00000000000000..0e25dd1c166560
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel
@@ -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",
+ ],
+ includes = ["."],
+ deps = [
+ "//llvm:Support",
+ "//clang:basic",
+ "//clang:index",
+ ],
+)
``````````
</details>
https://github.com/llvm/llvm-project/pull/81556
More information about the cfe-commits
mailing list