<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 4, 2016 at 3:04 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 4 February 2016 at 17:59, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
> ruiu added a comment.<br>
><br>
> OK to commit?<br>
><br>
><br>
> ================<br>
> Comment at: ELF/Writer.cpp:120<br>
> @@ +119,3 @@<br>
> +<br>
> +  std::unique_ptr<GnuHashTableSection<ELFT>> GnuHashTab;<br>
> +  std::unique_ptr<GotPltSection<ELFT>> GotPlt;<br>
> ----------------<br>
> rafael wrote:<br>
>> Why do these need to be std::uinque_ptr?<br>
> Because we want to release the object at end of this function. (Does this answer to your question?)<br>
<br>
<br>
</span>What I meant was why use<br>
<span class=""><br>
std::unique_ptr<GnuHashTableSection<ELFT>> GnuHashTab;<br>
</span>...<br>
 if (Config->GnuHash)<br>
    GnuHashTab.reset(new GnuHashTableSection<ELFT>);<br>
...<br>
Out<ELFT>::GnuHashTab = GnuHashTab.get();<br>
<br>
instead of<br>
<br>
GnuHashTableSection<ELFT> GnuHashTab;<br>
...<br>
Out<ELFT>::GnuHashTab = Config->GnuHash ? &GnuHashTab : nullptr;<br></blockquote><div><br></div><div>That would create GnuHashTab whether it's going to be used or not, which I'd like to avoid.</div></div></div></div>