From afcc3df7f4db85832b13a6f4d58e24ac9e7ccc43 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 24 Jan 2014 21:32:21 +0000 Subject: Make ObjectFile ownership of the MemoryBuffer optional. This allows llvm-ar to mmap the input files only once. llvm-svn: 200040 --- llvm/lib/Object/Binary.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Object/Binary.cpp') diff --git a/llvm/lib/Object/Binary.cpp b/llvm/lib/Object/Binary.cpp index a0c412a..a2f4ec9 100644 --- a/llvm/lib/Object/Binary.cpp +++ b/llvm/lib/Object/Binary.cpp @@ -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(); -- cgit v1.1