[PATCH] D107378: Make enum iteration with seq safe by default

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 19 08:29:43 PDT 2021


kuhar added a comment.

Thanks for the comments. If I understand correctly, we are converging to something like this:

1. We should keep enum iteration utilities but make them safe by default.
2. By default, enums shouldn't not be iterable and enum iteration should be opt-in.
  1. @dblaikie prefers the opt-in mechanism to be plain type traits, not the original type traits / ADL / macro mechanism from this patch.
3. We should rely on `iota_range` for the implementation, but create a new convenience function instead of reusing `seq` and `seq_inclusive`, say `enum_seq` and `enum_seq_inclusive`.
  1. To provide an 'escape hatch' to iterate over enums without the new trait, we can use an intentionally ugly traits/tag like `forge_iterable_enum`(`_traits`).

If this sounds good to folks, I'll go ahead and prepare a new version of this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107378



More information about the llvm-commits mailing list