analyzer: consolidate duplicate code in region::calc_offset
gcc/analyzer/ChangeLog: * region.cc (region::calc_offset): Consolidate effectively identical cases. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This commit is contained in:
parent
93e759fc18
commit
ea3e191595
@ -499,41 +499,16 @@ region::calc_offset () const
|
|||||||
switch (iter_region->get_kind ())
|
switch (iter_region->get_kind ())
|
||||||
{
|
{
|
||||||
case RK_FIELD:
|
case RK_FIELD:
|
||||||
{
|
|
||||||
const field_region *field_reg
|
|
||||||
= (const field_region *)iter_region;
|
|
||||||
iter_region = iter_region->get_parent_region ();
|
|
||||||
|
|
||||||
bit_offset_t rel_bit_offset;
|
|
||||||
if (!field_reg->get_relative_concrete_offset (&rel_bit_offset))
|
|
||||||
return region_offset::make_symbolic (iter_region);
|
|
||||||
accum_bit_offset += rel_bit_offset;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case RK_ELEMENT:
|
case RK_ELEMENT:
|
||||||
{
|
|
||||||
const element_region *element_reg
|
|
||||||
= (const element_region *)iter_region;
|
|
||||||
iter_region = iter_region->get_parent_region ();
|
|
||||||
|
|
||||||
bit_offset_t rel_bit_offset;
|
|
||||||
if (!element_reg->get_relative_concrete_offset (&rel_bit_offset))
|
|
||||||
return region_offset::make_symbolic (iter_region);
|
|
||||||
accum_bit_offset += rel_bit_offset;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case RK_OFFSET:
|
case RK_OFFSET:
|
||||||
|
case RK_BIT_RANGE:
|
||||||
{
|
{
|
||||||
const offset_region *offset_reg
|
|
||||||
= (const offset_region *)iter_region;
|
|
||||||
iter_region = iter_region->get_parent_region ();
|
|
||||||
|
|
||||||
bit_offset_t rel_bit_offset;
|
bit_offset_t rel_bit_offset;
|
||||||
if (!offset_reg->get_relative_concrete_offset (&rel_bit_offset))
|
if (!iter_region->get_relative_concrete_offset (&rel_bit_offset))
|
||||||
return region_offset::make_symbolic (iter_region);
|
return region_offset::make_symbolic
|
||||||
|
(iter_region->get_parent_region ());
|
||||||
accum_bit_offset += rel_bit_offset;
|
accum_bit_offset += rel_bit_offset;
|
||||||
|
iter_region = iter_region->get_parent_region ();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -549,19 +524,6 @@ region::calc_offset () const
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case RK_BIT_RANGE:
|
|
||||||
{
|
|
||||||
const bit_range_region *bit_range_reg
|
|
||||||
= (const bit_range_region *)iter_region;
|
|
||||||
iter_region = iter_region->get_parent_region ();
|
|
||||||
|
|
||||||
bit_offset_t rel_bit_offset;
|
|
||||||
if (!bit_range_reg->get_relative_concrete_offset (&rel_bit_offset))
|
|
||||||
return region_offset::make_symbolic (iter_region);
|
|
||||||
accum_bit_offset += rel_bit_offset;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return region_offset::make_concrete (iter_region, accum_bit_offset);
|
return region_offset::make_concrete (iter_region, accum_bit_offset);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user