[clang-tools-extra] r345232 - [clangd] Fix -compile-commands-dir flag, broken in r345031

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 24 19:22:53 PDT 2018


Author: sammccall
Date: Wed Oct 24 19:22:53 2018
New Revision: 345232

URL: http://llvm.org/viewvc/llvm-project?rev=345232&view=rev
Log:
[clangd] Fix -compile-commands-dir flag, broken in r345031

Modified:
    clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
    clang-tools-extra/trunk/clangd/ClangdLSPServer.h

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=345232&r1=345231&r2=345232&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Wed Oct 24 19:22:53 2018
@@ -303,7 +303,6 @@ void ClangdLSPServer::onInitialize(const
   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 T
     : 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);

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.h?rev=345232&r1=345231&r2=345232&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h Wed Oct 24 19:22:53 2018
@@ -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.




More information about the cfe-commits mailing list