Don't return error_code from function that never fails.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241021 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-06-29 23:29:12 +00:00
parent 10e9fb18d4
commit ff67629985
23 changed files with 49 additions and 106 deletions

View File

@ -212,9 +212,8 @@ static const Target *getTarget(const ObjectFile *Obj = nullptr) {
}
bool llvm::RelocAddressLess(RelocationRef a, RelocationRef b) {
uint64_t a_addr, b_addr;
if (error(a.getOffset(a_addr))) return false;
if (error(b.getOffset(b_addr))) return false;
uint64_t a_addr = a.getOffset();
uint64_t b_addr = b.getOffset();
return a_addr < b_addr;
}
@ -890,7 +889,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
// Print relocation for instruction.
while (rel_cur != rel_end) {
bool hidden = false;
uint64_t addr;
uint64_t addr = rel_cur->getOffset();
SmallString<16> name;
SmallString<32> val;
@ -898,7 +897,6 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
if (error(rel_cur->getHidden(hidden))) goto skip_print_rel;
if (hidden) goto skip_print_rel;
if (error(rel_cur->getOffset(addr))) goto skip_print_rel;
// Stop when rel_cur's address is past the current instruction.
if (addr >= Index + Size) break;
if (error(rel_cur->getTypeName(name))) goto skip_print_rel;
@ -932,7 +930,7 @@ void llvm::PrintRelocations(const ObjectFile *Obj) {
outs() << "RELOCATION RECORDS FOR [" << secname << "]:\n";
for (const RelocationRef &Reloc : Section.relocations()) {
bool hidden;
uint64_t address;
uint64_t address = Reloc.getOffset();
SmallString<32> relocname;
SmallString<32> valuestr;
if (error(Reloc.getHidden(hidden)))
@ -941,8 +939,6 @@ void llvm::PrintRelocations(const ObjectFile *Obj) {
continue;
if (error(Reloc.getTypeName(relocname)))
continue;
if (error(Reloc.getOffset(address)))
continue;
if (error(getRelocationValueString(Reloc, valuestr)))
continue;
outs() << format(Fmt.data(), address) << " " << relocname << " "