[llvm] r217056 - unique_ptrify IRObjectFile::createIRObjectFile
David Blaikie
dblaikie at gmail.com
Wed Sep 3 10:59:23 PDT 2014
Author: dblaikie
Date: Wed Sep 3 12:59:23 2014
New Revision: 217056
URL: http://llvm.org/viewvc/llvm-project?rev=217056&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Object/IRObjectFile.h
llvm/trunk/lib/Object/IRObjectFile.cpp
llvm/trunk/lib/Object/SymbolicFile.cpp
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/include/llvm/Object/IRObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/IRObjectFile.h?rev=217056&r1=217055&r2=217056&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/IRObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/IRObjectFile.h Wed Sep 3 12:59:23 2014
@@ -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);
};
}
}
Modified: llvm/trunk/lib/Object/IRObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=217056&r1=217055&r2=217056&view=diff
==============================================================================
--- llvm/trunk/lib/Object/IRObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/IRObjectFile.cpp Wed Sep 3 12:59:23 2014
@@ -264,7 +264,7 @@ basic_symbol_iterator IRObjectFile::symb
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::createIRObje
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));
}
Modified: llvm/trunk/lib/Object/SymbolicFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/SymbolicFile.cpp?rev=217056&r1=217055&r2=217056&view=diff
==============================================================================
--- llvm/trunk/lib/Object/SymbolicFile.cpp (original)
+++ llvm/trunk/lib/Object/SymbolicFile.cpp Wed Sep 3 12:59:23 2014
@@ -33,8 +33,7 @@ ErrorOr<std::unique_ptr<SymbolicFile>> S
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:
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=217056&r1=217055&r2=217056&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Sep 3 12:59:23 2014
@@ -296,7 +296,7 @@ static ld_plugin_status claim_file_hook(
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(
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();
More information about the llvm-commits
mailing list