Skip to content

[bazel] Add clangd as a library support #81556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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"],
features = ["layering_check"])

licenses(["notice"])

# TODO: Pick up other files for more complete functionality, to match
# clangd/CMakeLists.txt. This might look something like
# glob(["*.cpp", "dir/**/*.cpp", ...]).
cc_library(
name = "ClangDaemon",
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",
],
Comment on lines +15 to +42
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a # TODO comment.

includes = ["."],
deps = [
"//llvm:Support",
"//clang:basic",
"//clang:index",
],
)