Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit c5671c5

Browse files
committed
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/cfe/trunk@286214 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent f092121 commit c5671c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: lib/CodeGen/CodeGenAction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
772772
}
773773

774774
ErrorOr<std::unique_ptr<llvm::Module>> ModuleOrErr =
775-
getLazyBitcodeModule(std::move(*BCBuf), *VMContext);
775+
getOwningLazyBitcodeModule(std::move(*BCBuf), *VMContext);
776776
if (std::error_code EC = ModuleOrErr.getError()) {
777777
CI.getDiagnostics().Report(diag::err_cannot_open_file) << LinkBCFile
778778
<< EC.message();

0 commit comments

Comments
 (0)