From 7de2b4f6d4202cdd9f51b406cdc58a3195fb3ba4 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 14 Feb 2018 12:35:01 -0800 Subject: [PATCH] Fix API change for trunk LLVM --- src/LLVM_Output.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/LLVM_Output.cpp b/src/LLVM_Output.cpp index 33ef6410fd05..7d6223dbff75 100644 --- a/src/LLVM_Output.cpp +++ b/src/LLVM_Output.cpp @@ -323,7 +323,11 @@ std::unique_ptr clone_module(const llvm::Module &module_in) { // Write the module to a buffer. llvm::SmallVector clone_buffer; llvm::raw_svector_ostream clone_ostream(clone_buffer); +#if LLVM_VERSION >= 70 + WriteBitcodeToFile(module_in, clone_ostream); +#else WriteBitcodeToFile(&module_in, clone_ostream); +#endif // Read it back in. llvm::MemoryBufferRef buffer_ref(llvm::StringRef(clone_buffer.data(), clone_buffer.size()), "clone_buffer"); @@ -392,7 +396,11 @@ void compile_llvm_module_to_assembly(llvm::Module &module, Internal::LLVMOStream } void compile_llvm_module_to_llvm_bitcode(llvm::Module &module, Internal::LLVMOStream& out) { +#if LLVM_VERSION >= 70 + WriteBitcodeToFile(module, out); +#else WriteBitcodeToFile(&module, out); +#endif } void compile_llvm_module_to_llvm_assembly(llvm::Module &module, Internal::LLVMOStream& out) {