[PATCH] D48071: [clangd] Add an option controlling caching of compile commands.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 12 23:29:12 PDT 2018


sammccall added a comment.

Generally LG.
I guess you might be able to test this by starting with a/compile_flags.txt and a/b/x.cc, and then adding a/b/compile_flags.txt?



================
Comment at: clangd/ClangdLSPServer.h:38
                   llvm::Optional<Path> CompileCommandsDir,
-                  const ClangdServer::Options &Opts);
+                  const ClangdServer::Options &Opts, bool CacheCompileCommands);
 
----------------
(the options split looks a little odd from the outside. One could make an argument for inheriting ClangdLSPServer::Options from ClangdServer::Options and adding the compile-commands/code completion options there. No need to restructure anything in this patch though)


================
Comment at: clangd/ClangdLSPServer.h:105
+  // Can be null if no caching was requested.
+  std::unique_ptr<CachingCompilationDb> CachedCDB;
 
----------------
nit: any reason for unique_ptr over optional?
(With optional, I think it's clear enough to remove the comment)


================
Comment at: clangd/tool/ClangdMain.cpp:141
+                   "come from the compilation databases."),
+    llvm::cl::init(false), llvm::cl::Hidden);
+
----------------
init(true) to avoid changing behavior?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D48071





More information about the cfe-commits mailing list