Skip to content

Commit 31e6dbf

Browse files
committed
IR: Expose Module::rbegin() and rend()
A follow-up commit for PR5680 needs to visit functions in reverse order. Expose iterators to allow that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214121 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent b6f1c15 commit 31e6dbf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/llvm/IR/Module.h

+9
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ class Module {
137137
/// The Function constant iterator
138138
typedef FunctionListType::const_iterator const_iterator;
139139

140+
/// The Function reverse iterator.
141+
typedef FunctionListType::reverse_iterator reverse_iterator;
142+
/// The Function constant reverse iterator.
143+
typedef FunctionListType::const_reverse_iterator const_reverse_iterator;
144+
140145
/// The Global Alias iterators.
141146
typedef AliasListType::iterator alias_iterator;
142147
/// The Global Alias constant iterator
@@ -546,6 +551,10 @@ class Module {
546551
const_iterator begin() const { return FunctionList.begin(); }
547552
iterator end () { return FunctionList.end(); }
548553
const_iterator end () const { return FunctionList.end(); }
554+
reverse_iterator rbegin() { return FunctionList.rbegin(); }
555+
const_reverse_iterator rbegin() const{ return FunctionList.rbegin(); }
556+
reverse_iterator rend() { return FunctionList.rend(); }
557+
const_reverse_iterator rend() const { return FunctionList.rend(); }
549558
size_t size() const { return FunctionList.size(); }
550559
bool empty() const { return FunctionList.empty(); }
551560

0 commit comments

Comments
 (0)