0003_Add_library_for_clangd.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. From 2625e497fef1429f2041922a739d841050eda909 Mon Sep 17 00:00:00 2001
  2. From: maan2003 <manmeetmann2003@gmail.com>
  3. Date: Sat, 19 Aug 2023 02:32:03 +0530
  4. Subject: [PATCH] Add library for clangd
  5. This exports clangd language server protocol helpers publically.
  6. Feature.h needs Feature.inc which is generated during build process, so we
  7. disable all features for now.
  8. ---
  9. clang-tools-extra/clangd/BUILD.bazel | 36 +++++++++++++++++++++++++++
  10. clang-tools-extra/clangd/Protocol.cpp | 15 +++++++----
  11. clang-tools-extra/clangd/Protocol.h | 12 +++++++--
  12. clang-tools-extra/clangd/Transport.h | 1 -
  13. 4 files changed, 56 insertions(+), 8 deletions(-)
  14. create mode 100644 clang-tools-extra/clangd/BUILD.bazel
  15. diff --git a/clang-tools-extra/clangd/BUILD.bazel b/clang-tools-extra/clangd/BUILD.bazel
  16. new file mode 100644
  17. index 000000000..9f3f93f24
  18. --- /dev/null
  19. +++ b/clang-tools-extra/clangd/BUILD.bazel
  20. @@ -0,0 +1,39 @@
  21. +package(default_visibility = ["//visibility:public"])
  22. +
  23. +cc_library(
  24. + name = "clangd_library",
  25. + srcs = [
  26. + "JSONTransport.cpp",
  27. + "Protocol.cpp",
  28. + "URI.cpp",
  29. + "index/SymbolID.cpp",
  30. + "support/Logger.cpp",
  31. + "support/Trace.cpp",
  32. + "support/MemoryTree.cpp",
  33. + "support/Context.cpp",
  34. + "support/Cancellation.cpp",
  35. + "support/ThreadCrashReporter.cpp",
  36. + "support/Shutdown.cpp",
  37. + ],
  38. + hdrs = [
  39. + "Transport.h",
  40. + "Protocol.h",
  41. + "URI.h",
  42. + "LSPBinder.h",
  43. + "index/SymbolID.h",
  44. + "support/Function.h",
  45. + "support/Cancellation.h",
  46. + "support/ThreadCrashReporter.h",
  47. + "support/Logger.h",
  48. + "support/Trace.h",
  49. + "support/MemoryTree.h",
  50. + "support/Context.h",
  51. + "support/Shutdown.h",
  52. + ],
  53. + includes = ["."],
  54. + deps = [
  55. + "//llvm:Support",
  56. + "//clang:basic",
  57. + "//clang:index",
  58. + ],
  59. +)
  60. diff --git a/clang-tools-extra/clangd/Transport.h b/clang-tools-extra/clangd/Transport.h
  61. index 4e80ea95b..f17441cfc 100644
  62. --- a/clang-tools-extra/clangd/Transport.h
  63. +++ b/clang-tools-extra/clangd/Transport.h
  64. @@ -17,9 +17,8 @@
  65. #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRANSPORT_H
  66. #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRANSPORT_H
  67. -#include "Feature.h"
  68. #include "llvm/ADT/StringRef.h"
  69. #include "llvm/Support/JSON.h"
  70. #include "llvm/Support/raw_ostream.h"
  71. --
  72. 2.41.0