mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-03 15:26:18 +00:00
Convert the Archive API to use ErrorOr.
Now that we have c++11, even things like ErrorOr<std::unique_ptr<...>> are easy to use. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211033 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -850,15 +850,15 @@ static void DumpObject(const ObjectFile *o) {
|
||||
static void DumpArchive(const Archive *a) {
|
||||
for (Archive::child_iterator i = a->child_begin(), e = a->child_end(); i != e;
|
||||
++i) {
|
||||
std::unique_ptr<Binary> child;
|
||||
if (std::error_code EC = i->getAsBinary(child)) {
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = i->getAsBinary();
|
||||
if (std::error_code EC = ChildOrErr.getError()) {
|
||||
// Ignore non-object files.
|
||||
if (EC != object_error::invalid_file_type)
|
||||
errs() << ToolName << ": '" << a->getFileName() << "': " << EC.message()
|
||||
<< ".\n";
|
||||
continue;
|
||||
}
|
||||
if (ObjectFile *o = dyn_cast<ObjectFile>(child.get()))
|
||||
if (ObjectFile *o = dyn_cast<ObjectFile>(&*ChildOrErr.get()))
|
||||
DumpObject(o);
|
||||
else
|
||||
errs() << ToolName << ": '" << a->getFileName() << "': "
|
||||
|
Reference in New Issue
Block a user