swr/rast: fix MemoryBuffer build break for llvm-6
authorTim Rowley <timothy.o.rowley@intel.com>
Tue, 2 Jan 2018 16:48:21 +0000 (10:48 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Wed, 3 Jan 2018 17:42:00 +0000 (11:42 -0600)
LLVM api change.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104381
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Reviewed-By: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp

index 3f0772c942ca75f304bd601bf9ee4638ebe20d47..59672bb5458df85bf721e7cf32a816766b123157 100644 (file)
@@ -498,7 +498,11 @@ std::unique_ptr<llvm::MemoryBuffer> JitCache::getObject(const llvm::Module* M)
             break;
         }
 
+#if LLVM_VERSION_MAJOR < 6
         pBuf = llvm::MemoryBuffer::getNewUninitMemBuffer(size_t(header.GetBufferSize()));
+#else
+        pBuf = llvm::WritableMemoryBuffer::getNewUninitMemBuffer(size_t(header.GetBufferSize()));
+#endif
         if (!fread(const_cast<char*>(pBuf->getBufferStart()), header.GetBufferSize(), 1, fpIn))
         {
             pBuf = nullptr;