mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-29 06:10:48 +00:00
[llvm-objdump/MachO] Don't cut'n'paste the same code over and over.
Use the appropriate helper instead. llvm-svn: 254990
This commit is contained in:
parent
7e77ee21fb
commit
6c5eaeb369
@ -1495,11 +1495,8 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
printArchiveHeaders(A, !NonVerbose, ArchiveMemberOffsets);
|
||||
for (Archive::child_iterator I = A->child_begin(), E = A->child_end();
|
||||
I != E; ++I) {
|
||||
if (std::error_code EC = I->getError()) {
|
||||
errs() << "llvm-objdump: '" << Filename << "': " << EC.message()
|
||||
<< ".\n";
|
||||
exit(1);
|
||||
}
|
||||
if (std::error_code EC = I->getError())
|
||||
report_error(Filename, EC);
|
||||
auto &C = I->get();
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (ChildOrErr.getError())
|
||||
@ -1549,11 +1546,8 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
for (Archive::child_iterator AI = A->child_begin(),
|
||||
AE = A->child_end();
|
||||
AI != AE; ++AI) {
|
||||
if (std::error_code EC = AI->getError()) {
|
||||
errs() << "llvm-objdump: '" << Filename
|
||||
<< "': " << EC.message() << ".\n";
|
||||
exit(1);
|
||||
}
|
||||
if (std::error_code EC = AI->getError())
|
||||
report_error(Filename, EC);
|
||||
auto &C = AI->get();
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (ChildOrErr.getError())
|
||||
@ -1597,11 +1591,8 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
for (Archive::child_iterator AI = A->child_begin(),
|
||||
AE = A->child_end();
|
||||
AI != AE; ++AI) {
|
||||
if (std::error_code EC = AI->getError()) {
|
||||
errs() << "llvm-objdump: '" << Filename << "': " << EC.message()
|
||||
<< ".\n";
|
||||
exit(1);
|
||||
}
|
||||
if (std::error_code EC = AI->getError())
|
||||
report_error(Filename, EC);
|
||||
auto &C = AI->get();
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (ChildOrErr.getError())
|
||||
@ -1639,11 +1630,8 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
printArchiveHeaders(A.get(), !NonVerbose, ArchiveMemberOffsets);
|
||||
for (Archive::child_iterator AI = A->child_begin(), AE = A->child_end();
|
||||
AI != AE; ++AI) {
|
||||
if (std::error_code EC = AI->getError()) {
|
||||
errs() << "llvm-objdump: '" << Filename << "': " << EC.message()
|
||||
<< ".\n";
|
||||
exit(1);
|
||||
}
|
||||
if (std::error_code EC = AI->getError())
|
||||
report_error(Filename, EC);
|
||||
auto &C = AI->get();
|
||||
ErrorOr<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (ChildOrErr.getError())
|
||||
|
@ -252,7 +252,7 @@ void llvm::error(std::error_code EC) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void report_error(StringRef File, std::error_code EC) {
|
||||
void llvm::report_error(StringRef File, std::error_code EC) {
|
||||
assert(EC);
|
||||
errs() << ToolName << ": '" << File << "': " << EC.message() << ".\n";
|
||||
exit(1);
|
||||
|
@ -78,6 +78,7 @@ void PrintRelocations(const object::ObjectFile *o);
|
||||
void PrintSectionHeaders(const object::ObjectFile *o);
|
||||
void PrintSectionContents(const object::ObjectFile *o);
|
||||
void PrintSymbolTable(const object::ObjectFile *o);
|
||||
void report_error(StringRef File, std::error_code EC);
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user