Use ErrorOr in getRelocationAdress.

We can probably do better in this method, but this is an improvement and
enables further ErrorOr cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241114 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-06-30 20:32:26 +00:00
parent d231306ba8
commit 28a83187a2
8 changed files with 20 additions and 32 deletions

View File

@ -595,15 +595,13 @@ void MachOObjectFile::moveRelocationNext(DataRefImpl &Rel) const {
++Rel.d.b;
}
std::error_code MachOObjectFile::getRelocationAddress(DataRefImpl Rel,
uint64_t &Res) const {
ErrorOr<uint64_t> MachOObjectFile::getRelocationAddress(DataRefImpl Rel) const {
uint64_t Offset = getRelocationOffset(Rel);
DataRefImpl Sec;
Sec.d.a = Rel.d.a;
uint64_t SecAddress = getSectionAddress(Sec);
Res = SecAddress + Offset;
return std::error_code();
return SecAddress + Offset;
}
uint64_t MachOObjectFile::getRelocationOffset(DataRefImpl Rel) const {