diff options
Diffstat (limited to 'contrib/llvm/tools/clang/include/clang/AST/ASTVector.h')
-rw-r--r-- | contrib/llvm/tools/clang/include/clang/AST/ASTVector.h | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/contrib/llvm/tools/clang/include/clang/AST/ASTVector.h b/contrib/llvm/tools/clang/include/clang/AST/ASTVector.h index 6db918e..d92167e 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/ASTVector.h +++ b/contrib/llvm/tools/clang/include/clang/AST/ASTVector.h @@ -26,30 +26,6 @@ #include <cstring> #include <memory> -#ifdef _MSC_VER -namespace std { -#if _MSC_VER <= 1310 - // Work around flawed VC++ implementation of std::uninitialized_copy. Define - // additional overloads so that elements with pointer types are recognized as - // scalars and not objects, causing bizarre type conversion errors. - template<class T1, class T2> - inline _Scalar_ptr_iterator_tag _Ptr_cat(T1 **, T2 **) { - _Scalar_ptr_iterator_tag _Cat; - return _Cat; - } - - template<class T1, class T2> - inline _Scalar_ptr_iterator_tag _Ptr_cat(T1* const *, T2 **) { - _Scalar_ptr_iterator_tag _Cat; - return _Cat; - } -#else - // FIXME: It is not clear if the problem is fixed in VS 2005. What is clear - // is that the above hack won't work if it wasn't fixed. -#endif -} -#endif - namespace clang { class ASTContext; @@ -69,15 +45,30 @@ protected: public: // Default ctor - Initialize to empty. - ASTVector() : Begin(0), End(0), Capacity(0, false) {} + ASTVector() : Begin(nullptr), End(nullptr), Capacity(nullptr, false) {} + + ASTVector(ASTVector &&O) : Begin(O.Begin), End(O.End), Capacity(O.Capacity) { + O.Begin = O.End = nullptr; + O.Capacity.setPointer(nullptr); + O.Capacity.setInt(false); + } ASTVector(const ASTContext &C, unsigned N) - : Begin(0), End(0), Capacity(0, false) { + : Begin(nullptr), End(nullptr), Capacity(nullptr, false) { reserve(C, N); } + ASTVector &operator=(ASTVector &&RHS) { + ASTVector O(std::move(RHS)); + using std::swap; + swap(Begin, O.Begin); + swap(End, O.End); + swap(Capacity, O.Capacity); + return *this; + } + ~ASTVector() { - if (llvm::is_class<T>::value) { + if (std::is_class<T>::value) { // Destroy the constructed elements in the vector. destroy_range(Begin, End); } @@ -147,7 +138,7 @@ public: } void clear() { - if (llvm::is_class<T>::value) { + if (std::is_class<T>::value) { destroy_range(Begin, End); } End = Begin; @@ -392,7 +383,7 @@ void ASTVector<T>::grow(const ASTContext &C, size_t MinSize) { T *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity]; // Copy the elements over. - if (llvm::is_class<T>::value) { + if (std::is_class<T>::value) { std::uninitialized_copy(Begin, End, NewElts); // Destroy the original elements. destroy_range(Begin, End); |