diff options
-rw-r--r-- | llvm/include/llvm/Object/IRObjectFile.h | 4 | ||||
-rw-r--r-- | llvm/lib/Object/IRObjectFile.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Object/SymbolicFile.cpp | 3 | ||||
-rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 4 |
4 files changed, 7 insertions, 8 deletions
diff --git a/llvm/include/llvm/Object/IRObjectFile.h b/llvm/include/llvm/Object/IRObjectFile.h index 60a85981b7f..2b6fa2c779f 100644 --- a/llvm/include/llvm/Object/IRObjectFile.h +++ b/llvm/include/llvm/Object/IRObjectFile.h @@ -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); }; } } diff --git a/llvm/lib/Object/IRObjectFile.cpp b/llvm/lib/Object/IRObjectFile.cpp index 0259b46c70c..856f4c6c278 100644 --- a/llvm/lib/Object/IRObjectFile.cpp +++ b/llvm/lib/Object/IRObjectFile.cpp @@ -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)); } diff --git a/llvm/lib/Object/SymbolicFile.cpp b/llvm/lib/Object/SymbolicFile.cpp index 17624a307ec..f8dd4b33a39 100644 --- a/llvm/lib/Object/SymbolicFile.cpp +++ b/llvm/lib/Object/SymbolicFile.cpp @@ -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: diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index bdbf0263dca..f2eeb7e8c4f 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -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(); |