[PATCH] D37150: [clangd] Command line arg to specify compile_commands.json path

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 30 03:21:50 PDT 2017


krasimir added inline comments.


================
Comment at: clangd/GlobalCompilationDatabase.cpp:89
+  // if --compileCommands arg was invoked, check value and override default path
+  std::size_t found = CompileCommands.find_first_of("/");
+  std::string TempString = CompileCommands;
----------------
ilya-biryukov wrote:
> Please check command arguments for validity in `main()`. 
> What is the purpose of `find_first_of("/")`? Checking for absolute paths? If yes, you could use `llvm::sys::path::is_absolute`.
Please make `CompileCommands` a member variable and pass it through the constructor of `DirectoryBasedGlobalCompilationDatabase`. This is more flexible and, among other things, allows for easier unit testing.


================
Comment at: clangd/GlobalCompilationDatabase.cpp:94
+     File = TempString;
+  }
+
----------------
LLVM style uses no braces for single statement `if`'s.


https://reviews.llvm.org/D37150





More information about the cfe-commits mailing list