[lld] r196465 - Use makeArrayRef to construct ArrayRefs from C arrays.
Rui Ueyama
ruiu at google.com
Wed Dec 4 22:59:47 PST 2013
On Wed, Dec 4, 2013 at 10:18 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Wed, Dec 4, 2013 at 8:41 PM, Rui Ueyama <ruiu at google.com> wrote:
> > Author: ruiu
> > Date: Wed Dec 4 22:41:10 2013
> > New Revision: 196465
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=196465&view=rev
> > Log:
> > Use makeArrayRef to construct ArrayRefs from C arrays.
>
> ArrayRef does have implicit conversion from arrays (
>
> http://llvm.org/docs/doxygen/html/classllvm_1_1ArrayRef.html#aef393d65e1deaf4cc754849a16f6a163
> ) so you might not even need makeArrayRef in some (all?) of these
> cases. ma
Good point. We don't need makeArrayRef in all of these cases. Fixed
in r196475.
> >
> > Modified:
> > lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
> > lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
> >
> > Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp?rev=196465&r1=196464&r2=196465&view=diff
> >
> ==============================================================================
> > --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
> (original)
> > +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp Wed
> Dec 4 22:41:10 2013
> > @@ -12,9 +12,10 @@
> >
> > using namespace lld;
> > using namespace elf;
> > -
> > using namespace llvm::ELF;
> >
> > +using llvm::makeArrayRef;
> > +
> > HexagonTargetHandler::HexagonTargetHandler(HexagonLinkingContext
> &context)
> > : DefaultTargetHandler(context), _targetLayout(context),
> > _relocationHandler(context, *this, _targetLayout),
> > @@ -54,7 +55,7 @@ public:
> > HexagonGOTAtom(const File &f) : GOTAtom(f, ".got") {}
> >
> > virtual ArrayRef<uint8_t> rawContent() const {
> > - return ArrayRef<uint8_t>(hexagonGotAtomContent, 4);
> > + return makeArrayRef(hexagonGotAtomContent);
> > }
> >
> > virtual Alignment alignment() const { return Alignment(2); }
> > @@ -65,7 +66,7 @@ public:
> > HexagonGOTPLTAtom(const File &f) : GOTAtom(f, ".got.plt") {}
> >
> > virtual ArrayRef<uint8_t> rawContent() const {
> > - return ArrayRef<uint8_t>(hexagonGotPltAtomContent, 4);
> > + return makeArrayRef(hexagonGotPltAtomContent);
> > }
> >
> > virtual Alignment alignment() const { return Alignment(2); }
> > @@ -76,7 +77,7 @@ public:
> > HexagonGOTPLT0Atom(const File &f) : GOTAtom(f, ".got.plt") {}
> >
> > virtual ArrayRef<uint8_t> rawContent() const {
> > - return ArrayRef<uint8_t>(hexagonGotPlt0AtomContent, 16);
> > + return makeArrayRef(hexagonGotPlt0AtomContent);
> > }
> >
> > virtual Alignment alignment() const { return Alignment(3); }
> > @@ -91,7 +92,7 @@ public:
> > }
> >
> > virtual ArrayRef<uint8_t> rawContent() const {
> > - return ArrayRef<uint8_t>(hexagonPlt0AtomContent, 28);
> > + return makeArrayRef(hexagonPlt0AtomContent);
> > }
> > };
> >
> > @@ -101,7 +102,7 @@ public:
> > HexagonPLTAtom(const File &f, StringRef secName) : PLTAtom(f,
> secName) {}
> >
> > virtual ArrayRef<uint8_t> rawContent() const {
> > - return ArrayRef<uint8_t>(hexagonPltAtomContent, 16);
> > + return makeArrayRef(hexagonPltAtomContent);
> > }
> > };
> >
> >
> > Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp?rev=196465&r1=196464&r2=196465&view=diff
> >
> ==============================================================================
> > --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
> (original)
> > +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp Wed
> Dec 4 22:41:10 2013
> > @@ -21,6 +21,8 @@
> > using namespace lld;
> > using namespace lld::elf;
> >
> > +using llvm::makeArrayRef;
> > +
> > namespace {
> > using namespace llvm::ELF;
> >
> > @@ -37,7 +39,7 @@ public:
> > #endif
> > }
> > virtual ArrayRef<uint8_t> rawContent() const {
> > - return ArrayRef<uint8_t>(x86_64InitFiniAtomContent, 8);
> > + return makeArrayRef(x86_64InitFiniAtomContent);
> > }
> > virtual Alignment alignment() const { return Alignment(3); }
> > };
> > @@ -52,7 +54,7 @@ public:
> > #endif
> > }
> > virtual ArrayRef<uint8_t> rawContent() const {
> > - return ArrayRef<uint8_t>(x86_64InitFiniAtomContent, 8);
> > + return makeArrayRef(x86_64InitFiniAtomContent);
> > }
> >
> > virtual Alignment alignment() const { return Alignment(3); }
> >
> >
> > _______________________________________________
> > 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/20131204/9f88fb82/attachment.html>
More information about the llvm-commits
mailing list