[PATCH] D122079: [ADT] Add Enum matcher

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 06:34:10 PDT 2022


kuhar added a comment.

A few thoughts:

1. Is the requirement for this to be constant folded by the optimizer?
2. This could be made constexpr if we wanted.
3. The function name suggests this handles enums only but it works with any copybale & comparable type. I think we should either restrict it to enum types or make the name more general.
4. Since this function is not constexpr now, how about we added an overload to `is_contained` accepting an initializer list as the second element, e.g.: `is_constained(MyEnum::A, {MyEnum::A, MyEnum::B, MyEnum::C})`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122079



More information about the llvm-commits mailing list