[PATCH] D61781: [Object] Change ObjectFile::getSectionContents to use Expected
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 06:08:36 PDT 2019
ruiu accepted this revision.
ruiu added a comment.
LGTM
================
Comment at: lld/COFF/Driver.cpp:866
ArrayRef<uint8_t> Contents;
- Obj->getCOFFObj()->getSectionContents(Obj->AddrsigSec, Contents);
+ cantFail(Obj->getCOFFObj()->getSectionContents(Obj->AddrsigSec, Contents));
const uint8_t *Cur = Contents.begin();
----------------
MaskRay wrote:
> @ruiu What I am less confident is whether I should use `cantFail` here. If the error checking has been done before, `cantFail` is the best.
When we reach here, we are sure that Addrsig section exists. If we for some reason fail to get that section at this point, that indicates that there's a bug in lld or an input file is corrupted. In either case, aborting using `cantFail` is fine.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61781/new/
https://reviews.llvm.org/D61781
More information about the llvm-commits
mailing list