[clangd] Explicitly fail if the file passed to --check is not valid.

Differential Revision: https://reviews.llvm.org/D104455
This commit is contained in:
Haojian Wu
2021-06-17 14:33:24 +02:00
parent 60a8edf30d
commit 6765b9c3f1

View File

@@ -909,7 +909,11 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
if (CheckFile.getNumOccurrences()) {
llvm::SmallString<256> Path;
llvm::sys::fs::real_path(CheckFile, Path, /*expand_tilde=*/true);
if (auto Error =
llvm::sys::fs::real_path(CheckFile, Path, /*expand_tilde=*/true)) {
elog("Failed to resolve path {0}: {1}", CheckFile, Error.message());
return 1;
}
log("Entering check mode (no LSP server)");
uint32_t Begin = 0, End = std::numeric_limits<uint32_t>::max();
if (!CheckFileLines.empty()) {