compiler: Updates for LLVM/Clang 20 API changes.

This commit is contained in:
Alex Rønne Petersen
2025-02-05 11:41:39 +01:00
parent 156ab87500
commit 8ea2e1ded5
8 changed files with 151 additions and 28 deletions

View File

@@ -300,7 +300,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
pass_builder.registerLoopAnalyses(loop_am);
pass_builder.crossRegisterProxies(loop_am, function_am, cgscc_am, module_am);
pass_builder.registerPipelineStartEPCallback([&](ModulePassManager &module_pm, OptimizationLevel OL) {
pass_builder.registerPipelineStartEPCallback([&](ModulePassManager &module_pm, OptimizationLevel level) {
// Verify the input
if (assertions_on) {
module_pm.addPass(VerifierPass());
@@ -313,7 +313,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
const bool early_san = options->is_debug;
pass_builder.registerOptimizerEarlyEPCallback([&](ModulePassManager &module_pm, OptimizationLevel OL) {
pass_builder.registerOptimizerEarlyEPCallback([&](ModulePassManager &module_pm, OptimizationLevel level, ThinOrFullLTOPhase lto_phase) {
if (early_san) {
// Code coverage instrumentation.
if (options->sancov) {
@@ -328,7 +328,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
}
});
pass_builder.registerOptimizerLastEPCallback([&](ModulePassManager &module_pm, OptimizationLevel level) {
pass_builder.registerOptimizerLastEPCallback([&](ModulePassManager &module_pm, OptimizationLevel level, ThinOrFullLTOPhase lto_phase) {
if (!early_san) {
// Code coverage instrumentation.
if (options->sancov) {
@@ -360,7 +360,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
// Initialize the PassManager
if (opt_level == OptimizationLevel::O0) {
module_pm = pass_builder.buildO0DefaultPipeline(opt_level, options->lto);
module_pm = pass_builder.buildO0DefaultPipeline(opt_level, static_cast<ThinOrFullLTOPhase>(options->lto));
} else if (options->lto) {
module_pm = pass_builder.buildLTOPreLinkDefaultPipeline(opt_level);
} else {