[clangd] Improve output of --help and --version. NFC.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 335972
This commit is contained in:
Sam McCall 2018-06-29 13:24:20 +00:00
parent d43114f880
commit e72d097009
1 changed files with 11 additions and 1 deletions

View File

@ -18,6 +18,7 @@
#include "llvm/Support/Program.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"
#include "clang/Basic/Version.h"
#include <cstdlib>
#include <iostream>
#include <memory>
@ -153,7 +154,16 @@ static llvm::cl::opt<Path> YamlSymbolFile(
int main(int argc, char *argv[]) {
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
llvm::cl::ParseCommandLineOptions(argc, argv, "clangd");
llvm::cl::SetVersionPrinter([](llvm::raw_ostream &OS) {
OS << clang::getClangToolFullVersion("clangd") << "\n";
});
llvm::cl::ParseCommandLineOptions(
argc, argv,
"clangd is a language server that provides IDE-like features to editors. "
"\n\nIt should be used via an editor plugin rather than invoked directly."
"For more information, see:"
"\n\thttps://clang.llvm.org/extra/clangd.html"
"\n\thttps://microsoft.github.io/language-server-protocol/");
if (Test) {
RunSynchronously = true;
InputStyle = JSONStreamStyle::Delimited;