[clang-tools-extra] r366811 - [clangd] Log version, cwd, args, and transport on startup. NFC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 23 07:30:28 PDT 2019
Author: sammccall
Date: Tue Jul 23 07:30:28 2019
New Revision: 366811
URL: http://llvm.org/viewvc/llvm-project?rev=366811&view=rev
Log:
[clangd] Log version, cwd, args, and transport on startup. NFC
Reviewers: hokein
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65146
Modified:
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=366811&r1=366810&r2=366811&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Tue Jul 23 07:30:28 2019
@@ -423,6 +423,17 @@ int main(int argc, char *argv[]) {
llvm::errs().SetBuffered();
StreamLogger Logger(llvm::errs(), LogLevel);
LoggingSession LoggingSession(Logger);
+ // Write some initial logs before we start doing any real work.
+ log("{0}", clang::getClangToolFullVersion("clangd"));
+ {
+ SmallString<128> CWD;
+ if (auto Err = llvm::sys::fs::current_path(CWD))
+ log("Working directory unknown: {0}", Err.message());
+ else
+ log("Working directory: {0}", CWD);
+ }
+ for (int I = 0; I < argc; ++I)
+ log("argv[{0}]: {1}", I, argv[I]);
// If --compile-commands-dir arg was invoked, check value and override default
// path.
@@ -501,12 +512,14 @@ int main(int argc, char *argv[]) {
std::unique_ptr<Transport> TransportLayer;
if (getenv("CLANGD_AS_XPC_SERVICE")) {
#if CLANGD_BUILD_XPC
+ log("Starting LSP over XPC service");
TransportLayer = newXPCTransport();
#else
llvm::errs() << "This clangd binary wasn't built with XPC support.\n";
return (int)ErrorResultCode::CantRunAsXPCService;
#endif
} else {
+ log("Starting LSP over stdin/stdout");
TransportLayer = newJSONTransport(
stdin, llvm::outs(),
InputMirrorStream ? InputMirrorStream.getPointer() : nullptr,
More information about the cfe-commits
mailing list