<div dir="ltr">Worth a unit test?</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 16, 2016 at 2:57 PM, Richard Smith via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rsmith<br>
Date: Mon May 16 16:57:47 2016<br>
New Revision: 269711<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=269711&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=269711&view=rev</a><br>
Log:<br>
Add a (size, value) constructor to TinyPtrVector.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/ADT/TinyPtrVector.h<br>
<br>
Modified: llvm/trunk/include/llvm/ADT/TinyPtrVector.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/TinyPtrVector.h?rev=269711&r1=269710&r2=269711&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/TinyPtrVector.h?rev=269711&r1=269710&r2=269711&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ADT/TinyPtrVector.h (original)<br>
+++ llvm/trunk/include/llvm/ADT/TinyPtrVector.h Mon May 16 16:57:47 2016<br>
@@ -104,8 +104,16 @@ public:<br>
/// This also is a constructor for individual array elements due to the single<br>
/// element constructor for ArrayRef.<br>
explicit TinyPtrVector(ArrayRef<EltTy> Elts)<br>
- : Val(Elts.size() == 1 ? PtrUnion(Elts[0])<br>
- : PtrUnion(new VecTy(Elts.begin(), Elts.end()))) {}<br>
+ : Val(Elts.empty()<br>
+ ? PtrUnion()<br>
+ : Elts.size() == 1<br>
+ ? PtrUnion(Elts[0])<br>
+ : PtrUnion(new VecTy(Elts.begin(), Elts.end()))) {}<br>
+<br>
+ TinyPtrVector(size_t Count, EltTy Value)<br>
+ : Val(Count == 0 ? PtrUnion()<br>
+ : Count == 1 ? PtrUnion(Value)<br>
+ : PtrUnion(new VecTy(Count, Value))) {}<br>
<br>
// implicit conversion operator to ArrayRef.<br>
operator ArrayRef<EltTy>() const {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>