Return a std::unique_ptr to make the ownership explicit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215850 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-08-17 21:11:31 +00:00
parent 9ea1ec3d14
commit 40ef1799b8

View File

@ -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<MemoryBuffer> getMemBuffer() const {
return std::unique_ptr<MemoryBuffer>(MemoryBuffer::getMemBuffer(
Buffer->getBuffer(), Buffer->getBufferIdentifier(), false));
}
const char *getBufferStart() const { return Buffer->getBufferStart(); }