diff options
Diffstat (limited to 'contrib/llvm/tools/clang/include/clang/AST/UsuallyTinyPtrVector.h')
-rw-r--r-- | contrib/llvm/tools/clang/include/clang/AST/UsuallyTinyPtrVector.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/contrib/llvm/tools/clang/include/clang/AST/UsuallyTinyPtrVector.h b/contrib/llvm/tools/clang/include/clang/AST/UsuallyTinyPtrVector.h index 5ee40e0..534d4d4 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/UsuallyTinyPtrVector.h +++ b/contrib/llvm/tools/clang/include/clang/AST/UsuallyTinyPtrVector.h @@ -41,6 +41,7 @@ public: typedef const T **iterator; iterator begin() const; iterator end() const; + size_t size() const; void push_back(T *Method); void Destroy(); @@ -56,7 +57,6 @@ UsuallyTinyPtrVector<T>::begin() const { return &Vec->front(); } - template<typename T> typename UsuallyTinyPtrVector<T>::iterator UsuallyTinyPtrVector<T>::end() const { @@ -72,6 +72,15 @@ UsuallyTinyPtrVector<T>::end() const { } template<typename T> +size_t UsuallyTinyPtrVector<T>::size() const { + if ((Storage & 0x01) == 0) + return (Storage == 0) ? 0 : 1; + + vector_type *Vec = reinterpret_cast<vector_type *>(Storage & ~0x01); + return Vec->size(); +} + +template<typename T> void UsuallyTinyPtrVector<T>::push_back(T *Element) { if (Storage == 0) { // 0 -> 1 element. |