Tidy up a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161430 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2012-08-07 17:53:14 +00:00
parent 702bcce747
commit 3f5d1a2396

View File

@ -104,7 +104,7 @@ static bool error(error_code ec) {
return true; return true;
} }
static const Target *GetTarget(const ObjectFile *Obj = NULL) { static const Target *getTarget(const ObjectFile *Obj = NULL) {
// Figure out the target triple. // Figure out the target triple.
llvm::Triple TheTriple("unknown-unknown-unknown"); llvm::Triple TheTriple("unknown-unknown-unknown");
if (TripleName.empty()) { if (TripleName.empty()) {
@ -163,11 +163,11 @@ static bool RelocAddressLess(RelocationRef a, RelocationRef b) {
} }
static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
const Target *TheTarget = GetTarget(Obj); const Target *TheTarget = getTarget(Obj);
if (!TheTarget) { // getTarget() will have already issued a diagnostic if necessary, so
// GetTarget prints out stuff. // just bail here if it failed.
if (!TheTarget)
return; return;
}
error_code ec; error_code ec;
for (section_iterator i = Obj->begin_sections(), for (section_iterator i = Obj->begin_sections(),
@ -206,7 +206,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
if (InlineRelocs) { if (InlineRelocs) {
for (relocation_iterator ri = i->begin_relocations(), for (relocation_iterator ri = i->begin_relocations(),
re = i->end_relocations(); re = i->end_relocations();
ri != re; ri.increment(ec)) { ri != re; ri.increment(ec)) {
if (error(ec)) break; if (error(ec)) break;
Rels.push_back(*ri); Rels.push_back(*ri);
} }
@ -463,9 +463,8 @@ static void PrintCOFFSymbolTable(const COFFObjectFile *coff) {
<< format("assoc %d comdat %d\n" << format("assoc %d comdat %d\n"
, unsigned(asd->Number) , unsigned(asd->Number)
, unsigned(asd->Selection)); , unsigned(asd->Selection));
} else { } else
outs() << "AUX Unknown\n"; outs() << "AUX Unknown\n";
}
} else { } else {
StringRef name; StringRef name;
if (error(coff->getSymbol(i, symbol))) return; if (error(coff->getSymbol(i, symbol))) return;
@ -609,13 +608,12 @@ static void DumpInput(StringRef file) {
return; return;
} }
if (Archive *a = dyn_cast<Archive>(binary.get())) { if (Archive *a = dyn_cast<Archive>(binary.get()))
DumpArchive(a); DumpArchive(a);
} else if (ObjectFile *o = dyn_cast<ObjectFile>(binary.get())) { else if (ObjectFile *o = dyn_cast<ObjectFile>(binary.get()))
DumpObject(o); DumpObject(o);
} else { else
errs() << ToolName << ": '" << file << "': " << "Unrecognized file type.\n"; errs() << ToolName << ": '" << file << "': " << "Unrecognized file type.\n";
}
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {