This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj/elf] - Refine the implementation of "printFunctionStackSize".
ClosedPublic

Authored by grimar on Dec 2 2020, 11:22 PM.

Details

Summary

This rewrites the logic to get rid of "ELFSymbolRef" API where possible.
This allowed to handle possible errors better, improve warnings reported and add new ones.
Also 'reportWarning' was replaced with 'reportUniqueWarning'

Diff Detail

Event Timeline

grimar created this revision.Dec 2 2020, 11:22 PM
Herald added a project: Restricted Project. · View Herald Transcript
grimar requested review of this revision.Dec 2 2020, 11:22 PM
jhenderson added inline comments.Dec 7 2020, 1:25 AM
llvm/tools/llvm-readobj/ELFDumper.cpp
5804–5805

You've added several new warnings with this refactor. Does this comment still apply?

5834–5839

Should this not just be cantFail?

5867–5868

Are you planning on further improving these messages in another change? The offset would be useful here, for example.

(Suggested fix could be deferred too, if it causes too many test changes)

grimar updated this revision to Diff 309837.Dec 7 2020, 1:50 AM
grimar marked 3 inline comments as done.
  • Addressed review comments.
llvm/tools/llvm-readobj/ELFDumper.cpp
5804–5805

Probably we can remove it.

5834–5839

I am not sure.

cantFail looks like we give a guarantee for this condition to be always true. But this is not our intention.
This error currently can't be triggered because Obj.getSection API
is called somewhere inside ElfObj.toSymbolRef(SymTab, Index).getAddress(). But we don't give a guarantee here as
things are probably too brittle, unobvious and might change easily.

5867–5868

Are you planning on further improving these messages in another change? The offset would be useful here, for example.

I'll do it.

This revision is now accepted and ready to land.Dec 7 2020, 2:06 AM