From c57441f71621cb099cbee49f2e55e6333aafdb67 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 17 Mar 2015 05:49:45 +0000 Subject: [PATCH] Recommit simplification first attempted in r232309 (fixed a bit in r232312, with fixes in r232314) Messed it up because I didn't realize there were two different iterators here (& clearly didn't build any of this... ) - still seems easier to just use the injected class name than introduce a self typedef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232462 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/ImmutableSet.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/include/llvm/ADT/ImmutableSet.h b/include/llvm/ADT/ImmutableSet.h index e7d5e55ed6c..87026f019fe 100644 --- a/include/llvm/ADT/ImmutableSet.h +++ b/include/llvm/ADT/ImmutableSet.h @@ -654,7 +654,6 @@ public: Flags=0x3 }; typedef ImutAVLTree TreeTy; - typedef ImutAVLTreeGenericIterator SelfTy; ImutAVLTreeGenericIterator() {} ImutAVLTreeGenericIterator(const TreeTy *Root) { @@ -696,11 +695,15 @@ public: } } - bool operator==(const SelfTy &x) const { return stack == x.stack; } + bool operator==(const ImutAVLTreeGenericIterator &x) const { + return stack == x.stack; + } - bool operator!=(const SelfTy &x) const { return !operator==(x); } + bool operator!=(const ImutAVLTreeGenericIterator &x) const { + return !(*this == x); + } - SelfTy &operator++() { + ImutAVLTreeGenericIterator &operator++() { assert(!stack.empty()); TreeTy* Current = reinterpret_cast(stack.back() & ~Flags); assert(Current); @@ -726,7 +729,7 @@ public: return *this; } - SelfTy &operator--() { + ImutAVLTreeGenericIterator &operator--() { assert(!stack.empty()); TreeTy* Current = reinterpret_cast(stack.back() & ~Flags); assert(Current); @@ -761,7 +764,6 @@ class ImutAVLTreeInOrderIterator public: typedef ImutAVLTree TreeTy; - typedef ImutAVLTreeInOrderIterator SelfTy; ImutAVLTreeInOrderIterator(const TreeTy* Root) : InternalItr(Root) { if (Root) @@ -770,16 +772,18 @@ public: ImutAVLTreeInOrderIterator() : InternalItr() {} - bool operator==(const SelfTy &x) const { + bool operator==(const ImutAVLTreeInOrderIterator &x) const { return InternalItr == x.InternalItr; } - bool operator!=(const SelfTy &x) const { return !(*this == x); } + bool operator!=(const ImutAVLTreeInOrderIterator &x) const { + return !(*this == x); + } TreeTy &operator*() const { return *InternalItr; } TreeTy *operator->() const { return &*InternalItr; } - SelfTy &operator++() { + ImutAVLTreeInOrderIterator &operator++() { do ++InternalItr; while (!InternalItr.atEnd() && InternalItr.getVisitState() != InternalIteratorTy::VisitedLeft); @@ -787,7 +791,7 @@ public: return *this; } - SelfTy &operator--() { + ImutAVLTreeInOrderIterator &operator--() { do --InternalItr; while (!InternalItr.atBeginning() && InternalItr.getVisitState() != InternalIteratorTy::VisitedLeft); -- 2.40.0