Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Support/Endian] Add support for endian-specific enums
Summary: Binary formats often include various enumerations or bitsets, but using endian-specific types for accessing them is tricky because they currently only support integral types. This is particularly true for scoped enums (enum class), as these are not implicitly convertible to integral types, and so one has to perform two casts just to read the enum value. This fixes that support by adding first-class support for enumeration types to endian-specific types. The support for them was already almost working -- all I needed to do was overload getSwappedBytes for enumeration types (which casts the enum to its underlying type and performs the conversion there). I also add some convenience template aliases to simplify declaring endian-specific enums. Reviewers: Bigcheese, zturner Subscribers: kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59141 llvm-svn: 355812
- Loading branch information