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