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

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 18 02:08:52 PDT 2017


ilya-biryukov added a comment.

All lit test for clangd are currently failing if I apply your change.
Generally, please run `make check-clang-tools` to make sure your changes do not introduce any regressions.

The tests are failing because when `--compile-commands-dir` is not specified clangd now shows the cmd arg validation errors (`"path not absolute"`, `"path does not exist"`).



================
Comment at: clangd/tool/ClangdMain.cpp:78
+  if (!llvm::sys::path::is_absolute(CompileCommandsDir)) {
+    Out.log("Path specified by --compile-commands-dir must be an absolute "
+            "path. The argument will be ignored.\n");
----------------
The code doing command line argument validation shows errors using `llvm::errs()` and not `Out.log()`. Could you do the same for consistency?

Also, could you put your new code that does argument validation right after the previous checks (to line 65)? So that we have a clear structure in the code:
```
/// Validate command line arguments.
...

/// Initialize and run ClangdLSPServer.
...
```


https://reviews.llvm.org/D37150





More information about the cfe-commits mailing list