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

Gabor Buella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 8 01:01:35 PDT 2018


GBuella added a comment.

> 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.


Repository:
  rL LLVM

https://reviews.llvm.org/D46304





More information about the llvm-commits mailing list