[PATCH] D107350: Add a trait to Sequence to iterate enums

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 3 07:07:14 PDT 2021


gchatelet created this revision.
gchatelet added a reviewer: kuhar.
Herald added a subscriber: dexonsmith.
gchatelet requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

By default `llvm::Sequence` will happily iterate over enums, this patch forces the user to declare the enum iterable before being able to do so.
This emerged from a discussion with kuhar@ about reusing llvm's Sequence in lieu of https://github.com/GPUOpen-Drivers/llpc/blob/dev/lgc/interface/lgc/EnumIterator.h.

This patch is to discuss the design points (guard against enum iteration, provide tighter bounds, etc...).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107350

Files:
  llvm/include/llvm/ADT/Sequence.h
  llvm/include/llvm/IR/InstrTypes.h
  llvm/include/llvm/Support/MachineValueType.h
  llvm/tools/llvm-exegesis/lib/X86/Target.cpp
  llvm/unittests/ADT/SequenceTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107350.363728.patch
Type: text/x-patch
Size: 5063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210803/66ca5dd7/attachment.bin>


More information about the llvm-commits mailing list