[llvm] bbf01f9 - [ADT] Take graph as const & in some post-order iterators (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 17 09:12:52 PDT 2021
Author: Florian Hahn
Date: 2021-04-17T17:05:24+01:00
New Revision: bbf01f96b5ccc1dcb4d1d47cb55292c27c698dbb
URL: https://github.com/llvm/llvm-project/commit/bbf01f96b5ccc1dcb4d1d47cb55292c27c698dbb
DIFF: https://github.com/llvm/llvm-project/commit/bbf01f96b5ccc1dcb4d1d47cb55292c27c698dbb.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/ADT/PostOrderIterator.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/PostOrderIterator.h b/llvm/include/llvm/ADT/PostOrderIterator.h
index 9586a8f3c8ee..3ab76d7cf740 100644
--- a/llvm/include/llvm/ADT/PostOrderIterator.h
+++ b/llvm/include/llvm/ADT/PostOrderIterator.h
@@ -140,15 +140,15 @@ class po_iterator : public po_iterator_storage<SetType, ExtStorage> {
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;
More information about the llvm-commits
mailing list