lldb::StateType is an enum without an explicit underlying type.
According to [dcl.enum]p8 http://eel.is/c++draft/dcl.enum#8 and [expr.static.cast]p10 http://eel.is/c++draft/expr.static.cast#10 we are limited to setting StateType to values bound with a value range based on the values of the enumerators. Currently we have a test and SWIG interface that either explicitly set StateType to a value outside of the allowed range or in the case of SWIG does not prevent it.
In both cases using UBSan generates a runtime error when we load a value outside of the range allowed by the standard.
This change refactors StateType to keep track of the largest value and range checking to the SWIG interface and removes the invalid test case.