clc: fix DiagnosticOptions related build failure with llvm-21

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13257
Cc: mesa-stable
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35399>
This commit is contained in:
Karol Herbst
2025-06-07 10:13:06 +02:00
parent 392ad203eb
commit a482ec7f05
+9 -3
View File
@@ -804,11 +804,17 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
c->addDependencyCollector(dep);
}
#if LLVM_VERSION_MAJOR >= 21
auto diag_opts = c->getDiagnosticOpts();
#else
auto diag_opts = &c->getDiagnosticOpts();
#endif
clang::DiagnosticsEngine diag {
new clang::DiagnosticIDs,
new clang::DiagnosticOptions,
diag_opts,
new clang::TextDiagnosticPrinter(diag_log_stream,
&c->getDiagnosticOpts())
diag_opts)
};
#if LLVM_VERSION_MAJOR >= 17
@@ -865,7 +871,7 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
#endif
new clang::TextDiagnosticPrinter(
diag_log_stream,
&c->getDiagnosticOpts()));
diag_opts));
c->setTarget(clang::TargetInfo::CreateTargetInfo(
#if LLVM_VERSION_MAJOR >= 21