[llvm] r232314 - Restore the gcc build

David Majnemer david.majnemer at gmail.com
Sat Mar 14 23:47:48 PDT 2015


On Sat, Mar 14, 2015 at 11:39 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

> +dblaikie
>
> > On 2015 Mar 14, at 23:11, David Majnemer <david.majnemer at gmail.com>
> wrote:
> >
> > Author: majnemer
> > Date: Sun Mar 15 01:11:24 2015
> > New Revision: 232314
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=232314&view=rev
> > Log:
> > Restore the gcc build
> >
> > Modified:
> >    llvm/trunk/include/llvm/ADT/ImmutableSet.h
> >
> > Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=232314&r1=232313&r2=232314&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
> > +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Sun Mar 15 01:11:24 2015
> > @@ -652,6 +652,7 @@ public:
> >                    Flags=0x3 };
> >
> >   typedef ImutAVLTree<ImutInfo> TreeTy;
> > +  typedef ImutAVLTreeGenericIterator<ImutInfo> Self;
> >
> >   ImutAVLTreeGenericIterator() {}
> >   ImutAVLTreeGenericIterator(const TreeTy *Root) {
> > @@ -692,15 +693,11 @@ public:
> >     }
> >   }
> >
> > -  bool operator==(const ImutAVLTreeGenericIterator &x) const {
> > -    return stack == x.stack;
> > -  }
> > +  bool operator==(const Self &x) const { return stack == x.stack; }
>
> (I'm guessing this was in response to r232312?)
>

I did this because of a build failure introduced by r232309.


>
> What was the error here?  This code looks correct to me, and I'm surprised
> GCC has problems.  A comment in the code would be nice, too.
>

GCC was upset about `typedef ImutAVLTreeGenericIterator<ImutInfo>
ImutAVLTreeGenericIterator;`.
The diagnostic was something on the order of:
  declaration of 'typedef ImutAVLTreeGenericIterator<ImutInfo>
ImutAVLTreeGenericIterator'
  changes meaning of 'ImutAVLTreeGenericIterator' from 'struct
ImutAVLTreeGenericIterator'


>
> Bike-shed on naming, but maybe `SelfTy` would be more clear?
>

The original code had `typedef ImutAVLTreeGenericIterator<ImutInfo>
_Self;`, either would be fine with me.


>
> >
> > -  bool operator!=(const ImutAVLTreeGenericIterator &x) const {
> > -    return !(*this == x);
> > -  }
> > +  bool operator!=(const Self &x) const { return !operator==(x); }
> >
> > -  ImutAVLTreeGenericIterator &operator++() {
> > +  Self &operator++() {
> >     assert(!stack.empty());
> >     TreeTy* Current = reinterpret_cast<TreeTy*>(stack.back() & ~Flags);
> >     assert(Current);
> > @@ -726,7 +723,7 @@ public:
> >     return *this;
> >   }
> >
> > -  ImutAVLTreeGenericIterator &operator--() {
> > +  Self &operator--() {
> >     assert(!stack.empty());
> >     TreeTy* Current = reinterpret_cast<TreeTy*>(stack.back() & ~Flags);
> >     assert(Current);
> > @@ -759,7 +756,7 @@ class ImutAVLTreeInOrderIterator {
> >
> > public:
> >   typedef ImutAVLTree<ImutInfo> TreeTy;
> > -  typedef ImutAVLTreeInOrderIterator<ImutInfo>
> ImutAVLTreeGenericIterator;
> > +  typedef ImutAVLTreeInOrderIterator<ImutInfo> Self;
> >
> >   ImutAVLTreeInOrderIterator(const TreeTy* Root) : InternalItr(Root) {
> >     if (Root)
> > @@ -768,18 +765,14 @@ public:
> >
> >   ImutAVLTreeInOrderIterator() : InternalItr() {}
> >
> > -  bool operator==(const ImutAVLTreeGenericIterator &x) const {
> > -    return InternalItr == x.InternalItr;
> > -  }
> > +  bool operator==(const Self &x) const { return InternalItr ==
> x.InternalItr; }
> >
> > -  bool operator!=(const ImutAVLTreeGenericIterator &x) const {
> > -    return !(*this == x);
> > -  }
> > +  bool operator!=(const Self &x) const { return !(*this == x); }
> >
> >   TreeTy *operator*() const { return *InternalItr; }
> >   TreeTy *operator->() const { return *InternalItr; }
> >
> > -  ImutAVLTreeGenericIterator &operator++() {
> > +  Self &operator++() {
> >     do ++InternalItr;
> >     while (!InternalItr.atEnd() &&
> >            InternalItr.getVisitState() !=
> InternalIteratorTy::VisitedLeft);
> > @@ -787,7 +780,7 @@ public:
> >     return *this;
> >   }
> >
> > -  ImutAVLTreeGenericIterator &operator--() {
> > +  Self &operator--() {
> >     do --InternalItr;
> >     while (!InternalItr.atBeginning() &&
> >            InternalItr.getVisitState() !=
> InternalIteratorTy::VisitedLeft);
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150314/45a3f6c5/attachment.html>


More information about the llvm-commits mailing list