llvm.org GIT mirror llvm / 4a20c7a
1. Allow SCCIterator to work with GraphT types that are constant. 2. Allow SCCIterator to work with inverse graphs. 3. Fix an incorrect comment in GraphTraits.h (the type in the comment was given as GraphType* when it is actually const GraphType &). Patch by Patrick Alexander Simmons. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89091 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 10 years ago
2 changed file(s) with 15 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
2929 // typedef NodeType - Type of Node in the graph
3030 // typedef ChildIteratorType - Type used to iterate over children in graph
3131
32 // static NodeType *getEntryNode(GraphType *)
32 // static NodeType *getEntryNode(const GraphType &)
3333 // Return the entry node of the graph
3434
3535 // static ChildIteratorType child_begin(NodeType *)
135135 typedef scc_iterator _Self;
136136
137137 // Provide static "constructors"...
138 static inline _Self begin(GraphT& G) { return _Self(GT::getEntryNode(G)); }
139 static inline _Self end (GraphT& G) { return _Self(); }
138 static inline _Self begin(const GraphT& G) { return _Self(GT::getEntryNode(G)); }
139 static inline _Self end (const GraphT& G) { return _Self(); }
140140
141141 // Direct loop termination test (I.fini() is more efficient than I == end())
142142 inline bool fini() const {
185185
186186 // Global constructor for the SCC iterator.
187187 template
188 scc_iterator scc_begin(T G) {
188 scc_iterator scc_begin(const T& G) {
189189 return scc_iterator::begin(G);
190190 }
191191
192192 template
193 scc_iterator scc_end(T G) {
193 scc_iterator scc_end(const T& G) {
194194 return scc_iterator::end(G);
195195 }
196196
197 template
198 scc_iterator > scc_begin(const Inverse& G) {
199 return scc_iterator >::begin(G);
200 }
201
202 template
203 scc_iterator > scc_end(const Inverse& G) {
204 return scc_iterator >::end(G);
205 }
206
197207 } // End llvm namespace
198208
199209 #endif