[clang-tools-extra] Emit `BeginSourceFile` failure with `elog`. (PR #104845)
Michael Park via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 19 13:07:18 PDT 2024
https://github.com/mpark created https://github.com/llvm/llvm-project/pull/104845
There are 3 ways in which `ParseAST::build` can fail and return `std::nullopt`. 2 of the ways we emit the error message using `elog`, but for the 3rd way, `log` is used. We should emit all 3 of these reasons with `elog`.
>From 5e27ddec1ef275fe4401fa9f57827058610597f5 Mon Sep 17 00:00:00 2001
From: Michael Park <mcypark at gmail.com>
Date: Mon, 19 Aug 2024 13:00:02 -0700
Subject: [PATCH] Emit `BeginSourceFile` failure with `elog`.
There are 3 ways in which `ParseAST::build` can fail and return `std::nullopt`.
2 of the ways we emit the error message using `elog`, but for the 3rd way,
`log` is used. We should emit all 3 of these reasons with `elog`.
---
clang-tools-extra/clangd/ParsedAST.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang-tools-extra/clangd/ParsedAST.cpp b/clang-tools-extra/clangd/ParsedAST.cpp
index a2f1504db7e880..14440acd08b353 100644
--- a/clang-tools-extra/clangd/ParsedAST.cpp
+++ b/clang-tools-extra/clangd/ParsedAST.cpp
@@ -512,8 +512,8 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
auto Action = std::make_unique<ClangdFrontendAction>();
const FrontendInputFile &MainInput = Clang->getFrontendOpts().Inputs[0];
if (!Action->BeginSourceFile(*Clang, MainInput)) {
- log("BeginSourceFile() failed when building AST for {0}",
- MainInput.getFile());
+ elog("BeginSourceFile() failed when building AST for {0}",
+ MainInput.getFile());
return std::nullopt;
}
// If we saw an include guard in the preamble section of the main file,
More information about the cfe-commits
mailing list