This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readob] - Refactor printing of sections flags. NFCI.
ClosedPublic

Authored by grimar on Dec 17 2019, 1:28 AM.

Details

Summary

This is a natural clean-up after D71462/D71464.
It allows to define known section letters used for GNU style
in one place.

Diff Detail

Event Timeline

grimar created this revision.Dec 17 2019, 1:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 17 2019, 1:28 AM
grimar updated this revision to Diff 234243.Dec 17 2019, 1:32 AM
  • A better helper function name.
jhenderson added inline comments.Dec 17 2019, 2:25 AM
llvm/tools/llvm-readobj/ELFDumper.cpp
1455

Honestly, it seems a little weird to have this inconsistency in the different macros. As far as I can see, the only difference is to provide an AltName field, right? Would it be a good idea to change all the other flags to use ENUM_ENT, perhaps with an empty AltName?

This would also help ensure that people consider what, if any, GNU flag letter a new flag should have, and would also allow us to avoid the situation where some flags for a target might have a GNU representation, but not others.

1527–1529

With my suggestion above, this would then become a check against the empty string, which feels less fragile to me.

grimar updated this revision to Diff 234260.Dec 17 2019, 3:32 AM
grimar marked 2 inline comments as done.
  • Addressed review comments.
llvm/tools/llvm-readobj/ELFDumper.cpp
1455

OK.

jhenderson accepted this revision.Dec 17 2019, 3:55 AM

LGTM, with one comment.

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

are known to be unused for the GNU style -> are not printed in GNU style

This revision is now accepted and ready to land.Dec 17 2019, 3:55 AM
This revision was automatically updated to reflect the committed changes.