1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

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:
David Blaikie 2014-09-03 17:59:23 +00:00
parent addc44901e
commit 9ec4b63537
4 changed files with 7 additions and 8 deletions

View File

@ -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);
};
}
}

View File

@ -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));
}

View File

@ -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:

View File

@ -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();