HomePhabricator

[clangd][nfc] Show more information in logs when compiler instance prepare fails

Authored by ArcsinX on Jun 30 2021, 1:40 PM.

Description

[clangd][nfc] Show more information in logs when compiler instance prepare fails

Without this patch clangd silently process compiler instance prepare failure and only LSP errors "Invalid AST" could be found in logs.
E.g. the reason of the problem https://github.com/clangd/clangd/issues/734 is impossible to understand without verbose logs or with disabled background index.
This patch adds more information into logs to help understand the reason of such failures.

Logs without this patch:

E[...] Could not build a preamble for file test.cpp version 1

Logs with this patch:

E[...] Could not build a preamble for file test.cpp version 1: CreateTargetInfo() return null
..
E[...] Failed to prepare a compiler instance: unknown target ABI 'lp64'

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D104056