Make ObjectFile ownership of the MemoryBuffer optional.

This allows llvm-ar to mmap the input files only once.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200040 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-01-24 21:32:21 +00:00
parent 0078935812
commit 584fe2db6a
11 changed files with 98 additions and 85 deletions

View File

@@ -26,12 +26,12 @@ using namespace llvm;
using namespace object;
Binary::~Binary() {
delete Data;
if (BufferOwned)
delete Data;
}
Binary::Binary(unsigned int Type, MemoryBuffer *Source)
: TypeID(Type)
, Data(Source) {}
Binary::Binary(unsigned int Type, MemoryBuffer *Source, bool BufferOwned)
: TypeID(Type), BufferOwned(BufferOwned), Data(Source) {}
StringRef Binary::getData() const {
return Data->getBuffer();