summaryrefslogtreecommitdiff
path: root/lib/IR
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-06-23 21:53:12 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-06-23 21:53:12 +0000
commit1f659329b63aa1d1af2b2bfc8b174a8ccdaba2c0 (patch)
treedc64a751796af7cd61a83b0cb8a8d8ca3145a95c /lib/IR
parent7e7e89f17819d30703543375120dff52d5aaa414 (diff)
downloadllvm-1f659329b63aa1d1af2b2bfc8b174a8ccdaba2c0.tar.gz
llvm-1f659329b63aa1d1af2b2bfc8b174a8ccdaba2c0.tar.bz2
llvm-1f659329b63aa1d1af2b2bfc8b174a8ccdaba2c0.tar.xz
Make ObjectFile and BitcodeReader always own the MemoryBuffer.
This allows us to just use a std::unique_ptr to store the pointer to the buffer. The flip side is that they have to support releasing the buffer back to the caller. Overall this looks like a more efficient and less brittle api. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211542 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Module.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/IR/Module.cpp b/lib/IR/Module.cpp
index 6a5b386c19..eea14df3f3 100644
--- a/lib/IR/Module.cpp
+++ b/lib/IR/Module.cpp
@@ -400,10 +400,13 @@ std::error_code Module::materializeAll() {
return Materializer->MaterializeModule(this);
}
-std::error_code Module::materializeAllPermanently() {
+std::error_code Module::materializeAllPermanently(bool ReleaseBuffer) {
if (std::error_code EC = materializeAll())
return EC;
+ if (ReleaseBuffer)
+ Materializer->releaseBuffer();
+
Materializer.reset();
return std::error_code();
}