10 #ifndef LLVM_ADT_ARRAYREF_H
11 #define LLVM_ADT_ARRAYREF_H
58 : Data(&OneElt), Length(1) {}
62 : Data(data), Length(length) {}
66 : Data(begin), Length(end - begin) {}
73 : Data(Vec.
data()), Length(Vec.
size()) {
79 : Data(Vec.
data()), Length(Vec.
size()) {}
84 : Data(Arr), Length(N) {}
95 typename std::enable_if<
96 std::is_convertible<U *const *, T const *>::value>::type* = 0)
97 : Data(A.
data()), Length(A.
size()) {}
102 template<
typename U,
typename DummyT>
104 typename std::enable_if<
105 std::is_convertible<U *
const *,
106 T const *>::value>::type* = 0)
107 : Data(Vec.
data()), Length(Vec.
size()) {
112 template<
typename U,
typename A>
114 typename std::enable_if<
115 std::is_convertible<U *const *, T const *>::value>::type* = 0)
116 : Data(Vec.
data()), Length(Vec.
size()) {}
129 bool empty()
const {
return Length == 0; }
131 const T *
data()
const {
return Data; }
134 size_t size()
const {
return Length; }
145 return Data[Length-1];
150 T *Buff = A.template Allocate<T>(Length);
157 if (Length != RHS.Length)
166 assert(N <=
size() &&
"Invalid specifier");
173 assert(N+M <=
size() &&
"Invalid specifier");
179 assert(
size() >=
N &&
"Dropping more elements than exist");
187 assert(Index < Length &&
"Invalid index!");
194 std::vector<T>
vec()
const {
195 return std::vector<T>(Data, Data+Length);
201 operator std::vector<T>()
const {
202 return std::vector<T>(Data, Data+Length);
266 assert(!this->
empty());
272 assert(!this->
empty());
278 assert(N <= this->
size() &&
"Invalid specifier");
285 assert(N+M <= this->
size() &&
"Invalid specifier");
290 assert(this->
size() >= N &&
"Dropping more elements than exist");
298 assert(Index < this->
size() &&
"Invalid index!");
299 return data()[Index];
325 template <
typename T>
331 template <
typename T,
unsigned N>
343 template<
typename T,
size_t N>
359 return !(LHS == RHS);
const_iterator end(StringRef path)
Get end iterator over path.
const T & operator[](size_t Index) const
reverse_iterator rbegin() const
ArrayRef(const ArrayRef< U * > &A, typename std::enable_if< std::is_convertible< U *const *, T const * >::value >::type *=0)
Construct an ArrayRef<const T*> from ArrayRef<T*>.
NoneType
A simple null object to allow implicit construction of Optional<T> and similar types without having to ...
const T & front() const
front - Get the first element.
const_iterator begin(StringRef path)
Get begin iterator over path.
ArrayRef(NoneType)
Construct an empty ArrayRef from None.
MutableArrayRef(std::vector< T > &Vec)
Construct a MutableArrayRef from a std::vector.
ArrayRef< T > slice(unsigned N, unsigned M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array...
LLVM_CONSTEXPR MutableArrayRef(T(&Arr)[N])
Construct an MutableArrayRef from a C array.
LLVM_CONSTEXPR ArrayRef(const T(&Arr)[N])
Construct an ArrayRef from a C array.
ArrayRef< T > drop_back(unsigned N=1) const
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
ArrayRef(const std::vector< T, A > &Vec)
Construct an ArrayRef from a std::vector.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
ArrayRef(const std::initializer_list< T > &Vec)
Construct an ArrayRef from a std::initializer_list.
ArrayRef< T > copy(Allocator &A)
std::reverse_iterator< iterator > reverse_iterator
reverse_iterator rbegin() const
ArrayRef< T > slice(unsigned N) const
slice(n) - Chop off the first N elements of the array.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
MutableArrayRef< T > slice(unsigned N, unsigned M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array...
size_t size() const
size - Get the array size.
reverse_iterator rend() const
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
ArrayRef(const SmallVectorTemplateCommon< T, U > &Vec)
Construct an ArrayRef from a SmallVector.
MutableArrayRef(T *begin, T *end)
Construct an MutableArrayRef from a range.
reverse_iterator rend() const
ArrayRef()
Construct an empty ArrayRef.
A Counter mapping region associates a source range with a specific counter.
bool equals(ArrayRef RHS) const
equals - Check for element-wise equality.
bool empty() const
empty - Check if the array is empty.
MutableArrayRef()
Construct an empty MutableArrayRef.
const T & back() const
back - Get the last element.
ArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
isPodLike - This is a type trait that is used to determine whether a given type can be copied around ...
std::reverse_iterator< iterator > reverse_iterator
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
MutableArrayRef(T *data, size_t length)
Construct an MutableArrayRef from a pointer and length.
ArrayRef(const SmallVectorTemplateCommon< U *, DummyT > &Vec, typename std::enable_if< std::is_convertible< U *const *, T const * >::value >::type *=0)
Construct an ArrayRef<const T*> from a SmallVector<T*>.
MutableArrayRef(T &OneElt)
Construct an MutableArrayRef from a single element.
ArrayRef(const T *data, size_t length)
Construct an ArrayRef from a pointer and length.
MutableArrayRef< T > slice(unsigned N) const
slice(n) - Chop off the first N elements of the array.
bool operator!=(uint64_t V1, const APInt &V2)
This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD...
T & front() const
front - Get the first element.
ArrayRef(const T *begin, const T *end)
Construct an ArrayRef from a range.
T & operator[](size_t Index) const
bool operator==(uint64_t V1, const APInt &V2)
MutableArrayRef(NoneType)
Construct an empty MutableArrayRef from None.
MutableArrayRef(SmallVectorImpl< T > &Vec)
Construct an MutableArrayRef from a SmallVector.
T & back() const
back - Get the last element.
ArrayRef(const std::vector< U *, A > &Vec, typename std::enable_if< std::is_convertible< U *const *, T const * >::value >::type *=0)
Construct an ArrayRef<const T*> from std::vector<T*>.
std::vector< T > vec() const
MutableArrayRef< T > drop_back(unsigned N) const