SemaChecking.cpp has several copies of the same range-check idiom.
This patch factors them out into a utility function. No behavioural
change intended.
I need to add something similar for SystemZ and didn't want to add more
copies of the sequence.