diff options
Diffstat (limited to 'gcc/ada/sem_aux.adb')
-rw-r--r-- | gcc/ada/sem_aux.adb | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb index f704f93..79a3b99 100644 --- a/gcc/ada/sem_aux.adb +++ b/gcc/ada/sem_aux.adb @@ -611,11 +611,9 @@ package body Sem_Aux is Nam : Name_Id; Check_Parents : Boolean := True) return Node_Id is - N : Node_Id; + N : constant Node_Id := Get_Rep_Item (E, Nam, Check_Parents); begin - N := Get_Rep_Item (E, Nam, Check_Parents); - if Present (N) and then Nkind (N) = N_Pragma then return N; end if; @@ -1381,12 +1379,10 @@ package body Sem_Aux is ----------------------- function Number_Components (Typ : Entity_Id) return Nat is - N : Int; + N : Nat := 0; Comp : Entity_Id; begin - N := 0; - -- We do not call Einfo.First_Component_Or_Discriminant, as this -- function does not skip completely hidden discriminants, which we -- want to skip here. @@ -1410,12 +1406,10 @@ package body Sem_Aux is -------------------------- function Number_Discriminants (Typ : Entity_Id) return Pos is - N : Int; - Discr : Entity_Id; + N : Nat := 0; + Discr : Entity_Id := First_Discriminant (Typ); begin - N := 0; - Discr := First_Discriminant (Typ); while Present (Discr) loop N := N + 1; Discr := Next_Discriminant (Discr); @@ -1521,13 +1515,10 @@ package body Sem_Aux is ---------------------------- function Subprogram_Body_Entity (E : Entity_Id) return Entity_Id is - N : Node_Id; + N : constant Node_Id := Parent (Subprogram_Specification (E)); + -- Declaration for E begin - -- Retrieve the declaration for E - - N := Parent (Subprogram_Specification (E)); - -- If this declaration is not a subprogram body, then it must be a -- subprogram declaration or body stub, from which we can retrieve the -- entity for the corresponding subprogram body if any, or an abstract @@ -1550,13 +1541,10 @@ package body Sem_Aux is --------------------- function Subprogram_Spec (E : Entity_Id) return Node_Id is - N : Node_Id; + N : constant Node_Id := Parent (Subprogram_Specification (E)); + -- Declaration for E begin - -- Retrieve the declaration for E - - N := Parent (Subprogram_Specification (E)); - -- This declaration is either subprogram declaration or a subprogram -- body, in which case return Empty. |