mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Don't return error_code from a function that doesn't fail.
llvm-svn: 241033
This commit is contained in:
parent
a3e07eb2de
commit
6f9850f8a9
@ -678,8 +678,7 @@ protected:
|
||||
uint64_t &Res) const override;
|
||||
uint64_t getRelocationOffset(DataRefImpl Rel) const override;
|
||||
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
|
||||
std::error_code getRelocationType(DataRefImpl Rel,
|
||||
uint64_t &Res) const override;
|
||||
uint64_t getRelocationType(DataRefImpl Rel) const override;
|
||||
std::error_code
|
||||
getRelocationTypeName(DataRefImpl Rel,
|
||||
SmallVectorImpl<char> &Result) const override;
|
||||
|
@ -233,8 +233,7 @@ protected:
|
||||
uint64_t &Res) const override;
|
||||
uint64_t getRelocationOffset(DataRefImpl Rel) const override;
|
||||
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
|
||||
std::error_code getRelocationType(DataRefImpl Rel,
|
||||
uint64_t &Res) const override;
|
||||
uint64_t getRelocationType(DataRefImpl Rel) const override;
|
||||
std::error_code
|
||||
getRelocationTypeName(DataRefImpl Rel,
|
||||
SmallVectorImpl<char> &Result) const override;
|
||||
@ -725,14 +724,12 @@ uint64_t ELFObjectFile<ELFT>::getROffset(DataRefImpl Rel) const {
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::getRelocationType(DataRefImpl Rel,
|
||||
uint64_t &Result) const {
|
||||
uint64_t ELFObjectFile<ELFT>::getRelocationType(DataRefImpl Rel) const {
|
||||
const Elf_Shdr *sec = getRelSection(Rel);
|
||||
if (sec->sh_type == ELF::SHT_REL)
|
||||
Result = getRel(Rel)->getType(EF.isMips64EL());
|
||||
return getRel(Rel)->getType(EF.isMips64EL());
|
||||
else
|
||||
Result = getRela(Rel)->getType(EF.isMips64EL());
|
||||
return std::error_code();
|
||||
return getRela(Rel)->getType(EF.isMips64EL());
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
|
@ -240,8 +240,7 @@ public:
|
||||
uint64_t getRelocationOffset(DataRefImpl Rel) const override;
|
||||
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
|
||||
section_iterator getRelocationSection(DataRefImpl Rel) const;
|
||||
std::error_code getRelocationType(DataRefImpl Rel,
|
||||
uint64_t &Res) const override;
|
||||
uint64_t getRelocationType(DataRefImpl Rel) const override;
|
||||
std::error_code
|
||||
getRelocationTypeName(DataRefImpl Rel,
|
||||
SmallVectorImpl<char> &Result) const override;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
std::error_code getAddress(uint64_t &Result) const;
|
||||
uint64_t getOffset() const;
|
||||
symbol_iterator getSymbol() const;
|
||||
std::error_code getType(uint64_t &Result) const;
|
||||
uint64_t getType() const;
|
||||
|
||||
/// @brief Indicates whether this relocation should hidden when listing
|
||||
/// relocations, usually because it is the trailing part of a multipart
|
||||
@ -242,8 +242,7 @@ protected:
|
||||
uint64_t &Res) const = 0;
|
||||
virtual uint64_t getRelocationOffset(DataRefImpl Rel) const = 0;
|
||||
virtual symbol_iterator getRelocationSymbol(DataRefImpl Rel) const = 0;
|
||||
virtual std::error_code getRelocationType(DataRefImpl Rel,
|
||||
uint64_t &Res) const = 0;
|
||||
virtual uint64_t getRelocationType(DataRefImpl Rel) const = 0;
|
||||
virtual std::error_code
|
||||
getRelocationTypeName(DataRefImpl Rel,
|
||||
SmallVectorImpl<char> &Result) const = 0;
|
||||
@ -464,8 +463,8 @@ inline symbol_iterator RelocationRef::getSymbol() const {
|
||||
return OwningObject->getRelocationSymbol(RelocationPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code RelocationRef::getType(uint64_t &Result) const {
|
||||
return OwningObject->getRelocationType(RelocationPimpl, Result);
|
||||
inline uint64_t RelocationRef::getType() const {
|
||||
return OwningObject->getRelocationType(RelocationPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code
|
||||
|
@ -668,8 +668,7 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj,
|
||||
uint64_t SectionSize = RelocatedSection->getSize();
|
||||
for (const RelocationRef &Reloc : Section.relocations()) {
|
||||
uint64_t Address = Reloc.getOffset();
|
||||
uint64_t Type;
|
||||
Reloc.getType(Type);
|
||||
uint64_t Type = Reloc.getType();
|
||||
uint64_t SymAddr = 0;
|
||||
uint64_t SectionLoadAddress = 0;
|
||||
object::symbol_iterator Sym = Reloc.getSymbol();
|
||||
|
@ -772,8 +772,7 @@ void RuntimeDyldELF::findOPDEntrySection(const ELFObjectFileBase &Obj,
|
||||
i != e;) {
|
||||
// The R_PPC64_ADDR64 relocation indicates the first field
|
||||
// of a .opd entry
|
||||
uint64_t TypeFunc;
|
||||
check(i->getType(TypeFunc));
|
||||
uint64_t TypeFunc = i->getType();
|
||||
if (TypeFunc != ELF::R_PPC64_ADDR64) {
|
||||
++i;
|
||||
continue;
|
||||
@ -790,8 +789,7 @@ void RuntimeDyldELF::findOPDEntrySection(const ELFObjectFileBase &Obj,
|
||||
break;
|
||||
|
||||
// Just check if following relocation is a R_PPC64_TOC
|
||||
uint64_t TypeTOC;
|
||||
check(i->getType(TypeTOC));
|
||||
uint64_t TypeTOC = i->getType();
|
||||
if (TypeTOC != ELF::R_PPC64_TOC)
|
||||
continue;
|
||||
|
||||
@ -1059,8 +1057,7 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
|
||||
unsigned SectionID, relocation_iterator RelI, const ObjectFile &O,
|
||||
ObjSectionToIDMap &ObjSectionToID, StubMap &Stubs) {
|
||||
const auto &Obj = cast<ELFObjectFileBase>(O);
|
||||
uint64_t RelType;
|
||||
Check(RelI->getType(RelType));
|
||||
uint64_t RelType = RelI->getType();
|
||||
ErrorOr<int64_t> AddendOrErr = ELFRelocationRef(*RelI).getAddend();
|
||||
int64_t Addend = AddendOrErr ? *AddendOrErr : 0;
|
||||
elf_symbol_iterator Symbol = RelI->getSymbol();
|
||||
|
@ -125,8 +125,7 @@ public:
|
||||
const bool IsExtern = SecI == Obj.section_end();
|
||||
|
||||
// Determine the Addend used to adjust the relocation value.
|
||||
uint64_t RelType;
|
||||
Check(RelI->getType(RelType));
|
||||
uint64_t RelType = RelI->getType();
|
||||
uint64_t Offset = RelI->getOffset();
|
||||
uint64_t Addend = 0;
|
||||
SectionEntry &Section = Sections[SectionID];
|
||||
|
@ -990,11 +990,9 @@ symbol_iterator COFFObjectFile::getRelocationSymbol(DataRefImpl Rel) const {
|
||||
return symbol_iterator(SymbolRef(Ref, this));
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::getRelocationType(DataRefImpl Rel,
|
||||
uint64_t &Res) const {
|
||||
uint64_t COFFObjectFile::getRelocationType(DataRefImpl Rel) const {
|
||||
const coff_relocation* R = toRel(Rel);
|
||||
Res = R->Type;
|
||||
return std::error_code();
|
||||
return R->Type;
|
||||
}
|
||||
|
||||
const coff_section *
|
||||
|
@ -654,19 +654,16 @@ MachOObjectFile::getRelocationSection(DataRefImpl Rel) const {
|
||||
return section_iterator(getAnyRelocationSection(getRelocation(Rel)));
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::getRelocationType(DataRefImpl Rel,
|
||||
uint64_t &Res) const {
|
||||
uint64_t MachOObjectFile::getRelocationType(DataRefImpl Rel) const {
|
||||
MachO::any_relocation_info RE = getRelocation(Rel);
|
||||
Res = getAnyRelocationType(RE);
|
||||
return std::error_code();
|
||||
return getAnyRelocationType(RE);
|
||||
}
|
||||
|
||||
std::error_code
|
||||
MachOObjectFile::getRelocationTypeName(DataRefImpl Rel,
|
||||
SmallVectorImpl<char> &Result) const {
|
||||
StringRef res;
|
||||
uint64_t RType;
|
||||
getRelocationType(Rel, RType);
|
||||
uint64_t RType = getRelocationType(Rel);
|
||||
|
||||
unsigned Arch = this->getArch();
|
||||
|
||||
@ -776,8 +773,7 @@ MachOObjectFile::getRelocationTypeName(DataRefImpl Rel,
|
||||
std::error_code MachOObjectFile::getRelocationHidden(DataRefImpl Rel,
|
||||
bool &Result) const {
|
||||
unsigned Arch = getArch();
|
||||
uint64_t Type;
|
||||
getRelocationType(Rel, Type);
|
||||
uint64_t Type = getRelocationType(Rel);
|
||||
|
||||
Result = false;
|
||||
|
||||
@ -791,8 +787,7 @@ std::error_code MachOObjectFile::getRelocationHidden(DataRefImpl Rel,
|
||||
if (Type == MachO::X86_64_RELOC_UNSIGNED && Rel.d.a > 0) {
|
||||
DataRefImpl RelPrev = Rel;
|
||||
RelPrev.d.a--;
|
||||
uint64_t PrevType;
|
||||
getRelocationType(RelPrev, PrevType);
|
||||
uint64_t PrevType = getRelocationType(RelPrev);
|
||||
if (PrevType == MachO::X86_64_RELOC_SUBTRACTOR)
|
||||
Result = true;
|
||||
}
|
||||
|
@ -208,10 +208,7 @@ LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI) {
|
||||
}
|
||||
|
||||
uint64_t LLVMGetRelocationType(LLVMRelocationIteratorRef RI) {
|
||||
uint64_t ret;
|
||||
if (std::error_code ec = (*unwrap(RI))->getType(ret))
|
||||
report_fatal_error(ec.message());
|
||||
return ret;
|
||||
return (*unwrap(RI))->getType();
|
||||
}
|
||||
|
||||
// NOTE: Caller takes ownership of returned string.
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
X86_64ELFRelocationInfo(MCContext &Ctx) : MCRelocationInfo(Ctx) {}
|
||||
|
||||
const MCExpr *createExprForRelocation(RelocationRef Rel) override {
|
||||
uint64_t RelType; Rel.getType(RelType);
|
||||
uint64_t RelType = Rel.getType();
|
||||
elf_symbol_iterator SymI = Rel.getSymbol();
|
||||
|
||||
StringRef SymName; SymI->getName(SymName);
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
const MCExpr *createExprForRelocation(RelocationRef Rel) override {
|
||||
const MachOObjectFile *Obj = cast<MachOObjectFile>(Rel.getObject());
|
||||
|
||||
uint64_t RelType; Rel.getType(RelType);
|
||||
uint64_t RelType = Rel.getType();
|
||||
symbol_iterator SymI = Rel.getSymbol();
|
||||
|
||||
StringRef SymName; SymI->getName(SymName);
|
||||
|
@ -804,11 +804,9 @@ void COFFDumper::printRelocations() {
|
||||
void COFFDumper::printRelocation(const SectionRef &Section,
|
||||
const RelocationRef &Reloc) {
|
||||
uint64_t Offset = Reloc.getOffset();
|
||||
uint64_t RelocType;
|
||||
uint64_t RelocType = Reloc.getType();
|
||||
SmallString<32> RelocName;
|
||||
StringRef SymbolName;
|
||||
if (error(Reloc.getType(RelocType)))
|
||||
return;
|
||||
if (error(Reloc.getTypeName(RelocName)))
|
||||
return;
|
||||
symbol_iterator Symbol = Reloc.getSymbol();
|
||||
|
Loading…
x
Reference in New Issue
Block a user