aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/Binary.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-01-24 21:32:21 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-01-24 21:32:21 +0000
commitafcc3df7f4db85832b13a6f4d58e24ac9e7ccc43 (patch)
treee608147b8d62c19296d96c7e00de10c220811fe4 /llvm/lib/Object/Binary.cpp
parent1b392619907d1b5bed4d8533ea8c0cf7e19c5b48 (diff)
downloadllvm-afcc3df7f4db85832b13a6f4d58e24ac9e7ccc43.zip
llvm-afcc3df7f4db85832b13a6f4d58e24ac9e7ccc43.tar.gz
llvm-afcc3df7f4db85832b13a6f4d58e24ac9e7ccc43.tar.bz2
Make ObjectFile ownership of the MemoryBuffer optional.
This allows llvm-ar to mmap the input files only once. llvm-svn: 200040
Diffstat (limited to 'llvm/lib/Object/Binary.cpp')
-rw-r--r--llvm/lib/Object/Binary.cpp8
1 files changed, 4 insertions, 4 deletions
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();