diff options
author | Sam McCall <sammccall@google.com> | 2019-10-23 11:11:18 +0200 |
---|---|---|
committer | Sam McCall <sammccall@google.com> | 2019-10-23 17:52:59 +0200 |
commit | 8bda5f20674df1765bce8f0866204dff93ed244c (patch) | |
tree | 7b9ae76bf5013a0e7b224e443ca14e823fa5171b /clang-tools-extra/clangd/ClangdLSPServer.h | |
parent | 60286818ff88d938233ad7c3e87a94761a4fef91 (diff) | |
download | bcm5719-llvm-8bda5f20674df1765bce8f0866204dff93ed244c.tar.gz bcm5719-llvm-8bda5f20674df1765bce8f0866204dff93ed244c.zip |
[clangd] abort if shutdown takes more than a minute.
Summary:
A certain class of bug (e.g. infloop on an AST worker thread) currently means
clangd never terminates, even if the editor shuts down the protocol and closes
our stdin, and the main thread recognizes that.
Instead, let's wait 60 seconds for threads to finish cleanly, and then crash
if they haven't.
(Obviously, we should still fix these bugs).
Reviewers: kadircet
Subscribers: MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits, ilya-biryukov
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69329
Diffstat (limited to 'clang-tools-extra/clangd/ClangdLSPServer.h')
-rw-r--r-- | clang-tools-extra/clangd/ClangdLSPServer.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h index dbd90064537..f1ed317f6ba 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.h +++ b/clang-tools-extra/clangd/ClangdLSPServer.h @@ -44,6 +44,7 @@ public: llvm::Optional<Path> CompileCommandsDir, bool UseDirBasedCDB, llvm::Optional<OffsetEncoding> ForcedOffsetEncoding, const ClangdServer::Options &Opts); + /// The destructor blocks on any outstanding background tasks. ~ClangdLSPServer(); /// Run LSP server loop, communicating with the Transport provided in the @@ -211,11 +212,10 @@ private: std::unique_ptr<GlobalCompilationDatabase> BaseCDB; // CDB is BaseCDB plus any comands overridden via LSP extensions. llvm::Optional<OverlayCDB> CDB; - // The ClangdServer is created by the "initialize" LSP method. - // It is destroyed before run() returns, to ensure worker threads exit. ClangdServer::Options ClangdServerOpts; - llvm::Optional<ClangdServer> Server; llvm::Optional<OffsetEncoding> NegotiatedOffsetEncoding; + // The ClangdServer is created by the "initialize" LSP method. + llvm::Optional<ClangdServer> Server; }; } // namespace clangd } // namespace clang |