From 87a2de4b22e141d37b796dce77a6daef243145eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= 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(errstream)); +#else Ctx.setDiagnosticHandler(llvm::make_unique(errstream)); +#endif // link bool failed = LLVMLinkModules2(Dest, Src); -- 2.27.0