Ent := First_Entity (Cont_Type_Pack);
while Present (Ent) loop
+
+ -- Ignore subprogram bodies
+
+ if Ekind (Ent) = E_Subprogram_Body then
+ null;
+
-- Get_Element_Access function with one parameter called
-- Position.
- if Chars (Ent) = Name_Get_Element_Access
+ elsif Chars (Ent) = Name_Get_Element_Access
and then Ekind (Ent) = E_Function
and then Present (First_Formal (Ent))
and then Chars (First_Formal (Ent)) = Name_Position
Bytes_Big_Endian : Boolean;
In_Subprogram : Boolean := False)
is
- Body_E : Entity_Id;
- E : Entity_Id;
-
- function Find_Declaration (E : Entity_Id) return Node_Id;
- -- Utility to retrieve declaration node for entity in the
- -- case of package bodies and subprograms.
-
- ----------------------
- -- Find_Declaration --
- ----------------------
-
- function Find_Declaration (E : Entity_Id) return Node_Id is
- Decl : Node_Id;
-
- begin
- Decl := Parent (E);
- while Present (Decl)
- and then Nkind (Decl) /= N_Package_Body
- and then Nkind (Decl) /= N_Subprogram_Declaration
- and then Nkind (Decl) /= N_Subprogram_Body
- loop
- Decl := Parent (Decl);
- end loop;
-
- return Decl;
- end Find_Declaration;
-
- -- Start of processing for List_Entities
+ E : Entity_Id;
begin
-- List entity if we have one, and it is not a renaming declaration.
Next_Entity (E);
end loop;
-
- -- For a package body, the entities of the visible subprograms are
- -- declared in the corresponding spec. Iterate over its entities in
- -- order to handle properly the subprogram bodies. Skip bodies in
- -- subunits, which are listed independently.
-
- if Ekind (Ent) = E_Package_Body
- and then Present (Corresponding_Spec (Find_Declaration (Ent)))
- then
- E := First_Entity (Corresponding_Spec (Find_Declaration (Ent)));
- while Present (E) loop
- if Is_Subprogram (E)
- and then
- Nkind (Find_Declaration (E)) = N_Subprogram_Declaration
- then
- Body_E := Corresponding_Body (Find_Declaration (E));
-
- if Present (Body_E)
- and then
- Nkind (Parent (Find_Declaration (Body_E))) /= N_Subunit
- then
- List_Entities (Body_E, Bytes_Big_Endian);
- end if;
- end if;
-
- Next_Entity (E);
- end loop;
- end if;
end if;
end List_Entities;
else
Set_Corresponding_Spec (N, Spec_Id);
+ -- The body entity is not used for semantics or code generation,
+ -- but it is attached to the entity list of the enclosing scope
+ -- to allow listing its entities when outputting representation
+ -- information.
+
+ if Scope (Spec_Id) /= Standard_Standard then
+ Append_Entity (Body_Id, Scope (Spec_Id));
+ end if;
+
-- Ada 2005 (AI-345): If the operation is a primitive operation
-- of a concurrent type, the type of the first parameter has been
-- replaced with the corresponding record, which is the proper