mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 23:48:56 +00:00
[llvm-size] Make error handling uniform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260786 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0bbac93e5d
commit
2ad5a3cea4
@ -1,2 +1,2 @@
|
||||
RUN: llvm-size %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s
|
||||
ENOENT: {{.*}}llvm-size{{(\.EXE|\.exe)?}}: {{.*}}.blah: {{[Nn]}}o such file or directory
|
||||
ENOENT: {{.*}}llvm-size{{(\.EXE|\.exe)?}}: error reading file: {{[Nn]}}o such file or directory
|
||||
|
@ -439,10 +439,8 @@ static void printFileSectionSizes(StringRef file) {
|
||||
|
||||
// Attempt to open the binary.
|
||||
ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(file);
|
||||
if (std::error_code EC = BinaryOrErr.getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << EC.message() << ".\n";
|
||||
if (error(BinaryOrErr.getError()))
|
||||
return;
|
||||
}
|
||||
Binary &Bin = *BinaryOrErr.get().getBinary();
|
||||
|
||||
if (Archive *a = dyn_cast<Archive>(&Bin)) {
|
||||
@ -450,17 +448,12 @@ static void printFileSectionSizes(StringRef file) {
|
||||
for (object::Archive::child_iterator i = a->child_begin(),
|
||||
e = a->child_end();
|
||||
i != e; ++i) {
|
||||
if (i->getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << i->getError().message()
|
||||
<< ".\n";
|
||||
if (error(i->getError()))
|
||||
exit(1);
|
||||
}
|
||||
auto &c = i->get();
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = c.getAsBinary();
|
||||
if (std::error_code EC = ChildOrErr.getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << EC.message() << ".\n";
|
||||
if (error(ChildOrErr.getError()))
|
||||
continue;
|
||||
}
|
||||
if (ObjectFile *o = dyn_cast<ObjectFile>(&*ChildOrErr.get())) {
|
||||
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o);
|
||||
if (!checkMachOAndArchFlags(o, file))
|
||||
@ -518,18 +511,12 @@ static void printFileSectionSizes(StringRef file) {
|
||||
for (object::Archive::child_iterator i = UA->child_begin(),
|
||||
e = UA->child_end();
|
||||
i != e; ++i) {
|
||||
if (std::error_code EC = i->getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << EC.message()
|
||||
<< ".\n";
|
||||
if (error(i->getError()))
|
||||
exit(1);
|
||||
}
|
||||
auto &c = i->get();
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = c.getAsBinary();
|
||||
if (std::error_code EC = ChildOrErr.getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << EC.message()
|
||||
<< ".\n";
|
||||
if (error(ChildOrErr.getError()))
|
||||
continue;
|
||||
}
|
||||
if (ObjectFile *o = dyn_cast<ObjectFile>(&*ChildOrErr.get())) {
|
||||
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o);
|
||||
if (OutputFormat == sysv)
|
||||
@ -601,18 +588,12 @@ static void printFileSectionSizes(StringRef file) {
|
||||
for (object::Archive::child_iterator i = UA->child_begin(),
|
||||
e = UA->child_end();
|
||||
i != e; ++i) {
|
||||
if (std::error_code EC = i->getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << EC.message()
|
||||
<< ".\n";
|
||||
if (error(i->getError()))
|
||||
exit(1);
|
||||
}
|
||||
auto &c = i->get();
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = c.getAsBinary();
|
||||
if (std::error_code EC = ChildOrErr.getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << EC.message()
|
||||
<< ".\n";
|
||||
if (error(ChildOrErr.getError()))
|
||||
continue;
|
||||
}
|
||||
if (ObjectFile *o = dyn_cast<ObjectFile>(&*ChildOrErr.get())) {
|
||||
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o);
|
||||
if (OutputFormat == sysv)
|
||||
@ -671,16 +652,12 @@ static void printFileSectionSizes(StringRef file) {
|
||||
for (object::Archive::child_iterator i = UA->child_begin(),
|
||||
e = UA->child_end();
|
||||
i != e; ++i) {
|
||||
if (std::error_code EC = i->getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << EC.message() << ".\n";
|
||||
if (error(i->getError()))
|
||||
exit(1);
|
||||
}
|
||||
auto &c = i->get();
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = c.getAsBinary();
|
||||
if (std::error_code EC = ChildOrErr.getError()) {
|
||||
errs() << ToolName << ": " << file << ": " << EC.message() << ".\n";
|
||||
if (error(ChildOrErr.getError()))
|
||||
continue;
|
||||
}
|
||||
if (ObjectFile *o = dyn_cast<ObjectFile>(&*ChildOrErr.get())) {
|
||||
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o);
|
||||
if (OutputFormat == sysv)
|
||||
|
Loading…
Reference in New Issue
Block a user