This is an archive of the discontinued LLVM Phabricator instance.

[Object] Change ObjectFile::getSectionContents to use Expected
ClosedPublic

Authored by MaskRay on May 10 2019, 5:07 AM.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

MaskRay created this revision.May 10 2019, 5:07 AM
sbc100 accepted this revision.May 10 2019, 7:50 AM
sbc100 added inline comments.
llvm/include/llvm/Object/ObjectFile.h
458 ↗(On Diff #199004)

Looks like an opportunity for a followup change to propagate the use of ArrayRef here too?

This revision is now accepted and ready to land.May 10 2019, 7:50 AM
MaskRay marked an inline comment as done.May 10 2019, 9:14 AM
MaskRay added inline comments.
llvm/include/llvm/Object/ObjectFile.h
458 ↗(On Diff #199004)

Thanks for review! Yes, a few more functions to refactor. I didn't change this function in this patch because it has 48 references...

MaskRay marked an inline comment as done.May 12 2019, 11:00 PM
MaskRay added inline comments.
lld/COFF/Driver.cpp
866 ↗(On Diff #199004)

@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.

ruiu accepted this revision.May 13 2019, 6:08 AM

LGTM

lld/COFF/Driver.cpp
866 ↗(On Diff #199004)

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.

This revision was automatically updated to reflect the committed changes.