1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Simplify the logic, NFC.

llvm-svn: 240554
This commit is contained in:
Rafael Espindola 2015-06-24 17:08:44 +00:00
parent 1b3d959d3c
commit 15227e024f

View File

@ -154,25 +154,21 @@ std::error_code COFFObjectFile::getSymbolAddress(DataRefImpl Ref,
uint64_t &Result) const {
COFFSymbolRef Symb = getCOFFSymbol(Ref);
if (Symb.isAnyUndefined()) {
Result = UnknownAddress;
return std::error_code();
}
if (Symb.isCommon()) {
if (Symb.isAnyUndefined() || Symb.isCommon()) {
Result = UnknownAddress;
return std::error_code();
}
int32_t SectionNumber = Symb.getSectionNumber();
if (!COFF::isReservedSectionNumber(SectionNumber)) {
const coff_section *Section = nullptr;
if (std::error_code EC = getSection(SectionNumber, Section))
return EC;
Result = Section->VirtualAddress + Symb.getValue();
if (COFF::isReservedSectionNumber(SectionNumber)) {
Result = Symb.getValue();
return std::error_code();
}
Result = Symb.getValue();
const coff_section *Section = nullptr;
if (std::error_code EC = getSection(SectionNumber, Section))
return EC;
Result = Section->VirtualAddress + Symb.getValue();
return std::error_code();
}