[PATCH] D110885: [NFC][AttributeList] Replace index_begin/end with an iterator

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 30 19:18:17 PDT 2021


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: llvm/include/llvm/IR/Attributes.h:854
 
-  /// Use these to iterate over the valid attribute indices.
-  unsigned index_begin() const { return AttributeList::FunctionIndex; }
-  unsigned index_end() const { return getNumAttrSets() - 1; }
+  struct index_iterator {
+    unsigned NumAttrSets;
----------------
This deserves a comment just for consistency with the rest of these top-level members, even though it's a boring implementation detail of indexes().


================
Comment at: llvm/include/llvm/IR/Attributes.h:863
+      int_wrapper &operator++() {
+        ++i;
+        return *this;
----------------
It's probably worth a comment that this operation is expected to overflow & wrap.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110885



More information about the llvm-commits mailing list