DataExtractor::GetMaxS64Bitfield performs a shift with UB in order to
construct a bitmask when bitfield_bit_size is 64. The current
implementation actually does “work” in this case, because the assumption
that the shift result is 0 holds, and 0 minus 1 gives the all-ones value
(the correct mask). However, the more readable/maintainable approach
might be to use an off-the-shelf UB-free helper.
Fixes a UBSan issue:
"col" : 37, "description" : "invalid-shift-exponent", "filename" : "/Users/vsk/src/llvm-project-master/lldb/source/Utility/DataExtractor.cpp", "instrumentation_class" : "UndefinedBehaviorSanitizer", "line" : 615, "memory_address" : 0, "summary" : "Shift exponent 64 is too large for 64-bit type 'uint64_t' (aka 'unsigned long long')",
rdar://59117758
We could do an early exit if bitfield_bit_size is zero.