From 12d0cb20377218c1a2f7b077057a5ca31c5befda Mon Sep 17 00:00:00 2001 From: Vsevolod Livinskiy Date: Tue, 26 Aug 2014 10:56:23 +0400 Subject: [PATCH] Fix for llvm revision 216393 --- cbackend.cpp | 10 ++++++++++ module.cpp | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/cbackend.cpp b/cbackend.cpp index 867385a4..5de99366 100644 --- a/cbackend.cpp +++ b/cbackend.cpp @@ -4945,9 +4945,19 @@ WriteCXXFile(llvm::Module *module, const char *fn, int vectorWidth, llvm::sys::fs::OpenFlags flags = llvm::sys::fs::F_None; #endif +#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) std::string error; +#else // LLVM 3.6+ + std::error_code error; +#endif + llvm::tool_output_file *of = new llvm::tool_output_file(fn, error, flags); + +#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) if (error.size()) { +#else // LLVM 3.6+ + if (error) { +#endif fprintf(stderr, "Error opening output file \"%s\".\n", fn); return false; } diff --git a/module.cpp b/module.cpp index a60a1490..be3b5fab 100644 --- a/module.cpp +++ b/module.cpp @@ -1088,9 +1088,20 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine, #endif +#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) std::string error; +#else // LLVM 3.6+ + std::error_code error; +#endif + llvm::tool_output_file *of = new llvm::tool_output_file(outFileName, error, flags); + +#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) if (error.size()) { +#else // LLVM 3.6+ + if (error) { +#endif + fprintf(stderr, "Error opening output file \"%s\".\n", outFileName); return false; }