[PATCH] D65146: [clangd] Log version, cwd, args, and transport on startup. NFC
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 23 07:13:15 PDT 2019
sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D65146
Files:
clang-tools-extra/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -423,6 +423,20 @@
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);
+ }
+ {
+ std::string LoggableArgs;
+ 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 +515,14 @@
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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65146.211295.patch
Type: text/x-patch
Size: 1463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190723/b2074463/attachment.bin>
More information about the cfe-commits
mailing list