From 0e8720653ed386e69b7c125aff787a75d41d6c4a Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 16 May 2016 21:57:47 +0000 Subject: Add a (size, value) constructor to TinyPtrVector. llvm-svn: 269711 --- llvm/include/llvm/ADT/TinyPtrVector.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'llvm') diff --git a/llvm/include/llvm/ADT/TinyPtrVector.h b/llvm/include/llvm/ADT/TinyPtrVector.h index bbe3f009b0b..605f0e70a85 100644 --- a/llvm/include/llvm/ADT/TinyPtrVector.h +++ b/llvm/include/llvm/ADT/TinyPtrVector.h @@ -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 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() const { -- cgit v1.2.3