[clang-tools-extra] r303616 - [clangd] Split clangd into library+executable (mainly for unit tests).

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Tue May 23 01:12:45 PDT 2017


Author: ibiryukov
Date: Tue May 23 03:12:45 2017
New Revision: 303616

URL: http://llvm.org/viewvc/llvm-project?rev=303616&view=rev
Log:
[clangd] Split clangd into library+executable (mainly for unit tests).

Summary:
This commit itself doesn't add any unit tests, but one that does will
follow shortly.

Reviewers: krasimir, bkramer

Reviewed By: bkramer

Subscribers: mgorny, klimek, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D33395

Added:
    clang-tools-extra/trunk/clangd/tool/
    clang-tools-extra/trunk/clangd/tool/CMakeLists.txt
      - copied, changed from r303554, clang-tools-extra/trunk/clangd/CMakeLists.txt
    clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
      - copied, changed from r303554, clang-tools-extra/trunk/clangd/ClangdMain.cpp
Removed:
    clang-tools-extra/trunk/clangd/ClangdMain.cpp
Modified:
    clang-tools-extra/trunk/clangd/CMakeLists.txt

Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=303616&r1=303615&r2=303616&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clangd/CMakeLists.txt Tue May 23 03:12:45 2017
@@ -1,6 +1,5 @@
-add_clang_executable(clangd
+add_clang_library(clangDaemon
   ClangdLSPServer.cpp
-  ClangdMain.cpp
   ClangdServer.cpp
   ClangdUnit.cpp
   ClangdUnitStore.cpp
@@ -11,9 +10,7 @@ add_clang_executable(clangd
   ProtocolHandlers.cpp
   )
 
-install(TARGETS clangd RUNTIME DESTINATION bin)
-
-target_link_libraries(clangd
+target_link_libraries(clangDaemon
   clangBasic
   clangFormat
   clangFrontend
@@ -22,3 +19,5 @@ target_link_libraries(clangd
   clangToolingCore
   LLVMSupport
   )
+
+add_subdirectory(tool)

Removed: clang-tools-extra/trunk/clangd/ClangdMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdMain.cpp?rev=303615&view=auto
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdMain.cpp (removed)
@@ -1,40 +0,0 @@
-//===--- ClangdMain.cpp - clangd server loop ------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "ClangdLSPServer.h"
-#include "JSONRPCDispatcher.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Program.h"
-
-#include <iostream>
-#include <memory>
-#include <string>
-
-using namespace clang;
-using namespace clang::clangd;
-
-static llvm::cl::opt<bool>
-    RunSynchronously("run-synchronously",
-                     llvm::cl::desc("parse on main thread"),
-                     llvm::cl::init(false), llvm::cl::Hidden);
-
-int main(int argc, char *argv[]) {
-  llvm::cl::ParseCommandLineOptions(argc, argv, "clangd");
-
-  llvm::raw_ostream &Outs = llvm::outs();
-  llvm::raw_ostream &Logs = llvm::errs();
-  JSONOutput Out(Outs, Logs);
-
-  // Change stdin to binary to not lose \r\n on windows.
-  llvm::sys::ChangeStdinToBinary();
-
-  ClangdLSPServer LSPServer(Out, RunSynchronously);
-  LSPServer.run(std::cin);
-}

Copied: clang-tools-extra/trunk/clangd/tool/CMakeLists.txt (from r303554, clang-tools-extra/trunk/clangd/CMakeLists.txt)
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/CMakeLists.txt?p2=clang-tools-extra/trunk/clangd/tool/CMakeLists.txt&p1=clang-tools-extra/trunk/clangd/CMakeLists.txt&r1=303554&r2=303616&rev=303616&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clangd/tool/CMakeLists.txt Tue May 23 03:12:45 2017
@@ -1,20 +1,14 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
 add_clang_executable(clangd
-  ClangdLSPServer.cpp
   ClangdMain.cpp
-  ClangdServer.cpp
-  ClangdUnit.cpp
-  ClangdUnitStore.cpp
-  DraftStore.cpp
-  GlobalCompilationDatabase.cpp
-  JSONRPCDispatcher.cpp
-  Protocol.cpp
-  ProtocolHandlers.cpp
   )
 
 install(TARGETS clangd RUNTIME DESTINATION bin)
 
 target_link_libraries(clangd
   clangBasic
+  clangDaemon
   clangFormat
   clangFrontend
   clangSema

Copied: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (from r303554, clang-tools-extra/trunk/clangd/ClangdMain.cpp)
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?p2=clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp&p1=clang-tools-extra/trunk/clangd/ClangdMain.cpp&r1=303554&r2=303616&rev=303616&view=diff
==============================================================================
    (empty)




More information about the cfe-commits mailing list