[llvm] r207254 - SCC: Remove non-const operator*()
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Apr 25 11:26:45 PDT 2014
Author: dexonsmith
Date: Fri Apr 25 13:26:45 2014
New Revision: 207254
URL: http://llvm.org/viewvc/llvm-project?rev=207254&view=rev
Log:
SCC: Remove non-const operator*()
<rdar://problem/14292693>
Modified:
llvm/trunk/include/llvm/ADT/SCCIterator.h
Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SCCIterator.h?rev=207254&r1=207253&r2=207254&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SCCIterator.h (original)
+++ llvm/trunk/include/llvm/ADT/SCCIterator.h Fri Apr 25 13:26:45 2014
@@ -35,15 +35,17 @@ namespace llvm {
/// This is implemented using Tarjan's DFS algorithm using an internal stack to
/// build up a vector of nodes in a particular SCC. Note that it is a forward
/// iterator and thus you cannot backtrack or re-visit nodes.
-template <class GraphT, class GT = GraphTraits<GraphT> >
+template <class GraphT, class GT = GraphTraits<GraphT>>
class scc_iterator
: public std::iterator<std::forward_iterator_tag,
- std::vector<typename GT::NodeType>, ptrdiff_t> {
+ const std::vector<typename GT::NodeType>,
+ ptrdiff_t> {
typedef typename GT::NodeType NodeType;
typedef typename GT::ChildIteratorType ChildItTy;
typedef std::vector<NodeType *> SccTy;
typedef std::iterator<std::forward_iterator_tag,
- std::vector<typename GT::NodeType>, ptrdiff_t> super;
+ const std::vector<typename GT::NodeType>,
+ ptrdiff_t> super;
typedef typename super::reference reference;
typedef typename super::pointer pointer;
@@ -129,10 +131,6 @@ public:
assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");
return CurrentSCC;
}
- SccTy &operator*() {
- assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");
- return CurrentSCC;
- }
/// \brief Test if the current SCC has a loop.
///
More information about the llvm-commits
mailing list