This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Refactoring of end/edata/etext implementation.
ClosedPublic

Authored by grimar on Apr 14 2016, 5:56 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 53696.Apr 14 2016, 5:56 AM
grimar retitled this revision from to [ELF] - Refactoring of end/edata/etext implementation..
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
rafael accepted this revision.Apr 14 2016, 6:59 AM
rafael edited edge metadata.

LGTM with nits.

ELF/Symbols.h
393 ↗(On Diff #53696)

SymPair maybe?

ELF/Writer.cpp
1665 ↗(On Diff #53696)

This can be a static function, no need to make it a lambda.

This revision is now accepted and ready to land.Apr 14 2016, 6:59 AM
This revision was automatically updated to reflect the committed changes.
grimar added inline comments.Apr 14 2016, 7:43 AM
ELF/Symbols.h
393 ↗(On Diff #53696)

Done.

ELF/Writer.cpp
1665 ↗(On Diff #53696)

Done.

ruiu edited edge metadata.Apr 14 2016, 9:47 AM

I probably wouldn't do that because it doesn't seem to be worth to create a new type. If you don't like the repetition of if (...) ... = Val;, then how about defining a helper lambda for assignment like this?

auto Set = [&](DefinedRegular<ELFT> *S, uint64_t V) { If (S) S->Value = V; }
In D19109#401395, @ruiu wrote:

I probably wouldn't do that because it doesn't seem to be worth to create a new type. If you don't like the repetition of if (...) ... = Val;, then how about defining a helper lambda for assignment like this?

auto Set = [&](DefinedRegular<ELFT> *S, uint64_t V) { If (S) S->Value = V; }

I would prefer mine version, I dont like not only repetitions of assignments, but also additional variables declarations.
And that's not real type, just typedef for pair, so I dont find this to excessive.

But returning to subject - since that was already committed, do you think this should be reverted ?