mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-16 16:37:42 +00:00
Don't create a MemoryBuffer just to get the MemoryBufferRef. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216608 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
819242a446
commit
b5e9bf06ad
@ -269,15 +269,15 @@ static const GlobalObject *getBaseObject(const GlobalValue &GV) {
|
||||
static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
||||
int *claimed) {
|
||||
LLVMContext Context;
|
||||
std::unique_ptr<MemoryBuffer> buffer;
|
||||
MemoryBufferRef BufferRef;
|
||||
std::unique_ptr<MemoryBuffer> Buffer;
|
||||
if (get_view) {
|
||||
const void *view;
|
||||
if (get_view(file->handle, &view) != LDPS_OK) {
|
||||
message(LDPL_ERROR, "Failed to get a view of %s", file->name);
|
||||
return LDPS_ERR;
|
||||
}
|
||||
buffer = MemoryBuffer::getMemBuffer(StringRef((char *)view, file->filesize),
|
||||
"", false);
|
||||
BufferRef = MemoryBufferRef(StringRef((char *)view, file->filesize), "");
|
||||
} else {
|
||||
int64_t offset = 0;
|
||||
// Gold has found what might be IR part-way inside of a file, such as
|
||||
@ -292,12 +292,12 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
||||
message(LDPL_ERROR, EC.message().c_str());
|
||||
return LDPS_ERR;
|
||||
}
|
||||
buffer = std::move(BufferOrErr.get());
|
||||
Buffer = std::move(BufferOrErr.get());
|
||||
BufferRef = Buffer->getMemBufferRef();
|
||||
}
|
||||
|
||||
ErrorOr<object::IRObjectFile *> ObjOrErr =
|
||||
object::IRObjectFile::createIRObjectFile(buffer->getMemBufferRef(),
|
||||
Context);
|
||||
object::IRObjectFile::createIRObjectFile(BufferRef, Context);
|
||||
std::error_code EC = ObjOrErr.getError();
|
||||
if (EC == BitcodeError::InvalidBitcodeSignature)
|
||||
return LDPS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user