[llvm] [EquivClasses] Shorten members_{begin,end} idiom (PR #134373)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 4 06:33:21 PDT 2025


================
@@ -184,6 +185,14 @@ class EquivalenceClasses {
     return member_iterator(nullptr);
   }
 
+  iterator_range<member_iterator> members(const ECValue &ECV) const {
+    return make_range(member_begin(ECV), member_end());
+  }
+
+  iterator_range<member_iterator> members(const ElemTy &V) const {
----------------
artagnon wrote:

While I agree with your comment in principle, what I had earlier was members(getLeaderClass(V)), as none of the APIs return an ECValue, but figured that this was more trouble than it was worth.

I agree, EquivClass is already quite inconsistent, and I see that you also have some recent changes improving it: we can probably improve it some more, when we have some free cycles.

https://github.com/llvm/llvm-project/pull/134373


More information about the llvm-commits mailing list