===================================================================
@@ -372,11 +372,9 @@
-- Qualify all entity names in inner packages, package bodies, etc.,
-- except when compiling for the VM back-ends, which depend on having
-- unqualified names in certain cases and handles the generation of
- -- qualified names when needed, and when compiling for formal verification,
- -- in which the back-end calls directly Qualify_All_Entity_Names after some
- -- preprocessing which uses the non-qualified names.
+ -- qualified names when needed.
- if VM_Target = No_VM and then not ALFA_Mode then
+ if VM_Target = No_VM then
Exp_Dbug.Qualify_All_Entity_Names;
end if;
===================================================================
@@ -12201,6 +12201,22 @@
end case;
end Unique_Defining_Entity;
+ -----------------
+ -- Unique_Name --
+ -----------------
+
+ function Unique_Name (E : Entity_Id) return String is
+ Name : constant String := Get_Name_String (Chars (E));
+ begin
+ if Has_Fully_Qualified_Name (E)
+ or else E = Standard_Standard
+ then
+ return Name;
+ else
+ return Unique_Name (Scope (E)) & "__" & Name;
+ end if;
+ end Unique_Name;
+
--------------------------
-- Unit_Declaration_Node --
--------------------------
===================================================================
@@ -1372,6 +1372,10 @@
-- Return the entity which represents declaration N, so that matching
-- declaration and body have the same entity.
+ function Unique_Name (E : Entity_Id) return String;
+ -- Return a unique name for entity E, which could be used to identify E
+ -- across compilation units.
+
function Unit_Declaration_Node (Unit_Id : Entity_Id) return Node_Id;
-- Unit_Id is the simple name of a program unit, this function returns the
-- corresponding xxx_Declaration node for the entity. Also applies to the
===================================================================
@@ -738,7 +738,7 @@
if XE.Ent /= Cur_Entity then
Cur_Entity_Name :=
- new String'(Exact_Source_Name (Sloc (XE.Ent)));
+ new String'(Unique_Name (XE.Ent));
end if;
ALFA_Xref_Table.Append (