This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] - Convert `ELFState<ELFT>::addSymbols` method to `toELFSymbols` helper.
ClosedPublic

Authored by grimar on Jun 18 2019, 6:56 AM.

Details

Summary

ELFState<ELFT>::addSymbols method looks a bit strange.
User code have to create the destination symbols vector outside,
add a null symbol and then pass it to addSymbols when it seems
the more natural logic is to isolate all work with symbols inside some
function, build the list right there and return it.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Jun 18 2019, 6:56 AM
grimar edited the summary of this revision. (Show Details)Jun 18 2019, 7:00 AM
jhenderson added inline comments.Jun 19 2019, 4:05 AM
tools/yaml2obj/yaml2elf.cpp
383 ↗(On Diff #205327)

Do you need this? I think the vector resize will do this automatically, if I'm not mistaken.

grimar marked an inline comment as done.Jun 19 2019, 4:21 AM
grimar added inline comments.
tools/yaml2obj/yaml2elf.cpp
383 ↗(On Diff #205327)

Yes, I think you're right. I'll remove this.

MaskRay accepted this revision.Jun 19 2019, 6:12 AM
This revision is now accepted and ready to land.Jun 19 2019, 6:12 AM
grimar updated this revision to Diff 205783.Jun 20 2019, 5:10 AM
  • Removed memset.

James, are you happy with that version?

jhenderson accepted this revision.Jun 20 2019, 5:43 AM

Yes, LGTM.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2019, 7:44 AM