diff options
Diffstat (limited to 'include/llvm/ADT/TinyPtrVector.h')
-rw-r--r-- | include/llvm/ADT/TinyPtrVector.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/include/llvm/ADT/TinyPtrVector.h b/include/llvm/ADT/TinyPtrVector.h index cc0e7b63819c..5669b2a81a40 100644 --- a/include/llvm/ADT/TinyPtrVector.h +++ b/include/llvm/ADT/TinyPtrVector.h @@ -12,9 +12,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/PointerUnion.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/Support/Compiler.h" namespace llvm { @@ -70,9 +68,8 @@ public: return *this; } -#if LLVM_HAS_RVALUE_REFERENCES TinyPtrVector(TinyPtrVector &&RHS) : Val(RHS.Val) { - RHS.Val = (EltTy)0; + RHS.Val = (EltTy)nullptr; } TinyPtrVector &operator=(TinyPtrVector &&RHS) { if (this == &RHS) @@ -95,10 +92,9 @@ public: } Val = RHS.Val; - RHS.Val = (EltTy)0; + RHS.Val = (EltTy)nullptr; return *this; } -#endif // implicit conversion operator to ArrayRef. operator ArrayRef<EltTy>() const { @@ -178,7 +174,7 @@ public: } void push_back(EltTy NewVal) { - assert(NewVal != 0 && "Can't add a null value"); + assert(NewVal && "Can't add a null value"); // If we have nothing, add something. if (Val.isNull()) { @@ -199,7 +195,7 @@ public: void pop_back() { // If we have a single value, convert to empty. if (Val.template is<EltTy>()) - Val = (EltTy)0; + Val = (EltTy)nullptr; else if (VecTy *Vec = Val.template get<VecTy*>()) Vec->pop_back(); } @@ -207,7 +203,7 @@ public: void clear() { // If we have a single value, convert to empty. if (Val.template is<EltTy>()) { - Val = (EltTy)0; + Val = (EltTy)nullptr; } else if (VecTy *Vec = Val.template dyn_cast<VecTy*>()) { // If we have a vector form, just clear it. Vec->clear(); @@ -222,7 +218,7 @@ public: // If we have a single value, convert to empty. if (Val.template is<EltTy>()) { if (I == begin()) - Val = (EltTy)0; + Val = (EltTy)nullptr; } else if (VecTy *Vec = Val.template dyn_cast<VecTy*>()) { // multiple items in a vector; just do the erase, there is no // benefit to collapsing back to a pointer @@ -238,7 +234,7 @@ public: if (Val.template is<EltTy>()) { if (S == begin() && S != E) - Val = (EltTy)0; + Val = (EltTy)nullptr; } else if (VecTy *Vec = Val.template dyn_cast<VecTy*>()) { return Vec->erase(S, E); } @@ -250,7 +246,7 @@ public: assert(I <= this->end() && "Inserting past the end of the vector."); if (I == end()) { push_back(Elt); - return llvm::prior(end()); + return std::prev(end()); } assert(!Val.isNull() && "Null value with non-end insert iterator."); if (EltTy V = Val.template dyn_cast<EltTy>()) { @@ -273,7 +269,7 @@ public: // If we have a single value, convert to a vector. ptrdiff_t Offset = I - begin(); if (Val.isNull()) { - if (llvm::next(From) == To) { + if (std::next(From) == To) { Val = *From; return begin(); } |