mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +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:
@ -245,12 +245,12 @@ static void PrintFileSectionSizes(StringRef file) {
|
||||
// This is an archive. Iterate over each member and display its sizes.
|
||||
for (object::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)) {
|
||||
errs() << ToolName << ": " << file << ": " << ec.message() << ".\n";
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = i->getAsBinary();
|
||||
if (std::error_code EC = ChildOrErr.getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << EC.message() << ".\n";
|
||||
continue;
|
||||
}
|
||||
if (ObjectFile *o = dyn_cast<ObjectFile>(child.get())) {
|
||||
if (ObjectFile *o = dyn_cast<ObjectFile>(&*ChildOrErr.get())) {
|
||||
if (OutputFormat == sysv)
|
||||
outs() << o->getFileName() << " (ex " << a->getFileName()
|
||||
<< "):\n";
|
||||
|
Reference in New Issue
Block a user