mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
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:
@@ -177,9 +177,7 @@ static std::error_code resolveSymbol(const std::vector<RelocationRef> &Rels,
|
||||
for (std::vector<RelocationRef>::const_iterator I = Rels.begin(),
|
||||
E = Rels.end();
|
||||
I != E; ++I) {
|
||||
uint64_t Ofs;
|
||||
if (std::error_code EC = I->getOffset(Ofs))
|
||||
return EC;
|
||||
uint64_t Ofs = I->getOffset();
|
||||
if (Ofs == Offset) {
|
||||
Sym = *I->getSymbol();
|
||||
return std::error_code();
|
||||
|
||||
@@ -796,8 +796,7 @@ static void DumpLiteralPointerSection(MachOObjectFile *O,
|
||||
RE = O->getRelocation(Rel);
|
||||
isExtern = O->getPlainRelocationExternal(RE);
|
||||
if (isExtern) {
|
||||
uint64_t RelocOffset;
|
||||
Reloc.getOffset(RelocOffset);
|
||||
uint64_t RelocOffset = Reloc.getOffset();
|
||||
symbol_iterator RelocSym = Reloc.getSymbol();
|
||||
Relocs.push_back(std::make_pair(RelocOffset, *RelocSym));
|
||||
}
|
||||
@@ -1763,8 +1762,7 @@ static int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
|
||||
bool r_scattered = false;
|
||||
uint32_t r_value, pair_r_value, r_type;
|
||||
for (const RelocationRef &Reloc : info->S.relocations()) {
|
||||
uint64_t RelocOffset;
|
||||
Reloc.getOffset(RelocOffset);
|
||||
uint64_t RelocOffset = Reloc.getOffset();
|
||||
if (RelocOffset == sect_offset) {
|
||||
Rel = Reloc.getRawDataRefImpl();
|
||||
RE = info->O->getRelocation(Rel);
|
||||
@@ -1841,8 +1839,7 @@ static int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
|
||||
bool isExtern = false;
|
||||
SymbolRef Symbol;
|
||||
for (const RelocationRef &Reloc : info->S.relocations()) {
|
||||
uint64_t RelocOffset;
|
||||
Reloc.getOffset(RelocOffset);
|
||||
uint64_t RelocOffset = Reloc.getOffset();
|
||||
if (RelocOffset == sect_offset) {
|
||||
Rel = Reloc.getRawDataRefImpl();
|
||||
RE = info->O->getRelocation(Rel);
|
||||
@@ -1911,8 +1908,7 @@ static int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
|
||||
auto Reloc =
|
||||
std::find_if(info->S.relocations().begin(), info->S.relocations().end(),
|
||||
[&](const RelocationRef &Reloc) {
|
||||
uint64_t RelocOffset;
|
||||
Reloc.getOffset(RelocOffset);
|
||||
uint64_t RelocOffset = Reloc.getOffset();
|
||||
return RelocOffset == sect_offset;
|
||||
});
|
||||
|
||||
@@ -2038,8 +2034,7 @@ static int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
|
||||
auto Reloc =
|
||||
std::find_if(info->S.relocations().begin(), info->S.relocations().end(),
|
||||
[&](const RelocationRef &Reloc) {
|
||||
uint64_t RelocOffset;
|
||||
Reloc.getOffset(RelocOffset);
|
||||
uint64_t RelocOffset = Reloc.getOffset();
|
||||
return RelocOffset == sect_offset;
|
||||
});
|
||||
|
||||
@@ -2429,8 +2424,7 @@ static const char *get_symbol_64(uint32_t sect_offset, SectionRef S,
|
||||
bool isExtern = false;
|
||||
SymbolRef Symbol;
|
||||
for (const RelocationRef &Reloc : S.relocations()) {
|
||||
uint64_t RelocOffset;
|
||||
Reloc.getOffset(RelocOffset);
|
||||
uint64_t RelocOffset = Reloc.getOffset();
|
||||
if (RelocOffset == sect_offset) {
|
||||
Rel = Reloc.getRawDataRefImpl();
|
||||
RE = info->O->getRelocation(Rel);
|
||||
@@ -5611,8 +5605,7 @@ static const char *GuessLiteralPointer(uint64_t ReferenceValue,
|
||||
bool isExtern = false;
|
||||
SymbolRef Symbol;
|
||||
for (const RelocationRef &Reloc : info->S.relocations()) {
|
||||
uint64_t RelocOffset;
|
||||
Reloc.getOffset(RelocOffset);
|
||||
uint64_t RelocOffset = Reloc.getOffset();
|
||||
if (RelocOffset == sect_offset) {
|
||||
Rel = Reloc.getRawDataRefImpl();
|
||||
RE = info->O->getRelocation(Rel);
|
||||
@@ -6106,8 +6099,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
||||
// Parse relocations.
|
||||
std::vector<std::pair<uint64_t, SymbolRef>> Relocs;
|
||||
for (const RelocationRef &Reloc : Sections[SectIdx].relocations()) {
|
||||
uint64_t RelocOffset;
|
||||
Reloc.getOffset(RelocOffset);
|
||||
uint64_t RelocOffset = Reloc.getOffset();
|
||||
uint64_t SectionAddress = Sections[SectIdx].getAddress();
|
||||
RelocOffset -= SectionAddress;
|
||||
|
||||
@@ -6510,8 +6502,7 @@ printMachOCompactUnwindSection(const MachOObjectFile *Obj,
|
||||
// Next we need to look at the relocations to find out what objects are
|
||||
// actually being referred to.
|
||||
for (const RelocationRef &Reloc : CompactUnwind.relocations()) {
|
||||
uint64_t RelocAddress;
|
||||
Reloc.getOffset(RelocAddress);
|
||||
uint64_t RelocAddress = Reloc.getOffset();
|
||||
|
||||
uint32_t EntryIdx = RelocAddress / EntrySize;
|
||||
uint32_t OffsetInEntry = RelocAddress - EntryIdx * EntrySize;
|
||||
|
||||
@@ -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 << " "
|
||||
|
||||
Reference in New Issue
Block a user