[PATCH] D46304: [MC] Add llvm_unreachable to toString to fix compile time warning.

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 8 09:18:47 PDT 2018


sbc100 added a comment.

In https://reviews.llvm.org/D46304#1091019, @GBuella wrote:

> > Hey there - I implemented this diagnostic many a year ago. Yeah, technically maybe "covers all enumerators" might be more accurate phrasing?
>
> I'm not sure. I would rather enable this warning only on enums without fixed type, i.e. "enum XX {}", and not use this warning with "enum XX : unsigned {}". Or these could be two distinct warnings.
>  If someone explicitly fixes the type of an enum this way, then one might expect such "other values" to appear sometimes.
>
> E.g. I guess this WasmSymbolType is marked as unsigned, because it might be read from a binary file, in which case that input might contain invalid values, by which I values not matching the enumerated enumeration values. This is probably already validated before this `toString` function is called, but still.


The wording says `the values of the enumeration are the values of the underlying type`.   I think perhaps that wording is a little wrong.  Perhaps the final `the` should be removed?   Surly what it trying to say is that is that the valid enum values are themselves values of the underlying type, not that *all* possible value of the underlying type are also valid enum values.


Repository:
  rL LLVM

https://reviews.llvm.org/D46304





More information about the llvm-commits mailing list