fix(FTBFS): clc: adapt to new LLVM 19 DiagnosticHandlerTy

LLVM 19 changed DiagnosticHandlerTy. Adapt to that.

Reference: 44d037cc25
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10928
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28520>
This commit is contained in:
Kai Wasserbäch 2024-04-02 10:49:54 +02:00 committed by Marge Bot
parent 1b6c9a8f68
commit 1c3cce2fff
1 changed files with 8 additions and 0 deletions

View File

@ -91,13 +91,21 @@ static void
clc_dump_llvm(const llvm::Module *mod, FILE *f);
static void
#if LLVM_VERSION_MAJOR >= 19
llvm_log_handler(const ::llvm::DiagnosticInfo *di, void *data) {
#else
llvm_log_handler(const ::llvm::DiagnosticInfo &di, void *data) {
#endif
const clc_logger *logger = static_cast<clc_logger *>(data);
std::string log;
raw_string_ostream os { log };
::llvm::DiagnosticPrinterRawOStream printer { os };
#if LLVM_VERSION_MAJOR >= 19
di->print(printer);
#else
di.print(printer);
#endif
clc_error(logger, "%s", log.c_str());
}