Simplify the logic, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240554 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-06-24 17:08:44 +00:00
parent 0502ac4036
commit 9a5f962059

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();
}