[PATCH] D122079: [ADT] Add Enum matcher

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 21:21:47 PDT 2022


beanz added a comment.

In D122079#3401426 <https://reviews.llvm.org/D122079#3401426>, @kuhar wrote:

> `constexpr` works with both constant-evaluated contexts and runtime calls.

Fair point.

> I've checked and it seems to work just as well when passing in an array. With `initializer_list`, there are still some branches left. See https://godbolt.org/z/o7hKnKen5.

Ah! I had tried using this with the existing is_contained definition, and it wasn’t folding. I think it was the `std::find` call, I can adjust.

> Overall, I'd lean towards the array or initializer_list version (either re-using `is_contained` or introducing a new name like `is_in` to keep things more familiar and avoid recursion.

Makes sense to me. Will rework tomorrow.

Thank you!


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