[ADT] Take graph as const & in some post-order iterators (NFC).
This patch updates a couple of functions that unnecessarily took the
input graph by value, when it was not needed. They can take the graph by
const-reference instead, which does not require GraphT to provide a copy
constructor.
Split off from D100169.
GitOrigin-RevId: bbf01f96b5ccc1dcb4d1d47cb55292c27c698dbb
diff --git a/include/llvm/ADT/PostOrderIterator.h b/include/llvm/ADT/PostOrderIterator.h
index 9586a8f..3ab76d7 100644
--- a/include/llvm/ADT/PostOrderIterator.h
+++ b/include/llvm/ADT/PostOrderIterator.h
@@ -140,15 +140,15 @@
public:
// Provide static "constructors"...
- static po_iterator begin(GraphT G) {
+ static po_iterator begin(const GraphT &G) {
return po_iterator(GT::getEntryNode(G));
}
- static po_iterator end(GraphT G) { return po_iterator(); }
+ static po_iterator end(const GraphT &G) { return po_iterator(); }
- static po_iterator begin(GraphT G, SetType &S) {
+ static po_iterator begin(const GraphT &G, SetType &S) {
return po_iterator(GT::getEntryNode(G), S);
}
- static po_iterator end(GraphT G, SetType &S) { return po_iterator(S); }
+ static po_iterator end(const GraphT &G, SetType &S) { return po_iterator(S); }
bool operator==(const po_iterator &x) const {
return VisitStack == x.VisitStack;