Skip to content

Commit 6cc6bfc

Browse files
marc-adacoreMarc Poulhiès
authored andcommitted
ada: Minor cleanup
Renamed local variables to make it easier to read. gcc/ada/ChangeLog: * gcc-interface/utils.cc (update_pointer_to): Renamed ptr/old_ptr, ref/old_ref.
1 parent bf9cb91 commit 6cc6bfc

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

gcc/ada/gcc-interface/utils.cc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4510,8 +4510,8 @@ build_unc_object_type_from_ptr (tree thin_fat_ptr_type, tree object_type,
45104510
void
45114511
update_pointer_to (tree old_type, tree new_type)
45124512
{
4513-
tree ptr = TYPE_POINTER_TO (old_type);
4514-
tree ref = TYPE_REFERENCE_TO (old_type);
4513+
const tree old_ptr = TYPE_POINTER_TO (old_type);
4514+
const tree old_ref = TYPE_REFERENCE_TO (old_type);
45154515
tree t;
45164516

45174517
/* If this is the main variant, process all the other variants first. */
@@ -4520,7 +4520,7 @@ update_pointer_to (tree old_type, tree new_type)
45204520
update_pointer_to (t, new_type);
45214521

45224522
/* If no pointers and no references, we are done. */
4523-
if (!ptr && !ref)
4523+
if (!old_ptr && !old_ref)
45244524
return;
45254525

45264526
/* Merge the old type qualifiers in the new type.
@@ -4554,12 +4554,13 @@ update_pointer_to (tree old_type, tree new_type)
45544554
if (TREE_CODE (new_type) != UNCONSTRAINED_ARRAY_TYPE)
45554555
{
45564556
tree new_ptr, new_ref;
4557+
tree ptr, ref;
45574558

45584559
/* If pointer or reference already points to new type, nothing to do.
45594560
This can happen as update_pointer_to can be invoked multiple times
45604561
on the same couple of types because of the type variants. */
4561-
if ((ptr && TREE_TYPE (ptr) == new_type)
4562-
|| (ref && TREE_TYPE (ref) == new_type))
4562+
if ((old_ptr && TREE_TYPE (old_ptr) == new_type)
4563+
|| (old_ref && TREE_TYPE (old_ref) == new_type))
45634564
return;
45644565

45654566
/* Chain PTR and its variants at the end. */
@@ -4568,13 +4569,13 @@ update_pointer_to (tree old_type, tree new_type)
45684569
{
45694570
while (TYPE_NEXT_PTR_TO (new_ptr))
45704571
new_ptr = TYPE_NEXT_PTR_TO (new_ptr);
4571-
TYPE_NEXT_PTR_TO (new_ptr) = ptr;
4572+
TYPE_NEXT_PTR_TO (new_ptr) = old_ptr;
45724573
}
45734574
else
4574-
TYPE_POINTER_TO (new_type) = ptr;
4575+
TYPE_POINTER_TO (new_type) = old_ptr;
45754576

45764577
/* Now adjust them. */
4577-
for (; ptr; ptr = TYPE_NEXT_PTR_TO (ptr))
4578+
for (ptr = old_ptr; ptr; ptr = TYPE_NEXT_PTR_TO (ptr))
45784579
for (t = TYPE_MAIN_VARIANT (ptr); t; t = TYPE_NEXT_VARIANT (t))
45794580
{
45804581
TREE_TYPE (t) = new_type;
@@ -4589,13 +4590,13 @@ update_pointer_to (tree old_type, tree new_type)
45894590
{
45904591
while (TYPE_NEXT_REF_TO (new_ref))
45914592
new_ref = TYPE_NEXT_REF_TO (new_ref);
4592-
TYPE_NEXT_REF_TO (new_ref) = ref;
4593+
TYPE_NEXT_REF_TO (new_ref) = old_ref;
45934594
}
45944595
else
4595-
TYPE_REFERENCE_TO (new_type) = ref;
4596+
TYPE_REFERENCE_TO (new_type) = old_ref;
45964597

45974598
/* Now adjust them. */
4598-
for (; ref; ref = TYPE_NEXT_REF_TO (ref))
4599+
for (ref = old_ref; ref; ref = TYPE_NEXT_REF_TO (ref))
45994600
for (t = TYPE_MAIN_VARIANT (ref); t; t = TYPE_NEXT_VARIANT (t))
46004601
{
46014602
TREE_TYPE (t) = new_type;
@@ -4614,20 +4615,20 @@ update_pointer_to (tree old_type, tree new_type)
46144615
{
46154616
tree new_ptr = TYPE_POINTER_TO (new_type);
46164617

4617-
gcc_assert (TYPE_IS_FAT_POINTER_P (ptr));
4618+
gcc_assert (TYPE_IS_FAT_POINTER_P (old_ptr));
46184619

46194620
/* If PTR already points to NEW_TYPE, nothing to do. This can happen
46204621
since update_pointer_to can be invoked multiple times on the same
46214622
couple of types because of the type variants. */
4622-
if (TYPE_UNCONSTRAINED_ARRAY (ptr) == new_type)
4623+
if (TYPE_UNCONSTRAINED_ARRAY (old_ptr) == new_type)
46234624
return;
46244625

46254626
update_pointer_to
4626-
(TREE_TYPE (TREE_TYPE (TYPE_FIELDS (ptr))),
4627+
(TREE_TYPE (TREE_TYPE (TYPE_FIELDS (old_ptr))),
46274628
TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))));
46284629

46294630
update_pointer_to
4630-
(TREE_TYPE (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (ptr)))),
4631+
(TREE_TYPE (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (old_ptr)))),
46314632
TREE_TYPE (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (new_ptr)))));
46324633

46334634
update_pointer_to (TYPE_OBJECT_RECORD_TYPE (old_type),

0 commit comments

Comments
 (0)