forked from OSchip/llvm-project
unique_ptrify IRObjectFile::createIRObjectFile
I took a guess at the changes to the gold plugin, because that doesn't seem to build by default for me. Not sure what dependencies I might be missing for that. llvm-svn: 217056
This commit is contained in:
parent
94e46f3eb8
commit
10a27df8ff
|
@ -49,8 +49,8 @@ public:
|
|||
return v->isIR();
|
||||
}
|
||||
|
||||
static ErrorOr<IRObjectFile *> createIRObjectFile(MemoryBufferRef Object,
|
||||
LLVMContext &Context);
|
||||
static ErrorOr<std::unique_ptr<IRObjectFile>>
|
||||
createIRObjectFile(MemoryBufferRef Object, LLVMContext &Context);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ basic_symbol_iterator IRObjectFile::symbol_end_impl() const {
|
|||
return basic_symbol_iterator(BasicSymbolRef(Ret, this));
|
||||
}
|
||||
|
||||
ErrorOr<IRObjectFile *>
|
||||
ErrorOr<std::unique_ptr<IRObjectFile>>
|
||||
llvm::object::IRObjectFile::createIRObjectFile(MemoryBufferRef Object,
|
||||
LLVMContext &Context) {
|
||||
|
||||
|
@ -275,5 +275,5 @@ llvm::object::IRObjectFile::createIRObjectFile(MemoryBufferRef Object,
|
|||
return EC;
|
||||
|
||||
std::unique_ptr<Module> M(MOrErr.get());
|
||||
return new IRObjectFile(Object, std::move(M));
|
||||
return llvm::make_unique<IRObjectFile>(Object, std::move(M));
|
||||
}
|
||||
|
|
|
@ -33,8 +33,7 @@ ErrorOr<std::unique_ptr<SymbolicFile>> SymbolicFile::createSymbolicFile(
|
|||
switch (Type) {
|
||||
case sys::fs::file_magic::bitcode:
|
||||
if (Context)
|
||||
return ErrorOr<std::unique_ptr<SymbolicFile>>(
|
||||
IRObjectFile::createIRObjectFile(Object, *Context));
|
||||
return IRObjectFile::createIRObjectFile(Object, *Context);
|
||||
// Fallthrough
|
||||
case sys::fs::file_magic::unknown:
|
||||
case sys::fs::file_magic::archive:
|
||||
|
|
|
@ -296,7 +296,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||
BufferRef = Buffer->getMemBufferRef();
|
||||
}
|
||||
|
||||
ErrorOr<object::IRObjectFile *> ObjOrErr =
|
||||
ErrorOr<std::unique_ptr<object::IRObjectFile>> ObjOrErr =
|
||||
object::IRObjectFile::createIRObjectFile(BufferRef, Context);
|
||||
std::error_code EC = ObjOrErr.getError();
|
||||
if (EC == BitcodeError::InvalidBitcodeSignature)
|
||||
|
@ -309,7 +309,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||
EC.message().c_str());
|
||||
return LDPS_ERR;
|
||||
}
|
||||
std::unique_ptr<object::IRObjectFile> Obj(ObjOrErr.get());
|
||||
std::unique_ptr<object::IRObjectFile> Obj = std::move(*ObjOrErr);
|
||||
|
||||
Modules.resize(Modules.size() + 1);
|
||||
claimed_file &cf = Modules.back();
|
||||
|
|
Loading…
Reference in New Issue