[llvm] r269711 - Add a (size, value) constructor to TinyPtrVector.
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon May 16 15:11:30 PDT 2016
Worth a unit test?
On Mon, May 16, 2016 at 2:57 PM, Richard Smith via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: rsmith
> Date: Mon May 16 16:57:47 2016
> New Revision: 269711
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269711&view=rev
> Log:
> Add a (size, value) constructor to TinyPtrVector.
>
> Modified:
> llvm/trunk/include/llvm/ADT/TinyPtrVector.h
>
> Modified: llvm/trunk/include/llvm/ADT/TinyPtrVector.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/TinyPtrVector.h?rev=269711&r1=269710&r2=269711&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/TinyPtrVector.h (original)
> +++ llvm/trunk/include/llvm/ADT/TinyPtrVector.h Mon May 16 16:57:47 2016
> @@ -104,8 +104,16 @@ public:
> /// This also is a constructor for individual array elements due to the
> single
> /// element constructor for ArrayRef.
> explicit TinyPtrVector(ArrayRef<EltTy> Elts)
> - : Val(Elts.size() == 1 ? PtrUnion(Elts[0])
> - : PtrUnion(new VecTy(Elts.begin(),
> Elts.end()))) {}
> + : Val(Elts.empty()
> + ? PtrUnion()
> + : Elts.size() == 1
> + ? PtrUnion(Elts[0])
> + : PtrUnion(new VecTy(Elts.begin(), Elts.end()))) {}
> +
> + TinyPtrVector(size_t Count, EltTy Value)
> + : Val(Count == 0 ? PtrUnion()
> + : Count == 1 ? PtrUnion(Value)
> + : PtrUnion(new VecTy(Count, Value)))
> {}
>
> // implicit conversion operator to ArrayRef.
> operator ArrayRef<EltTy>() const {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160516/8695a971/attachment.html>
More information about the llvm-commits
mailing list