annobin/0001-Compatibility-patch-for-llvm14.patch
2022-03-30 21:33:03 +02:00

43 lines
1.4 KiB
Diff

From f278b500124ee9d49cb990f6a0333b28794fddb1 Mon Sep 17 00:00:00 2001
From: sergesanspaille <sguelton@redhat.com>
Date: Wed, 30 Mar 2022 16:07:17 +0200
Subject: [PATCH] Compatibility patch for llvm14
---
llvm-plugin/annobin.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/llvm-plugin/annobin.cpp b/llvm-plugin/annobin.cpp
index a119ab9..6a43580 100644
--- a/llvm-plugin/annobin.cpp
+++ b/llvm-plugin/annobin.cpp
@@ -484,9 +484,14 @@ namespace
struct AnnobinModulePass : llvm::PassInfoMixin<AnnobinModulePass>
{
- llvm::PassBuilder::OptimizationLevel OptLevel;
+#if __clang_major__ > 13
+ using OptimizationLevel = llvm::OptimizationLevel;
+#else
+ using OptimizationLevel = llvm::PassBuilder::OptimizationLevel;
+#endif
+ OptimizationLevel OptLevel;
- AnnobinModulePass(llvm::PassBuilder::OptimizationLevel OptLevel) : OptLevel(OptLevel) {}
+ AnnobinModulePass(OptimizationLevel OptLevel) : OptLevel(OptLevel) {}
llvm::PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
{
AnnobinModule Annobin;
@@ -505,7 +510,7 @@ llvm::PassPluginLibraryInfo getAnnobinLLVMPluginInfo ()
{
PB.registerPipelineStartEPCallback
([](llvm::ModulePassManager &PM,
- llvm::PassBuilder::OptimizationLevel Level)
+ AnnobinModulePass::OptimizationLevel Level)
{
PM.addPass(AnnobinModulePass(Level));
});
--
1.8.3.1