mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
Don't return error_code from a function that doesn't fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241039 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -244,8 +244,7 @@ public:
|
|||||||
std::error_code
|
std::error_code
|
||||||
getRelocationTypeName(DataRefImpl Rel,
|
getRelocationTypeName(DataRefImpl Rel,
|
||||||
SmallVectorImpl<char> &Result) const override;
|
SmallVectorImpl<char> &Result) const override;
|
||||||
std::error_code getRelocationHidden(DataRefImpl Rel,
|
bool getRelocationHidden(DataRefImpl Rel) const override;
|
||||||
bool &Result) const override;
|
|
||||||
uint8_t getRelocationLength(DataRefImpl Rel) const;
|
uint8_t getRelocationLength(DataRefImpl Rel) const;
|
||||||
|
|
||||||
// MachO specific.
|
// MachO specific.
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
/// @brief Indicates whether this relocation should hidden when listing
|
/// @brief Indicates whether this relocation should hidden when listing
|
||||||
/// relocations, usually because it is the trailing part of a multipart
|
/// relocations, usually because it is the trailing part of a multipart
|
||||||
/// relocation that will be printed as part of the leading relocation.
|
/// relocation that will be printed as part of the leading relocation.
|
||||||
std::error_code getHidden(bool &Result) const;
|
bool getHidden() const;
|
||||||
|
|
||||||
/// @brief Get a string that represents the type of this relocation.
|
/// @brief Get a string that represents the type of this relocation.
|
||||||
///
|
///
|
||||||
@ -246,11 +246,7 @@ protected:
|
|||||||
virtual std::error_code
|
virtual std::error_code
|
||||||
getRelocationTypeName(DataRefImpl Rel,
|
getRelocationTypeName(DataRefImpl Rel,
|
||||||
SmallVectorImpl<char> &Result) const = 0;
|
SmallVectorImpl<char> &Result) const = 0;
|
||||||
virtual std::error_code getRelocationHidden(DataRefImpl Rel,
|
virtual bool getRelocationHidden(DataRefImpl Rel) const { return false; }
|
||||||
bool &Result) const {
|
|
||||||
Result = false;
|
|
||||||
return std::error_code();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint64_t getCommonSymbolSize(DataRefImpl Symb) const {
|
uint64_t getCommonSymbolSize(DataRefImpl Symb) const {
|
||||||
@ -472,8 +468,8 @@ RelocationRef::getTypeName(SmallVectorImpl<char> &Result) const {
|
|||||||
return OwningObject->getRelocationTypeName(RelocationPimpl, Result);
|
return OwningObject->getRelocationTypeName(RelocationPimpl, Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::error_code RelocationRef::getHidden(bool &Result) const {
|
inline bool RelocationRef::getHidden() const {
|
||||||
return OwningObject->getRelocationHidden(RelocationPimpl, Result);
|
return OwningObject->getRelocationHidden(RelocationPimpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline DataRefImpl RelocationRef::getRawDataRefImpl() const {
|
inline DataRefImpl RelocationRef::getRawDataRefImpl() const {
|
||||||
|
@ -770,17 +770,15 @@ MachOObjectFile::getRelocationTypeName(DataRefImpl Rel,
|
|||||||
return std::error_code();
|
return std::error_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code MachOObjectFile::getRelocationHidden(DataRefImpl Rel,
|
bool MachOObjectFile::getRelocationHidden(DataRefImpl Rel) const {
|
||||||
bool &Result) const {
|
|
||||||
unsigned Arch = getArch();
|
unsigned Arch = getArch();
|
||||||
uint64_t Type = getRelocationType(Rel);
|
uint64_t Type = getRelocationType(Rel);
|
||||||
|
|
||||||
Result = false;
|
|
||||||
|
|
||||||
// On arches that use the generic relocations, GENERIC_RELOC_PAIR
|
// On arches that use the generic relocations, GENERIC_RELOC_PAIR
|
||||||
// is always hidden.
|
// is always hidden.
|
||||||
if (Arch == Triple::x86 || Arch == Triple::arm || Arch == Triple::ppc) {
|
if (Arch == Triple::x86 || Arch == Triple::arm || Arch == Triple::ppc) {
|
||||||
if (Type == MachO::GENERIC_RELOC_PAIR) Result = true;
|
if (Type == MachO::GENERIC_RELOC_PAIR)
|
||||||
|
return true;
|
||||||
} else if (Arch == Triple::x86_64) {
|
} else if (Arch == Triple::x86_64) {
|
||||||
// On x86_64, X86_64_RELOC_UNSIGNED is hidden only when it follows
|
// On x86_64, X86_64_RELOC_UNSIGNED is hidden only when it follows
|
||||||
// an X86_64_RELOC_SUBTRACTOR.
|
// an X86_64_RELOC_SUBTRACTOR.
|
||||||
@ -789,11 +787,11 @@ std::error_code MachOObjectFile::getRelocationHidden(DataRefImpl Rel,
|
|||||||
RelPrev.d.a--;
|
RelPrev.d.a--;
|
||||||
uint64_t PrevType = getRelocationType(RelPrev);
|
uint64_t PrevType = getRelocationType(RelPrev);
|
||||||
if (PrevType == MachO::X86_64_RELOC_SUBTRACTOR)
|
if (PrevType == MachO::X86_64_RELOC_SUBTRACTOR)
|
||||||
Result = true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::error_code();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t MachOObjectFile::getRelocationLength(DataRefImpl Rel) const {
|
uint8_t MachOObjectFile::getRelocationLength(DataRefImpl Rel) const {
|
||||||
|
@ -888,13 +888,12 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
|
|||||||
|
|
||||||
// Print relocation for instruction.
|
// Print relocation for instruction.
|
||||||
while (rel_cur != rel_end) {
|
while (rel_cur != rel_end) {
|
||||||
bool hidden = false;
|
bool hidden = rel_cur->getHidden();
|
||||||
uint64_t addr = rel_cur->getOffset();
|
uint64_t addr = rel_cur->getOffset();
|
||||||
SmallString<16> name;
|
SmallString<16> name;
|
||||||
SmallString<32> val;
|
SmallString<32> val;
|
||||||
|
|
||||||
// If this relocation is hidden, skip it.
|
// If this relocation is hidden, skip it.
|
||||||
if (error(rel_cur->getHidden(hidden))) goto skip_print_rel;
|
|
||||||
if (hidden) goto skip_print_rel;
|
if (hidden) goto skip_print_rel;
|
||||||
|
|
||||||
// Stop when rel_cur's address is past the current instruction.
|
// Stop when rel_cur's address is past the current instruction.
|
||||||
@ -929,12 +928,10 @@ void llvm::PrintRelocations(const ObjectFile *Obj) {
|
|||||||
continue;
|
continue;
|
||||||
outs() << "RELOCATION RECORDS FOR [" << secname << "]:\n";
|
outs() << "RELOCATION RECORDS FOR [" << secname << "]:\n";
|
||||||
for (const RelocationRef &Reloc : Section.relocations()) {
|
for (const RelocationRef &Reloc : Section.relocations()) {
|
||||||
bool hidden;
|
bool hidden = Reloc.getHidden();
|
||||||
uint64_t address = Reloc.getOffset();
|
uint64_t address = Reloc.getOffset();
|
||||||
SmallString<32> relocname;
|
SmallString<32> relocname;
|
||||||
SmallString<32> valuestr;
|
SmallString<32> valuestr;
|
||||||
if (error(Reloc.getHidden(hidden)))
|
|
||||||
continue;
|
|
||||||
if (hidden)
|
if (hidden)
|
||||||
continue;
|
continue;
|
||||||
if (error(Reloc.getTypeName(relocname)))
|
if (error(Reloc.getTypeName(relocname)))
|
||||||
|
Reference in New Issue
Block a user