[PATCH] D56854: [Support] Implement llvm::Registry::iterator via llvm_iterator_facade

Ilya Biryukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 18 09:32:07 PST 2019


ilya-biryukov updated this revision to Diff 182540.
ilya-biryukov added a comment.

- Move to the monorepo


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56854/new/

https://reviews.llvm.org/D56854

Files:
  llvm/include/llvm/Support/Registry.h


Index: llvm/include/llvm/Support/Registry.h
===================================================================
--- llvm/include/llvm/Support/Registry.h
+++ llvm/include/llvm/Support/Registry.h
@@ -81,17 +81,17 @@
 
     /// 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56854.182540.patch
Type: text/x-patch
Size: 977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190118/c06f2022/attachment.bin>


More information about the llvm-commits mailing list