summaryrefslogtreecommitdiff
path: root/lib/IRReader
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-11-08 06:03:43 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-11-08 06:03:43 +0000
commit5498e18776bcce6a9f016397d42fc27cdfb3ee49 (patch)
tree9eafe5a7d8a33a017369c3d66b0cf370249270d3 /lib/IRReader
parentadbd909be70e7310a5bb88fb57a6d0babb70409a (diff)
IR, Bitcode: Change bitcode reader to no longer own its memory buffer.
Unique ownership is just one possible ownership pattern for the memory buffer underlying the bitcode reader. In practice, as this patch shows, ownership can often reside at a higher level. With the upcoming change to allow multiple modules in a single bitcode file, it will no longer be appropriate for modules to generally have unique ownership of their memory buffer. The C API exposes the ownership relation via the LLVMGetBitcodeModuleInContext and LLVMGetBitcodeModuleInContext2 functions, so we still need some way for the module to own the memory buffer. This patch does so by adding an owned memory buffer field to Module, and using it in a few other places where it is convenient. Differential Revision: https://reviews.llvm.org/D26384 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IRReader')
-rw-r--r--lib/IRReader/IRReader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/IRReader/IRReader.cpp b/lib/IRReader/IRReader.cpp
index 9b243fc571d..1ac4b3c4ad2 100644
--- a/lib/IRReader/IRReader.cpp
+++ b/lib/IRReader/IRReader.cpp
@@ -34,7 +34,7 @@ getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err,
LLVMContext &Context, bool ShouldLazyLoadMetadata) {
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
(const unsigned char *)Buffer->getBufferEnd())) {
- ErrorOr<std::unique_ptr<Module>> ModuleOrErr = getLazyBitcodeModule(
+ ErrorOr<std::unique_ptr<Module>> ModuleOrErr = getOwningLazyBitcodeModule(
std::move(Buffer), Context, ShouldLazyLoadMetadata);
if (std::error_code EC = ModuleOrErr.getError()) {
Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error,