summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-size
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-07-14 00:37:04 +0000
committerLang Hames <lhames@gmail.com>2016-07-14 00:37:04 +0000
commitae610ab528a382a393aae26d2d67cee05cabe634 (patch)
treebb4178e75d234c71dac75810b4662a0f979227f0 /llvm/tools/llvm-size
parent7f781aba9755633c53210db02d51f6f56d11ea48 (diff)
downloadbcm5719-llvm-ae610ab528a382a393aae26d2d67cee05cabe634.tar.gz
bcm5719-llvm-ae610ab528a382a393aae26d2d67cee05cabe634.zip
[Object] Revert r275316, Archive::child_iterator changes, while I update lld.
Should fix the bots broken by r275316. llvm-svn: 275353
Diffstat (limited to 'llvm/tools/llvm-size')
-rw-r--r--llvm/tools/llvm-size/llvm-size.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp
index c5966ead4b6..ecc0a0eac3c 100644
--- a/llvm/tools/llvm-size/llvm-size.cpp
+++ b/llvm/tools/llvm-size/llvm-size.cpp
@@ -527,12 +527,15 @@ static void printFileSectionSizes(StringRef file) {
if (Archive *a = dyn_cast<Archive>(&Bin)) {
// This is an archive. Iterate over each member and display its sizes.
- Error Err;
- for (auto &C : a->children(Err)) {
- Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
+ for (object::Archive::child_iterator i = a->child_begin(),
+ e = a->child_end();
+ i != e; ++i) {
+ if (error(i->getError()))
+ exit(1);
+ Expected<std::unique_ptr<Binary>> ChildOrErr = i->get().getAsBinary();
if (!ChildOrErr) {
if (auto E = isNotObjectErrorInvalidFileType(ChildOrErr.takeError()))
- error(std::move(E), a->getFileName(), C);
+ error(std::move(E), a->getFileName(), i->get());
continue;
}
if (ObjectFile *o = dyn_cast<ObjectFile>(&*ChildOrErr.get())) {
@@ -552,8 +555,6 @@ static void printFileSectionSizes(StringRef file) {
}
}
}
- if (Err)
- error(std::move(Err), a->getFileName());
} else if (MachOUniversalBinary *UB =
dyn_cast<MachOUniversalBinary>(&Bin)) {
// If we have a list of architecture flags specified dump only those.
@@ -596,13 +597,17 @@ static void printFileSectionSizes(StringRef file) {
std::unique_ptr<Archive> &UA = *AOrErr;
// This is an archive. Iterate over each member and display its
// sizes.
- Error Err;
- for (auto &C : UA->children(Err)) {
- Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
+ for (object::Archive::child_iterator i = UA->child_begin(),
+ e = UA->child_end();
+ i != e; ++i) {
+ if (error(i->getError()))
+ exit(1);
+ Expected<std::unique_ptr<Binary>> ChildOrErr =
+ i->get().getAsBinary();
if (!ChildOrErr) {
if (auto E = isNotObjectErrorInvalidFileType(
ChildOrErr.takeError()))
- error(std::move(E), UA->getFileName(), C,
+ error(std::move(E), UA->getFileName(), i->get(),
ArchFlags.size() > 1 ?
StringRef(I->getArchTypeName()) : StringRef());
continue;
@@ -632,8 +637,6 @@ static void printFileSectionSizes(StringRef file) {
}
}
}
- if (Err)
- error(std::move(Err), UA->getFileName());
} else {
consumeError(AOrErr.takeError());
error("Mach-O universal file: " + file + " for architecture " +
@@ -685,13 +688,17 @@ static void printFileSectionSizes(StringRef file) {
std::unique_ptr<Archive> &UA = *AOrErr;
// This is an archive. Iterate over each member and display its
// sizes.
- Error Err;
- for (auto &C : UA->children(Err)) {
- Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
+ for (object::Archive::child_iterator i = UA->child_begin(),
+ e = UA->child_end();
+ i != e; ++i) {
+ if (error(i->getError()))
+ exit(1);
+ Expected<std::unique_ptr<Binary>> ChildOrErr =
+ i->get().getAsBinary();
if (!ChildOrErr) {
if (auto E = isNotObjectErrorInvalidFileType(
ChildOrErr.takeError()))
- error(std::move(E), UA->getFileName(), C);
+ error(std::move(E), UA->getFileName(), i->get());
continue;
}
if (ObjectFile *o = dyn_cast<ObjectFile>(&*ChildOrErr.get())) {
@@ -714,8 +721,6 @@ static void printFileSectionSizes(StringRef file) {
}
}
}
- if (Err)
- error(std::move(Err), UA->getFileName());
} else {
consumeError(AOrErr.takeError());
error("Mach-O universal file: " + file + " for architecture " +
@@ -760,13 +765,16 @@ static void printFileSectionSizes(StringRef file) {
I->getAsArchive()) {
std::unique_ptr<Archive> &UA = *AOrErr;
// This is an archive. Iterate over each member and display its sizes.
- Error Err;
- for (auto &C : UA->children(Err)) {
- Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
+ for (object::Archive::child_iterator i = UA->child_begin(),
+ e = UA->child_end();
+ i != e; ++i) {
+ if (error(i->getError()))
+ exit(1);
+ Expected<std::unique_ptr<Binary>> ChildOrErr = i->get().getAsBinary();
if (!ChildOrErr) {
if (auto E = isNotObjectErrorInvalidFileType(
ChildOrErr.takeError()))
- error(std::move(E), UA->getFileName(), C, MoreThanOneArch ?
+ error(std::move(E), UA->getFileName(), i->get(), MoreThanOneArch ?
StringRef(I->getArchTypeName()) : StringRef());
continue;
}
@@ -790,8 +798,6 @@ static void printFileSectionSizes(StringRef file) {
}
}
}
- if (Err)
- error(std::move(Err), UA->getFileName());
} else {
consumeError(AOrErr.takeError());
error("Mach-O universal file: " + file + " for architecture " +
OpenPOWER on IntegriCloud