diff --git a/llvm/include/llvm/ADT/DepthFirstIterator.h b/llvm/include/llvm/ADT/DepthFirstIterator.h --- a/llvm/include/llvm/ADT/DepthFirstIterator.h +++ b/llvm/include/llvm/ADT/DepthFirstIterator.h @@ -164,6 +164,7 @@ bool operator!=(const df_iterator &x) const { return !(*this == x); } const NodeRef &operator*() const { return VisitStack.back().first; } + NodeRef &operator*() { return VisitStack.back().first; } // This is a nonstandard operator-> that dereferences the pointer an extra // time... so that you can actually call methods ON the Node, because diff --git a/llvm/include/llvm/ADT/iterator.h b/llvm/include/llvm/ADT/iterator.h --- a/llvm/include/llvm/ADT/iterator.h +++ b/llvm/include/llvm/ADT/iterator.h @@ -268,7 +268,8 @@ return I < RHS.I; } - ReferenceT operator*() const { return *I; } + const ReferenceT operator*() const { return *I; } + ReferenceT operator*() { return *I; } }; /// An iterator type that allows iterating over the pointees via some