This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] Change errors to warnings for symbol section name dumping
ClosedPublic

Authored by MaskRay on Jul 7 2023, 4:06 PM.

Details

Summary

Port D69671 (llvm-readobj) to llvm-objdump. Add a class llvm::objdump::Dumper
and move some free functions into Dumper so that they can call
reportUniqueWarning.

Warnings seems preferable in these cases as the issue is localized and we can
continue dumping other information.

Diff Detail

Event Timeline

MaskRay created this revision.Jul 7 2023, 4:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2023, 4:06 PM
Herald added a subscriber: emaste. · View Herald Transcript
MaskRay requested review of this revision.Jul 7 2023, 4:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2023, 4:06 PM
MaskRay updated this revision to Diff 538298.Jul 7 2023, 5:09 PM
MaskRay edited the summary of this revision. (Show Details)

implement reportUniqueWarning

MaskRay updated this revision to Diff 538299.Jul 7 2023, 5:11 PM

simplify printRelocations

mtrofin added inline comments.Jul 7 2023, 5:52 PM
llvm/tools/llvm-objdump/llvm-objdump.h
68

nit: final

68

How about renaming this to WarningsCollector and scoping it down to just managing the warnings, and then the print functions that can tolerate failures take it as a parameter (instead of being its members)?

MaskRay marked 2 inline comments as done.Jul 8 2023, 12:12 AM
MaskRay added inline comments.
llvm/tools/llvm-objdump/llvm-objdump.h
68

There is no virtual function so I think adding final has no performance advantage. I think we will soon derive llvm::objdump::Dumper like we do for llvm::ObjDumper (llvm/tools/llvm-readobj/ObjDumper.h). So adding final here will lead to one extra line diff in the future...

The name Dumper is to match llvm-readobj. In the future, we shall probably move more print* functions into member functions and extend Dumper with more states, so I think Dumper is proper.

mtrofin accepted this revision.Jul 10 2023, 8:58 AM
mtrofin added inline comments.
llvm/tools/llvm-objdump/llvm-objdump.h
68

I see - could you put a TODO comment on top of Dumper, then, so the design intent is clear during the period when not all of the print functions have been moved - I assume doing that (the move) in this patch would be overkill?

This revision is now accepted and ready to land.Jul 10 2023, 8:58 AM
MaskRay updated this revision to Diff 538715.Jul 10 2023, 10:14 AM
MaskRay marked 2 inline comments as done.

add a TODO to dumpObject in llvm-objdump.cpp

MaskRay added inline comments.Jul 10 2023, 10:49 AM
llvm/tools/llvm-objdump/llvm-objdump.h
68

Thank you! I am going to add the comment to dumpObject beside those print* free function calls to remind myself and future contributors.

JestrTulip accepted this revision.Jul 10 2023, 10:58 AM