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

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 22 16:32:33 PDT 2021


kuhar added inline comments.


================
Comment at: llvm/include/llvm/Support/MachineValueType.h:1408-1410
+      return enum_seq_inclusive(MVT::FIRST_VALUETYPE, MVT::LAST_VALUETYPE,
+                                force_iteration_on_noniterable_enum{});
     }
----------------
A `enum_iteration_traits` definition would have to be provided outside of the class, in the llvm namespace. These could be handled by moving the implementation out of line, but that's kinda of repetitive.

I think the intention behind these helper functions is to define sub-ranges that are fine to iterate over, so it may be better not to make the whole enum iterable.


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