[clangd] Fix -compile-commands-dir flag, broken in r345031

llvm-svn: 345232
This commit is contained in:
Sam McCall 2018-10-25 02:22:53 +00:00
parent fd7d341b43
commit 4b86bb04fa
2 changed files with 4 additions and 2 deletions

View File

@ -303,7 +303,6 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
if (Server)
return Reply(make_error<LSPError>("server already initialized",
ErrorCode::InvalidRequest));
Optional<Path> CompileCommandsDir;
if (Params.initializationOptions)
CompileCommandsDir = Params.initializationOptions->compilationDatabasePath;
CDB.emplace(UseInMemoryCDB
@ -696,7 +695,9 @@ ClangdLSPServer::ClangdLSPServer(class Transport &Transp,
: Transp(Transp), MsgHandler(new MessageHandler(*this)), CCOpts(CCOpts),
SupportedSymbolKinds(defaultSymbolKinds()),
SupportedCompletionItemKinds(defaultCompletionItemKinds()),
UseInMemoryCDB(ShouldUseInMemoryCDB), ClangdServerOpts(Opts) {
UseInMemoryCDB(ShouldUseInMemoryCDB),
CompileCommandsDir(std::move(CompileCommandsDir)),
ClangdServerOpts(Opts) {
// clang-format off
MsgHandler->bind("initialize", &ClangdLSPServer::onInitialize);
MsgHandler->bind("shutdown", &ClangdLSPServer::onShutdown);

View File

@ -169,6 +169,7 @@ private:
// The CDB is created by the "initialize" LSP method.
bool UseInMemoryCDB; // FIXME: make this a capability.
llvm::Optional<Path> CompileCommandsDir; // FIXME: merge with capability?
llvm::Optional<CompilationDB> CDB;
// The ClangdServer is created by the "initialize" LSP method.
// It is destroyed before run() returns, to ensure worker threads exit.