diff --git a/include/llvm/ExecutionEngine/ObjectBuffer.h b/include/llvm/ExecutionEngine/ObjectBuffer.h index 88a4213ed85..ff282eacba9 100644 --- a/include/llvm/ExecutionEngine/ObjectBuffer.h +++ b/include/llvm/ExecutionEngine/ObjectBuffer.h @@ -38,9 +38,9 @@ public: /// Like MemoryBuffer::getMemBuffer() this function returns a pointer to an /// object that is owned by the caller. However, the caller does not take /// ownership of the underlying memory. - MemoryBuffer *getMemBuffer() const { - return MemoryBuffer::getMemBuffer(Buffer->getBuffer(), - Buffer->getBufferIdentifier(), false); + std::unique_ptr getMemBuffer() const { + return std::unique_ptr(MemoryBuffer::getMemBuffer( + Buffer->getBuffer(), Buffer->getBufferIdentifier(), false)); } const char *getBufferStart() const { return Buffer->getBufferStart(); }