summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp6
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp15
-rw-r--r--llvm/lib/Object/Object.cpp5
3 files changed, 8 insertions, 18 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 6263d32db8c..733fd49ad77 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -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 *
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index ef8daacee14..5de72125afe 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -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;
}
diff --git a/llvm/lib/Object/Object.cpp b/llvm/lib/Object/Object.cpp
index 6c4bd3cdb88..aba9a449803 100644
--- a/llvm/lib/Object/Object.cpp
+++ b/llvm/lib/Object/Object.cpp
@@ -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.
OpenPOWER on IntegriCloud