* [gentoo-commits] gentoo-x86 commit in dev-libs/libclc/files: libclc-llvm-3.5-compat.patch
@ 2014-10-09 6:30 Patrick Lauer (patrick)
0 siblings, 0 replies; only message in thread
From: Patrick Lauer (patrick) @ 2014-10-09 6:30 UTC (permalink / raw
To: gentoo-commits
patrick 14/10/09 06:30:16
Added: libclc-llvm-3.5-compat.patch
Log:
Fix building with llvm-3.5 #523232
(Portage version: 2.2.14_rc1/cvs/Linux x86_64, unsigned Manifest commit)
Revision Changes Path
1.1 dev-libs/libclc/files/libclc-llvm-3.5-compat.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libclc/files/libclc-llvm-3.5-compat.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libclc/files/libclc-llvm-3.5-compat.patch?rev=1.1&content-type=text/plain
Index: libclc-llvm-3.5-compat.patch
===================================================================
diff -urpN libclc-0.0.1_pre20140101.orig/utils/prepare-builtins.cpp libclc-0.0.1_pre20140101/utils/prepare-builtins.cpp
--- libclc-0.0.1_pre20140101.orig/utils/prepare-builtins.cpp 2014-09-22 13:08:50.236934929 -0700
+++ libclc-0.0.1_pre20140101/utils/prepare-builtins.cpp 2014-09-22 13:12:43.164665140 -0700
@@ -1,4 +1,3 @@
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
@@ -7,11 +6,28 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Support/system_error.h"
+#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Config/config.h"
+#define LLVM_350_AND_NEWER \
+ (LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5))
+
+#if LLVM_350_AND_NEWER
+#include <system_error>
+
+#define ERROR_CODE std::error_code
+#define UNIQUE_PTR std::unique_ptr
+#else
+#include "llvm/ADT/OwningPtr.h"
+#include "llvm/Support/system_error.h"
+
+#define ERROR_CODE error_code
+#define UNIQUE_PTR OwningPtr
+#endif
+
using namespace llvm;
static cl::opt<std::string>
@@ -31,11 +47,26 @@ int main(int argc, char **argv) {
std::auto_ptr<Module> M;
{
- OwningPtr<MemoryBuffer> BufferPtr;
- if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
+#if LLVM_350_AND_NEWER
+ ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
+ MemoryBuffer::getFile(InputFilename);
+ std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();
+ if (std::error_code ec = BufferOrErr.getError())
+#else
+ UNIQUE_PTR<MemoryBuffer> BufferPtr;
+ if (ERROR_CODE ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
+#endif
ErrorMessage = ec.message();
- else
+ else {
+#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
+ ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
+ if (ERROR_CODE ec = ModuleOrErr.getError())
+ ErrorMessage = ec.message();
+ M.reset(ModuleOrErr.get());
+#else
M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
+#endif
+ }
}
if (M.get() == 0) {
@@ -65,10 +95,12 @@ int main(int argc, char **argv) {
}
std::string ErrorInfo;
- OwningPtr<tool_output_file> Out
+ UNIQUE_PTR<tool_output_file> Out
(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
-#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 3)
+#if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 4)
sys::fs::F_Binary));
+#elif LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5)
+ sys::fs::F_None));
#else
raw_fd_ostream::F_Binary));
#endif
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-10-09 6:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-09 6:30 [gentoo-commits] gentoo-x86 commit in dev-libs/libclc/files: libclc-llvm-3.5-compat.patch Patrick Lauer (patrick)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox