Skip to content

Commit 0cddc39

Browse files
committed
[Support] Implement llvm::Registry::iterator via llvm_iterator_facade
Summary: Among other things, this allows using STL algorithms like 'find_if' over llvm::Registry. Reviewers: sammccall Reviewed By: sammccall Subscribers: kristina, llvm-commits Differential Revision: https://reviews.llvm.org/D56854 llvm-svn: 351566
1 parent 826ef59 commit 0cddc39

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/include/llvm/Support/Registry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ namespace llvm {
8181

8282
/// Iterators for registry entries.
8383
///
84-
class iterator {
84+
class iterator
85+
: public llvm::iterator_facade_base<iterator, std::forward_iterator_tag,
86+
const entry> {
8587
const node *Cur;
8688

8789
public:
8890
explicit iterator(const node *N) : Cur(N) {}
8991

9092
bool operator==(const iterator &That) const { return Cur == That.Cur; }
91-
bool operator!=(const iterator &That) const { return Cur != That.Cur; }
9293
iterator &operator++() { Cur = Cur->Next; return *this; }
9394
const entry &operator*() const { return Cur->Val; }
94-
const entry *operator->() const { return &Cur->Val; }
9595
};
9696

9797
// begin is not defined here in order to avoid usage of an undefined static

0 commit comments

Comments
 (0)