From 00b9cefacbdf0ac764576c52fad6177aea2ed6b8 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Thu, 1 Dec 2022 11:34:02 +0100 Subject: [PATCH] [clangd] Log diagnostics if we failed to create a preamble. Really we want these to be shown to the client, but the path to do so involves storing them in Bandaid for https://github.com/clangd/clangd/issues/1408 See https://github.com/clangd/clangd/issues/1399 for motivation Differential Revision: https://reviews.llvm.org/D139088 --- clang-tools-extra/clangd/Preamble.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/clang-tools-extra/clangd/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp index 337f71b..d2b9189 100644 --- a/clang-tools-extra/clangd/Preamble.cpp +++ b/clang-tools-extra/clangd/Preamble.cpp @@ -571,6 +571,12 @@ buildPreamble(PathRef FileName, CompilerInvocation CI, elog("Could not build a preamble for file {0} version {1}: {2}", FileName, Inputs.Version, BuiltPreamble.getError().message()); + for (const Diag &D : PreambleDiagnostics.take()) { + if (D.Severity < DiagnosticsEngine::Error) + continue; + // Not an ideal way to show errors, but better than nothing! + elog(" error: {0}", D.Message); + } return nullptr; } -- 2.7.4