Optimize COFFObjectFile::sectionContainsSymbol a bit.

There is no need to compute the coff_section of the symbol just to compare the
pointer.

Inspired by the ELF implementation.

llvm-svn: 219233
This commit is contained in:
Rafael Espindola
2014-10-07 20:42:47 +00:00
parent 5cbeb850fb
commit a92608657f

View File

@@ -347,13 +347,8 @@ std::error_code COFFObjectFile::sectionContainsSymbol(DataRefImpl SecRef,
bool &Result) const {
const coff_section *Sec = toSec(SecRef);
COFFSymbolRef Symb = getCOFFSymbol(SymbRef);
const coff_section *SymbSec = nullptr;
if (std::error_code EC = getSection(Symb.getSectionNumber(), SymbSec))
return EC;
if (SymbSec == Sec)
Result = true;
else
Result = false;
int32_t SecNumber = (Sec - SectionTable) + 1;
Result = SecNumber == Symb.getSectionNumber();
return object_error::success;
}