IR: Expose Module::rbegin() and rend()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 28 Jul 2014 21:09:32 +0000 (21:09 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 28 Jul 2014 21:09:32 +0000 (21:09 +0000)
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

include/llvm/IR/Module.h

index 26f62db9db533ec90f33e02923d7fe64794f7496..1fdbf5d878b85f006a4937782333b30fedb87ff8 100644 (file)
@@ -137,6 +137,11 @@ public:
   /// The Function constant iterator
   typedef FunctionListType::const_iterator               const_iterator;
 
+  /// The Function reverse iterator.
+  typedef FunctionListType::reverse_iterator             reverse_iterator;
+  /// The Function constant reverse iterator.
+  typedef FunctionListType::const_reverse_iterator const_reverse_iterator;
+
   /// The Global Alias iterators.
   typedef AliasListType::iterator                        alias_iterator;
   /// The Global Alias constant iterator
@@ -546,6 +551,10 @@ public:
   const_iterator          begin() const { return FunctionList.begin(); }
   iterator                end  ()       { return FunctionList.end();   }
   const_iterator          end  () const { return FunctionList.end();   }
+  reverse_iterator        rbegin()      { return FunctionList.rbegin(); }
+  const_reverse_iterator  rbegin() const{ return FunctionList.rbegin(); }
+  reverse_iterator        rend()        { return FunctionList.rend(); }
+  const_reverse_iterator  rend() const  { return FunctionList.rend(); }
   size_t                  size() const  { return FunctionList.size(); }
   bool                    empty() const { return FunctionList.empty(); }