<div dir="ltr">It's very helpful. Thank you for the tip. Committed a new change to remove the template parameters in r234913.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 8:33 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@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 Mon, Apr 13, 2015 at 11:58 PM, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
> Author: ruiu<br>
> Date: Tue Apr 14 01:58:47 2015<br>
> New Revision: 234865<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=234865&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=234865&view=rev</a><br>
> Log:<br>
> ELF: Fix odd initialization code.<br>
><br>
> Modified:<br>
>     lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h<br>
><br>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h?rev=234865&r1=234864&r2=234865&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h?rev=234865&r1=234864&r2=234865&view=diff</a><br>
> ==============================================================================<br>
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h (original)<br>
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h Tue Apr 14 01:58:47 2015<br>
> @@ -41,8 +41,7 @@ public:<br>
>    };<br>
><br>
>    HexagonTargetLayout(HexagonLinkingContext &ctx)<br>
> -      : TargetLayout<ELF32LE>(ctx),<br>
> -        _sdataSection(new (_alloc) SDataSection(ctx)) {}<br>
> +      : TargetLayout<ELF32LE>(ctx), _sdataSection(ctx) {}<br>
<br>
</span>Just as an aside, in case it's helpful, you can write the first<br>
initializer as "TargetLayout(ctx)" (assuming you aren't deriving from<br>
multiple different TargetLayout instantiations) (& in general,<br>
throughout the class, you can just refer to TargetLayout (eg, beloww<br>
in the parameter type you can write "TargetLayout::SectionOrder"<br>
instead of "TargetLayout<ELF32LE>::SectionOrder") without the template<br>
argument list).<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
>    /// \brief Return the section order for a input section<br>
>    TargetLayout<ELF32LE>::SectionOrder<br>
> @@ -75,7 +74,7 @@ public:<br>
>                  TargetLayout<ELF32LE>::SectionOrder sectionOrder) override {<br>
>      if ((contentType == DefinedAtom::typeDataFast) ||<br>
>         (contentType == DefinedAtom::typeZeroFillFast))<br>
> -      return _sdataSection;<br>
> +      return &_sdataSection;<br>
>      return TargetLayout<ELF32LE>::createSection(<br>
>          name, contentType, contentPermissions, sectionOrder);<br>
>    }<br>
> @@ -89,7 +88,7 @@ public:<br>
>      return TargetLayout<ELF32LE>::getSegmentType(section);<br>
>    }<br>
><br>
> -  Section<ELF32LE> *getSDataSection() const { return _sdataSection; }<br>
> +  Section<ELF32LE> *getSDataSection() { return &_sdataSection; }<br>
><br>
>    uint64_t getGOTSymAddr() {<br>
>      std::call_once(_gotOnce, [this]() {<br>
> @@ -100,8 +99,7 @@ public:<br>
>    }<br>
><br>
>  private:<br>
> -  llvm::BumpPtrAllocator _alloc;<br>
> -  SDataSection *_sdataSection = nullptr;<br>
> +  SDataSection _sdataSection;<br>
>    uint64_t _gotAddr = 0;<br>
>    std::once_flag _gotOnce;<br>
>  };<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>