ivanmurashko updated this revision to Diff 535144. ivanmurashko added a comment.
small fixes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145302/new/ https://reviews.llvm.org/D145302 Files: clang-tools-extra/clangd/tool/CMakeLists.txt clang-tools-extra/clangd/tool/ClangdMain.cpp clang-tools-extra/clangd/tool/ClangdMain.h clang-tools-extra/clangd/tool/ClangdToolMain.cpp
Index: clang-tools-extra/clangd/tool/ClangdToolMain.cpp =================================================================== --- /dev/null +++ clang-tools-extra/clangd/tool/ClangdToolMain.cpp @@ -0,0 +1,13 @@ +//===--- ClangdToolMain.cpp - clangd main function ------------------------===// +// +// Part of the LLVM Project, 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 +// +//===----------------------------------------------------------------------===// + +#include "ClangdMain.h" + +int main(int argc, char **argv) { + return clang::clangd::clangdMain(argc, argv); +} Index: clang-tools-extra/clangd/tool/ClangdMain.h =================================================================== --- /dev/null +++ clang-tools-extra/clangd/tool/ClangdMain.h @@ -0,0 +1,19 @@ +//===--- ClangdMain.h - clangd main function ------------------------===// +// +// Part of the LLVM Project, 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_TOOL_CLANGDMAIN_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_TOOL_CLANGDMAIN_H + +namespace clang { +namespace clangd { +// clangd main function (clangd server loop) +int clangdMain(int argc, char *argv[]); +} // namespace clangd +} // namespace clang + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_TOOL_CLANGDMAIN_H Index: clang-tools-extra/clangd/tool/ClangdMain.cpp =================================================================== --- clang-tools-extra/clangd/tool/ClangdMain.cpp +++ clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "ClangdMain.h" #include "ClangdLSPServer.h" #include "CodeComplete.h" #include "Compiler.h" @@ -710,8 +711,6 @@ } }; } // namespace -} // namespace clangd -} // namespace clang enum class ErrorResultCode : int { NoShutdownRequest = 1, @@ -719,10 +718,7 @@ CheckFailed = 3 }; -int main(int argc, char *argv[]) { - using namespace clang; - using namespace clang::clangd; - +int clangdMain(int argc, char *argv[]) { llvm::InitializeAllTargetInfos(); llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); llvm::sys::AddSignalHandler( @@ -1041,3 +1037,6 @@ return ExitCode; } + +} // namespace clangd +} // namespace clang Index: clang-tools-extra/clangd/tool/CMakeLists.txt =================================================================== --- clang-tools-extra/clangd/tool/CMakeLists.txt +++ clang-tools-extra/clangd/tool/CMakeLists.txt @@ -1,9 +1,16 @@ -add_clang_tool(clangd +# Needed by LLVM's CMake checks because this file defines multiple targets. +set(LLVM_OPTIONAL_SOURCES ClangdToolMain.cpp) + +add_clang_library(clangdMain ClangdMain.cpp Check.cpp $<TARGET_OBJECTS:obj.clangDaemonTweaks> ) +add_clang_tool(clangd + ClangdToolMain.cpp + ) + set(LLVM_LINK_COMPONENTS support ) @@ -13,7 +20,7 @@ list(APPEND CLANGD_XPC_LIBS "clangdXpcJsonConversions" "clangdXpcTransport") endif() -clang_target_link_libraries(clangd +clang_target_link_libraries(clangdMain PRIVATE clangAST clangBasic @@ -25,14 +32,14 @@ clangToolingCore clangToolingRefactoring clangToolingSyntax - ) - -target_link_libraries(clangd - PRIVATE clangTidy - clangDaemon clangdRemoteIndex clangdSupport ${CLANGD_XPC_LIBS} ) + +clang_target_link_libraries(clangd + PRIVATE + clangdMain + )
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits