Skip to content

Commit

Permalink
Merging r366811, r366880, r366900, r366991 and r366992:
Browse files Browse the repository at this point in the history
------------------------------------------------------------------------
r366811 | sammccall | 2019-07-23 16:30:28 +0200 (Tue, 23 Jul 2019) | 9 lines

[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
------------------------------------------------------------------------

------------------------------------------------------------------------
r366880 | sammccall | 2019-07-24 11:33:27 +0200 (Wed, 24 Jul 2019) | 9 lines

[clangd] Reformat use of cl::opt: use unqualified name and don't bin-pack attributes. NFC

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65154
------------------------------------------------------------------------

------------------------------------------------------------------------
r366900 | sammccall | 2019-07-24 14:41:52 +0200 (Wed, 24 Jul 2019) | 16 lines

[clangd] Add categories to help options, and only show clangd options.

Summary:
Restricting the categories prevents extra unwanted options from creeping into
help (D60663), and removes a bunch of noise from --help-hidden.

While here, remove `static` from the opts in favor of an anon namespace, to
reduce the noise level.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65200
------------------------------------------------------------------------

------------------------------------------------------------------------
r366991 | sammccall | 2019-07-25 09:54:48 +0200 (Thu, 25 Jul 2019) | 13 lines

[clangd] Also accept flags from CLANGD_FLAGS variable.

This simplifies various workflows, particularly in debugging/development.
e.g. editors will tend to propagate flags, so you can run
`env CLANGD_FLAGS=-input-mirror-file=/tmp/mirror vim foo.cc` rather than
change the configuration in a persistent way.
(This also gives us a generic lever when we don't know how to customize
the flags in some particular LSP client).

While here, add a test for this and other startup logging, and fix a
couple of direct writes to errs() that should have been logs.

Differential Revision: https://reviews.llvm.org/D65153
------------------------------------------------------------------------

------------------------------------------------------------------------
r366992 | sammccall | 2019-07-25 10:00:54 +0200 (Thu, 25 Jul 2019) | 9 lines

[clangd] Provide help text to users who run `clangd` in a terminal.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65201
------------------------------------------------------------------------

llvm-svn: 367025
  • Loading branch information
zmodem committed Jul 25, 2019
1 parent 7b4b8dc commit cb4f353
Show file tree
Hide file tree
Showing 3 changed files with 341 additions and 215 deletions.
4 changes: 2 additions & 2 deletions clang-tools-extra/clangd/index/Serialization.cpp
Expand Up @@ -690,7 +690,7 @@ std::unique_ptr<SymbolIndex> loadIndex(llvm::StringRef SymbolFilename,
trace::Span OverallTracer("LoadIndex");
auto Buffer = llvm::MemoryBuffer::getFile(SymbolFilename);
if (!Buffer) {
llvm::errs() << "Can't open " << SymbolFilename << "\n";
elog("Can't open {0}", SymbolFilename);
return nullptr;
}

Expand All @@ -707,7 +707,7 @@ std::unique_ptr<SymbolIndex> loadIndex(llvm::StringRef SymbolFilename,
if (I->Relations)
Relations = std::move(*I->Relations);
} else {
llvm::errs() << "Bad Index: " << llvm::toString(I.takeError()) << "\n";
elog("Bad Index: {0}", I.takeError());
return nullptr;
}
}
Expand Down
9 changes: 9 additions & 0 deletions clang-tools-extra/clangd/test/log.test
@@ -0,0 +1,9 @@
# RUN: not env CLANGD_FLAGS=-index-file=no-such-index clangd -lit-test </dev/null 2>&1 >/dev/null | FileCheck %s
CHECK: I[{{.*}}] clangd version {{.*}}
CHECK: Working directory: {{.*}}
CHECK: argv[0]: clangd
CHECK: argv[1]: -lit-test
CHECK: CLANGD_FLAGS: -index-file=no-such-index
CHECK: E[{{.*}}] Can't open no-such-index
CHECK: Starting LSP over stdin/stdout

0 comments on commit cb4f353

Please sign in to comment.