[libclc] 271/291: prepare-builtins: Fix build with LLVM 3.7

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository libclc.

commit 403ad2544225091a3834fcf580b240339c373692
Author: Tom Stellard <thomas.stellard at amd.com>
Date:   Wed Jun 24 17:03:50 2015 +0000

    prepare-builtins: Fix build with LLVM 3.7
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@240552 91177308-0d34-0410-b5e6-96231b3b80d8
---
 utils/prepare-builtins.cpp | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp
index a3c3383..42bce75 100644
--- a/utils/prepare-builtins.cpp
+++ b/utils/prepare-builtins.cpp
@@ -14,6 +14,10 @@
 
 #include <system_error>
 
+#define LLVM_360 \
+  (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 6)
+
+
 using namespace llvm;
 
 static cl::opt<std::string>
@@ -30,7 +34,7 @@ int main(int argc, char **argv) {
   cl::ParseCommandLineOptions(argc, argv, "libclc builtin preparation tool\n");
 
   std::string ErrorMessage;
-  std::auto_ptr<Module> M;
+  Module *M;
 
   {
     ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
@@ -39,15 +43,24 @@ int main(int argc, char **argv) {
     if (std::error_code  ec = BufferOrErr.getError())
       ErrorMessage = ec.message();
     else {
-      ErrorOr<Module *> ModuleOrErr =
-	parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context);
+#if LLVM_360
+      ErrorOr<Module *>
+#else
+      ErrorOr<std::unique_ptr<Module>>
+#endif
+      ModuleOrErr =
+          parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context);
       if (std::error_code ec = ModuleOrErr.getError())
         ErrorMessage = ec.message();
-      M.reset(ModuleOrErr.get());
+#if LLVM_360
+      M = ModuleOrErr.get().get();
+#else
+      M = ModuleOrErr.get().release();
+#endif
     }
   }
 
-  if (M.get() == 0) {
+  if (!M) {
     errs() << argv[0] << ": ";
     if (ErrorMessage.size())
       errs() << ErrorMessage << "\n";
@@ -81,7 +94,7 @@ int main(int argc, char **argv) {
     exit(1);
   }
 
-  WriteBitcodeToFile(M.get(), Out->os());
+  WriteBitcodeToFile(M, Out->os());
 
   // Declare success.
   Out->keep();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list