Don't check for null after calling COFFObjectFile::toSec.

It can only return null if passed a corrupted reference with a null Ref.p.
Checking for null is then an issue for asserts to check for internal
consistency, not control flow to check for invalid input.

I didn't add an assert(sec != nullptr) because toSec itself has a far more
complete assert.

llvm-svn: 219235
This commit is contained in:
Rafael Espindola 2014-10-07 21:03:22 +00:00
parent b7bee50062
commit 506c684d55
1 changed files with 0 additions and 2 deletions

View File

@ -286,8 +286,6 @@ std::error_code COFFObjectFile::getSectionContents(DataRefImpl Ref,
std::error_code COFFObjectFile::getSectionAlignment(DataRefImpl Ref,
uint64_t &Res) const {
const coff_section *Sec = toSec(Ref);
if (!Sec)
return object_error::parse_failed;
Res = uint64_t(1) << (((Sec->Characteristics & 0x00F00000) >> 20) - 1);
return object_error::success;
}