summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-01-18 17:30:49 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-01-18 17:30:49 +0000
commit0cddc39ffc8f02580791e3fa33ec3d1a9e795746 (patch)
tree9bb5efcc62a21c4408c5e3497b8ed7e5e8499e72
parent826ef59568af112d4eec30951f49df7f59789af1 (diff)
downloadbcm5719-llvm-0cddc39ffc8f02580791e3fa33ec3d1a9e795746.tar.gz
bcm5719-llvm-0cddc39ffc8f02580791e3fa33ec3d1a9e795746.zip
[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
-rw-r--r--llvm/include/llvm/Support/Registry.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/include/llvm/Support/Registry.h b/llvm/include/llvm/Support/Registry.h
index 02fd5b9354a..395745c6825 100644
--- a/llvm/include/llvm/Support/Registry.h
+++ b/llvm/include/llvm/Support/Registry.h
@@ -81,17 +81,17 @@ namespace llvm {
/// Iterators for registry entries.
///
- class iterator {
+ class iterator
+ : public llvm::iterator_facade_base<iterator, std::forward_iterator_tag,
+ const entry> {
const node *Cur;
public:
explicit iterator(const node *N) : Cur(N) {}
bool operator==(const iterator &That) const { return Cur == That.Cur; }
- bool operator!=(const iterator &That) const { return Cur != That.Cur; }
iterator &operator++() { Cur = Cur->Next; return *this; }
const entry &operator*() const { return Cur->Val; }
- const entry *operator->() const { return &Cur->Val; }
};
// begin is not defined here in order to avoid usage of an undefined static
OpenPOWER on IntegriCloud