mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
Pass a unique_ptr<MemoryBuffer> to the constructors in the Binary hierarchy.
Once the objects are constructed, they own the buffer. Passing a unique_ptr makes that clear. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211595 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -17,14 +17,15 @@
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Object/IRObjectFile.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
using namespace object;
|
||||
|
||||
IRObjectFile::IRObjectFile(MemoryBuffer *Object, std::error_code &EC,
|
||||
LLVMContext &Context)
|
||||
: SymbolicFile(Binary::ID_IR, Object) {
|
||||
ErrorOr<Module *> MOrErr = getLazyBitcodeModule(Object, Context);
|
||||
IRObjectFile::IRObjectFile(std::unique_ptr<MemoryBuffer> Object,
|
||||
std::error_code &EC, LLVMContext &Context)
|
||||
: SymbolicFile(Binary::ID_IR, std::move(Object)) {
|
||||
ErrorOr<Module *> MOrErr = getLazyBitcodeModule(Data.get(), Context);
|
||||
if ((EC = MOrErr.getError()))
|
||||
return;
|
||||
|
||||
@ -153,11 +154,11 @@ basic_symbol_iterator IRObjectFile::symbol_end_impl() const {
|
||||
return basic_symbol_iterator(BasicSymbolRef(Ret, this));
|
||||
}
|
||||
|
||||
ErrorOr<SymbolicFile *>
|
||||
llvm::object::SymbolicFile::createIRObjectFile(MemoryBuffer *Object,
|
||||
LLVMContext &Context) {
|
||||
ErrorOr<SymbolicFile *> llvm::object::SymbolicFile::createIRObjectFile(
|
||||
std::unique_ptr<MemoryBuffer> Object, LLVMContext &Context) {
|
||||
std::error_code EC;
|
||||
std::unique_ptr<IRObjectFile> Ret(new IRObjectFile(Object, EC, Context));
|
||||
std::unique_ptr<IRObjectFile> Ret(
|
||||
new IRObjectFile(std::move(Object), EC, Context));
|
||||
if (EC)
|
||||
return EC;
|
||||
return Ret.release();
|
||||
|
Reference in New Issue
Block a user