Don't own the buffer in object::Binary.
[oota-llvm.git] / include / llvm / ExecutionEngine / ObjectBuffer.h
index ff282eacba9045465bc3f16ec366f0e930d221c0..9b234684fac6b4a796df71ddbc9ae703ad611bcc 100644 (file)
@@ -24,10 +24,7 @@ namespace llvm {
 /// This class acts as a container for the memory buffer used during generation
 /// and loading of executable objects using MCJIT and RuntimeDyld. The
 /// underlying memory for the object will be owned by the ObjectBuffer instance
-/// throughout its lifetime. The getMemBuffer() method provides a way to create
-/// a MemoryBuffer wrapper object instance to be owned by other classes (such as
-/// ObjectFile) as needed, but the MemoryBuffer instance returned does not own
-/// the actual memory it points to.
+/// throughout its lifetime.
 class ObjectBuffer {
   virtual void anchor();
 public:
@@ -35,13 +32,7 @@ public:
   ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {}
   virtual ~ObjectBuffer() {}
 
-  /// 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.
-  std::unique_ptr<MemoryBuffer> getMemBuffer() const {
-    return std::unique_ptr<MemoryBuffer>(MemoryBuffer::getMemBuffer(
-        Buffer->getBuffer(), Buffer->getBufferIdentifier(), false));
-  }
+  MemoryBufferRef getMemBuffer() const { return Buffer->getMemBufferRef(); }
 
   const char *getBufferStart() const { return Buffer->getBufferStart(); }
   size_t getBufferSize() const { return Buffer->getBufferSize(); }