This revision was automatically updated to reflect the committed changes. Closed by commit rL303616: [clangd] Split clangd into library+executable (mainly for unit tests). (authored by ibiryukov).
Changed prior to commit: https://reviews.llvm.org/D33395?vs=99774&id=99858#toc Repository: rL LLVM https://reviews.llvm.org/D33395 Files: clang-tools-extra/trunk/clangd/CMakeLists.txt clang-tools-extra/trunk/clangd/ClangdMain.cpp clang-tools-extra/trunk/clangd/tool/CMakeLists.txt clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp =================================================================== --- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp +++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp @@ -0,0 +1,40 @@ +//===--- 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); +} Index: clang-tools-extra/trunk/clangd/tool/CMakeLists.txt =================================================================== --- clang-tools-extra/trunk/clangd/tool/CMakeLists.txt +++ clang-tools-extra/trunk/clangd/tool/CMakeLists.txt @@ -0,0 +1,18 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +add_clang_executable(clangd + ClangdMain.cpp + ) + +install(TARGETS clangd RUNTIME DESTINATION bin) + +target_link_libraries(clangd + clangBasic + clangDaemon + clangFormat + clangFrontend + clangSema + clangTooling + clangToolingCore + LLVMSupport + ) Index: clang-tools-extra/trunk/clangd/CMakeLists.txt =================================================================== --- clang-tools-extra/trunk/clangd/CMakeLists.txt +++ clang-tools-extra/trunk/clangd/CMakeLists.txt @@ -1,6 +1,5 @@ -add_clang_executable(clangd +add_clang_library(clangDaemon ClangdLSPServer.cpp - ClangdMain.cpp ClangdServer.cpp ClangdUnit.cpp ClangdUnitStore.cpp @@ -11,14 +10,14 @@ ProtocolHandlers.cpp ) -install(TARGETS clangd RUNTIME DESTINATION bin) - -target_link_libraries(clangd +target_link_libraries(clangDaemon clangBasic clangFormat clangFrontend clangSema clangTooling clangToolingCore LLVMSupport ) + +add_subdirectory(tool) Index: clang-tools-extra/trunk/clangd/ClangdMain.cpp =================================================================== --- clang-tools-extra/trunk/clangd/ClangdMain.cpp +++ clang-tools-extra/trunk/clangd/ClangdMain.cpp @@ -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); -}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits