[Libclc-dev] [PATCH libclc 2/2] Fix build against LLVM SVN >= r216488

Michel Dänzer michel at daenzer.net
Tue Aug 26 20:14:33 PDT 2014


From: Michel Dänzer <michel.daenzer at amd.com>

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 utils/prepare-builtins.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp
index 0f3147c..3ea232b 100644
--- a/utils/prepare-builtins.cpp
+++ b/utils/prepare-builtins.cpp
@@ -53,7 +53,11 @@ int main(int argc, char **argv) {
 #if LLVM_350_AND_NEWER
     ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
       MemoryBuffer::getFile(InputFilename);
+# if LLVM_360_AND_NEWER
+    MemoryBufferRef BufferRef = BufferOrErr.get()->getMemBufferRef();
+# else
     std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();
+# endif
     if (std::error_code  ec = BufferOrErr.getError())
 #else
     UNIQUE_PTR<MemoryBuffer> BufferPtr;
@@ -62,7 +66,11 @@ int main(int argc, char **argv) {
       ErrorMessage = ec.message();
     else {
 #if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
+# if LLVM_360_AND_NEWER
+      ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferRef, Context);
+# else
       ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
+#endif
       if (ERROR_CODE ec = ModuleOrErr.getError())
         ErrorMessage = ec.message();
       M.reset(ModuleOrErr.get());
-- 
2.1.0





More information about the Libclc-dev mailing list