[debuginfo] Update cpp-like enum decoding docs to account for wrapping tag ranges.
This commit is contained in:
parent
171d8a3f57
commit
95d7591478
@ -142,7 +142,7 @@ const SINGLE_VARIANT_VIRTUAL_DISR: u64 = 0;
|
||||
/// let begin = variant_field.field("DISCR_BEGIN");
|
||||
/// let end = variant_field.field("DISCR_END");
|
||||
///
|
||||
/// if tag >= begin && tag <= end {
|
||||
/// if is_in_range(tag, begin, end) {
|
||||
/// return (variant_field.field("NAME"), variant_field.value);
|
||||
/// }
|
||||
/// }
|
||||
@ -169,7 +169,7 @@ const SINGLE_VARIANT_VIRTUAL_DISR: u64 = 0;
|
||||
/// let end = (variant_field.field("DISCR128_END_LO").value as u128) |
|
||||
/// (variant_field.field("DISCR128_END_HI").value as u128 << 64);
|
||||
///
|
||||
/// if tag >= begin && tag <= end {
|
||||
/// if is_in_range(tag, begin, end) {
|
||||
/// return (variant_field.field("NAME"), variant_field.value);
|
||||
/// }
|
||||
/// }
|
||||
@ -180,6 +180,16 @@ const SINGLE_VARIANT_VIRTUAL_DISR: u64 = 0;
|
||||
/// unreachable!();
|
||||
/// }
|
||||
///
|
||||
/// // Check if a value is within the given range
|
||||
/// // (where the range might wrap around the value space)
|
||||
/// fn is_in_range(value, start, end) -> bool {
|
||||
/// if start < end {
|
||||
/// value >= start && value <= end
|
||||
/// } else {
|
||||
/// value >= start || value <= end
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// ```
|
||||
pub(super) fn build_enum_type_di_node<'ll, 'tcx>(
|
||||
cx: &CodegenCx<'ll, 'tcx>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user