This is an archive of the discontinued LLVM Phabricator instance.

ELF: Make Out<ELFT> initialization less error-prone.
Needs ReviewPublic

Authored by ruiu on Feb 3 2016, 12:24 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Previously, it was easy to leave some Out<ELFT> fields uninitialized
because assignments to the fields are mixed with output section
instantiations. In this patch, I separate initializations from assignments
to improve readability.

Diff Detail

Event Timeline

ruiu updated this revision to Diff 46817.Feb 3 2016, 12:24 PM
ruiu retitled this revision from to ELF: Make Out<ELFT> initialization less error-prone..
ruiu updated this object.
ruiu added a reviewer: silvas.
ruiu added a subscriber: llvm-commits.
ruiu updated this revision to Diff 46820.Feb 3 2016, 12:58 PM
  • Reorder code in writeResult
ruiu updated this revision to Diff 46821.Feb 3 2016, 1:00 PM
  • Removed unrelated change
ruiu added a comment.Feb 4 2016, 2:56 PM

OK to commit?

rafael added inline comments.
ELF/Writer.cpp
120

Why do these need to be std::uinque_ptr?

ruiu added a comment.Feb 4 2016, 2:59 PM

OK to commit?

ELF/Writer.cpp
120

Because we want to release the object at end of this function. (Does this answer to your question?)

silvas edited edge metadata.Feb 5 2016, 3:19 PM

This doesn't really seem to address the issue that concerned me that I brought up in the post-commit of r259444. The issue is that there is no single point of truth for resetting all the things inside Out.

I mean, the change seems like an okay cleanup, but it seems somewhat orthogonal to what I was saying.

ruiu added a comment.Feb 5 2016, 4:05 PM

Sean,

I applied your patch and experimented with that for a while, but I didn't like the repetation of OutTy and Out field initialization code. If we can use the template variable, it would be to fine, so I want to wait for the project to switch to C++14.

silvas resigned from this revision.Jul 8 2016, 11:43 PM
silvas removed a reviewer: silvas.