summaryrefslogtreecommitdiff
blob: b6c4242e4459555a34ad368af6bf7d631739ccf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 87a2de4b22e141d37b796dce77a6daef243145eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Thu, 11 Jun 2020 09:22:32 +0200
Subject: [PATCH] Use std::make_unique on LLVM 10

LLVM 10 removes llvm::make_unique in favor of std::make_unique.
However, this requires C++14 and is therefore unsuitable for LLVM 9
that forces -std=c++11.  Update the code to use both conditionally.
This fixes all issues with LLVM 10.
---
 ffi/linker.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ffi/linker.cpp b/ffi/linker.cpp
index 57bb80b..585b261 100644
--- a/ffi/linker.cpp
+++ b/ffi/linker.cpp
@@ -42,7 +42,11 @@ LLVMPY_LinkModules(LLVMModuleRef Dest, LLVMModuleRef Src, const char **Err)
     auto OldDiagnosticHandler = Ctx.getDiagnosticHandler();
 
     // set the handler to a new one
+#if LLVM_VERSION_MAJOR >= 10
+    Ctx.setDiagnosticHandler(std::make_unique<ReportNotAbortDiagnosticHandler>(errstream));
+#else
     Ctx.setDiagnosticHandler(llvm::make_unique<ReportNotAbortDiagnosticHandler>(errstream));
+#endif
 
     // link
     bool failed = LLVMLinkModules2(Dest, Src);
-- 
2.27.0