diff --git a/clang-tools-extra/clangd/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp --- a/clang-tools-extra/clangd/Preamble.cpp +++ b/clang-tools-extra/clangd/Preamble.cpp @@ -706,6 +706,11 @@ // While extending the life of FileMgr and VFS, StatCache should also be // extended. Ctx->setStatCache(Result->StatCache); + // We have to setup DiagnosticConsumer that will be alife + // while preamble callback is executed + Ctx->getASTContext().getDiagnostics().setClient(new IgnoringDiagConsumer, + true); + PreambleCallback(std::move(*Ctx), Result->Pragmas); } return Result;