[clang-tools-extra] 6765b9c - [clangd] Explicitly fail if the file passed to --check is not valid.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 17 07:41:18 PDT 2021
Author: Haojian Wu
Date: 2021-06-17T16:41:06+02:00
New Revision: 6765b9c3f1192bd63bdcafc92ee8ff5d7b97d90b
URL: https://github.com/llvm/llvm-project/commit/6765b9c3f1192bd63bdcafc92ee8ff5d7b97d90b
DIFF: https://github.com/llvm/llvm-project/commit/6765b9c3f1192bd63bdcafc92ee8ff5d7b97d90b.diff
LOG: [clangd] Explicitly fail if the file passed to --check is not valid.
Differential Revision: https://reviews.llvm.org/D104455
Added:
Modified:
clang-tools-extra/clangd/tool/ClangdMain.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 0f9e5c89e42c8..6d70a9cf03f6e 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -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()) {
More information about the cfe-commits
mailing list