[clang-tools-extra] Emit `BeginSourceFile` failure with `elog`. (PR #104845)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 19 13:07:47 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Michael Park (mpark)

<details>
<summary>Changes</summary>

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`.

---
Full diff: https://github.com/llvm/llvm-project/pull/104845.diff


1 Files Affected:

- (modified) clang-tools-extra/clangd/ParsedAST.cpp (+2-2) 


``````````diff
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,

``````````

</details>


https://github.com/llvm/llvm-project/pull/104845


More information about the cfe-commits mailing list