From: Rafael Espindola Date: Tue, 7 Oct 2014 21:03:22 +0000 (+0000) Subject: Don't check for null after calling COFFObjectFile::toSec. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=63cdf9f8da4065608e16317d4c84d4768a4c508d 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219235 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp index 6e1f6832674..be19847f6ac 100644 --- a/lib/Object/COFFObjectFile.cpp +++ b/lib/Object/COFFObjectFile.cpp @@ -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; }