[PATCH] D104056: [clangd][nfc] Show more information in logs when compiler instance prepare fails
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 29 08:30:24 PDT 2021
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.
Thanks, LGTM
Sorry about the delay - we got sidetracked into some ideas about whether these errors should actually be surfaced to the user as diagnostics instead. But that shouldn't block this patch.
================
Comment at: clang-tools-extra/clangd/ParsedAST.cpp:296
+ elog("Failed to prepare a compiler instance: {0}",
+ ASTDiags.getNumErrors()
+ ? static_cast<DiagBase &>(ASTDiags.take().back()).Message
----------------
there's a bunch of logic that determines which diags we actually end up storing.
I'd suggest always calling take() and testing whether the result is empty, rather than using getNumErrors() which bypasses all our logic.
Luckily, we do (always?) end up storing the relevant diags here, assuming they're errors without a source location attached.
However I don't think we should hard-code that assumption here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104056/new/
https://reviews.llvm.org/D104056
More information about the cfe-commits
mailing list