[llvm] [EquivClasses] Shorten members_{begin,end} idiom (PR #134373)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 4 06:25:35 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 {
----------------
fhahn wrote:
Oh right, thanks for checking, no need to jump through extra hoops to try to make it work.
As I already started writing the response, here's what I had earlier.
It is slightly more convenient for the users, but personally I'd slightly prefer more explicitly retrieving the leader, which makes it slightly clearer that we are iterating over the members of the class of the leader. It also limits the API surface, which can make future changes easier.
Given that EquivalenceClasses already is not very consistent, I don't have a strong preference.
https://github.com/llvm/llvm-project/pull/134373
More information about the llvm-commits
mailing list