+2019-09-19 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_dbug.ads, exp_dbug.adb (Get_Homonym_Number): Remove.
+ (Append_Homonym_Number): Use Homonym_Number instead of
+ Get_Homonym_Number.
+ * exp_util.ads, exp_util.adb (Homonym_Number): Mirror style of
+ the removed Get_Homonym_Number routine, i.e. initialize local
+ objects at declaration and refine the type of result.
+ * sem_util.adb (Add_Homonym_Suffix): Use Homonym_Number instead
+ of Get_Homonym_Number.
+
2019-09-19 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Simplify
with Atree; use Atree;
with Debug; use Debug;
with Einfo; use Einfo;
+with Exp_Util; use Exp_Util;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
Homonym_Numbers (Homonym_Len) := '_';
end if;
- Add_Nat_To_H (Get_Homonym_Number (E));
+ Add_Nat_To_H (Homonym_Number (E));
end if;
end Append_Homonym_Number;
end loop;
end Build_Subprogram_Instance_Renamings;
- ------------------------
- -- Get_Homonym_Number --
- ------------------------
-
- function Get_Homonym_Number (E : Entity_Id) return Pos is
- H : Entity_Id := Homonym (E);
- Nr : Pos := 1;
-
- begin
- while Present (H) loop
- if Scope (H) = Scope (E) then
- Nr := Nr + 1;
- end if;
-
- H := Homonym (H);
- end loop;
-
- return Nr;
- end Get_Homonym_Number;
-
------------------------------------
-- Get_Secondary_DT_External_Name --
------------------------------------
-- Subprograms for Handling Qualification --
--------------------------------------------
- function Get_Homonym_Number (E : Entity_Id) return Pos;
- -- Return the homonym number for E, which is its position in the homonym
- -- chain starting at 1. This is exported for use in GNATprove.
-
procedure Qualify_Entity_Names (N : Node_Id);
-- Given a node N, that represents a block, subprogram body, or package
-- body or spec, or protected or task type, sets a fully qualified name
-- Homonym_Number --
--------------------
- function Homonym_Number (Subp : Entity_Id) return Nat is
- Count : Nat;
- Hom : Entity_Id;
+ function Homonym_Number (Subp : Entity_Id) return Pos is
+ Hom : Entity_Id := Homonym (Subp);
+ Count : Pos := 1;
begin
- Count := 1;
- Hom := Homonym (Subp);
while Present (Hom) loop
if Scope (Hom) = Scope (Subp) then
Count := Count + 1;
-- pragmas at the start of the package declaration contains
-- pragma Annotate (GNATprove, External_Axiomatization);
- function Homonym_Number (Subp : Entity_Id) return Nat;
+ function Homonym_Number (Subp : Entity_Id) return Pos;
-- Here subp is the entity for a subprogram. This routine returns the
-- homonym number used to disambiguate overloaded subprograms in the same
-- scope (the number is used as part of constructed names to make sure that
with Errout; use Errout;
with Erroutc; use Erroutc;
with Exp_Ch11; use Exp_Ch11;
-with Exp_Dbug; use Exp_Dbug;
with Exp_Util; use Exp_Util;
with Fname; use Fname;
with Freeze; use Freeze;
if Has_Homonym (U) then
declare
- N : constant Pos := Get_Homonym_Number (U);
+ N : constant Pos := Homonym_Number (U);
S : constant String := N'Img;
begin
if N > 1 then