This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] - Stop using `unwrapOrError` in `DumpStyle<ELFT>::getGroups()`
ClosedPublic

Authored by grimar on Nov 20 2020, 6:10 AM.

Details

Summary

With this we are able to diagnose possible issues much better and
don't exit on an error.

Diff Detail

Event Timeline

grimar created this revision.Nov 20 2020, 6:10 AM
Herald added a project: Restricted Project. · View Herald Transcript
grimar requested review of this revision.Nov 20 2020, 6:10 AM
jhenderson added inline comments.Nov 23 2020, 12:21 AM
llvm/test/tools/llvm-readobj/ELF/groups.test
135

The string table isn't directly linked to a group section, so I found the origianl message slightly confusing.

187
283
llvm/tools/llvm-readobj/ELFDumper.cpp
3585

I don't like this function name. It implies it is solely for use by errors, which isn't the case. How about getSectionNameOrFallback?

grimar updated this revision to Diff 306983.Nov 23 2020, 1:27 AM
grimar marked 3 inline comments as done.
  • Addressed review comments.
llvm/tools/llvm-readobj/ELFDumper.cpp
3585

Done. 2 more possible names probably are: getSectionNameOrWarn or tryGetSectionName.

jhenderson accepted this revision.Nov 23 2020, 1:31 AM

LGTM.

llvm/test/tools/llvm-readobj/ELF/groups.test
187

Ping this?

llvm/tools/llvm-readobj/ELFDumper.cpp
3585

tryGetSectionName would work for me too. I'm happy with whichever you prefer. I'd probably not use getSectionNameOrWarn.

This revision is now accepted and ready to land.Nov 23 2020, 1:31 AM
grimar marked 2 inline comments as done.Nov 23 2020, 1:32 AM
grimar added inline comments.
llvm/test/tools/llvm-readobj/ELF/groups.test
187

Will fix. Sorry!

This revision was automatically updated to reflect the committed changes.
grimar marked 2 inline comments as done.