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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219235
91177308-0d34-0410-b5e6-
96231b3b80d8
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;
}