Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 2f01b11

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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351566 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 3040d97 commit 2f01b11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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)