-- table already contains this entry and if so it has no effect.
----------------------------------
- -- subprograms for fat pointers --
+ -- Subprograms For Fat Pointers --
----------------------------------
- function Needs_Fat_Pointer (E : Entity_Id) return Boolean;
- -- A formal parameter of an unconstrained array type that appears in
- -- an uplevel reference requires the construction of an access type,
- -- to be used in the corresponding component declaration.
-
function Build_Access_Type_Decl
(E : Entity_Id;
Scop : Entity_Id) return Node_Id;
-- record component. The relevant attributes of the access type are
-- set here to avoid a full analysis that would require a scope stack.
+ function Needs_Fat_Pointer (E : Entity_Id) return Boolean;
+ -- A formal parameter of an unconstrained array type that appears in an
+ -- uplevel reference requires the construction of an access type, to be
+ -- used in the corresponding component declaration.
+
-----------
-- Urefs --
-----------
Calls.Append (Call);
end Append_Unique_Call;
- -----------------------
- -- Needs_Fat_Pointer --
- -----------------------
-
- function Needs_Fat_Pointer (E : Entity_Id) return Boolean is
- begin
- return Is_Formal (E)
- and then Is_Array_Type (Etype (E))
- and then not Is_Constrained (Etype (E));
- end Needs_Fat_Pointer;
-
-----------------------------
-- Build_Access_Type_Decl --
-----------------------------
(E : Entity_Id;
Scop : Entity_Id) return Node_Id
is
- Loc : constant Source_Ptr := Sloc (E);
- Decl : Node_Id;
- Typ : Entity_Id;
+ Loc : constant Source_Ptr := Sloc (E);
+ Typ : Entity_Id;
begin
Typ := Make_Temporary (Loc, 'S');
Set_Scope (Typ, Scop);
Set_Directly_Designated_Type (Typ, Etype (E));
- Decl := Make_Full_Type_Declaration (Loc,
- Defining_Identifier => Typ,
- Type_Definition => Make_Access_To_Object_Definition (Loc,
- Subtype_Indication => New_Occurrence_Of (Etype (E), Loc)));
-
- return Decl;
+ return
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier => Typ,
+ Type_Definition =>
+ Make_Access_To_Object_Definition (Loc,
+ Subtype_Indication => New_Occurrence_Of (Etype (E), Loc)));
end Build_Access_Type_Decl;
---------------
return False;
end In_Synchronized_Unit;
+ -----------------------
+ -- Needs_Fat_Pointer --
+ -----------------------
+
+ function Needs_Fat_Pointer (E : Entity_Id) return Boolean is
+ begin
+ return Is_Formal (E)
+ and then Is_Array_Type (Etype (E))
+ and then not Is_Constrained (Etype (E));
+ end Needs_Fat_Pointer;
+
----------------
-- Subp_Index --
----------------
-- handled as an entity reference.
if Nkind (N) = N_Allocator
- and then Nkind (Expression (N)) = N_Qualified_Expression
+ and then Nkind (Expression (N)) = N_Qualified_Expression
then
declare
DT : Boolean := False;
-- Local declarations for one such subprogram
declare
- Loc : constant Source_Ptr := Sloc (STJ.Bod);
+ Loc : constant Source_Ptr := Sloc (STJ.Bod);
+
+ Decls : constant List_Id := New_List;
+ -- List of new declarations we create
+
Clist : List_Id;
Comp : Entity_Id;
+ Decl_Assign : Node_Id;
+ -- Assigment to set uplink, Empty if none
+
Decl_ARECnT : Node_Id;
Decl_ARECnPT : Node_Id;
Decl_ARECn : Node_Id;
Decl_ARECnP : Node_Id;
-- Declaration nodes for the AREC entities we build
- Decl_Assign : Node_Id;
- -- Assigment to set uplink, Empty if none
-
- Decls : constant List_Id := New_List;
- -- List of new declarations we create
-
begin
-- Build list of component declarations for ARECnT
Subtype_Indication =>
New_Occurrence_Of
(Defining_Identifier (Ptr_Decl),
- Loc))));
+ Loc))));
else
Append_To (Clist,
Make_Component_Declaration (Loc,
New_Occurrence_Of (STJ.ARECnPT, Loc),
Expression =>
Make_Attribute_Reference (Loc,
- Prefix =>
+ Prefix =>
New_Occurrence_Of (STJ.ARECn, Loc),
Attribute_Name => Name_Access));
Append_To (Decls, Decl_ARECnP);
Loc : constant Source_Ptr := Sloc (Ent);
Dec : constant Node_Id :=
Declaration_Node (Ent);
- Ins : Node_Id;
+
Asn : Node_Id;
Attr : Name_Id;
+ Ins : Node_Id;
begin
-- For parameters, we insert the assignment
-- right after the declaration of ARECnP.
-- For all other entities, we insert
- -- the assignment immediately after
- -- the declaration of the entity.
+ -- the assignment immediately after the
+ -- declaration of the entity.
-- Note: we don't need to mark the entity
-- as being aliased, because the address
end;
end if;
- -- The proper body of a stub may contain nested subprograms,
- -- and therefore must be visited explicitly. Nested stubs are
- -- examined recursively in Visit_Node.
+ -- The proper body of a stub may contain nested subprograms, and
+ -- therefore must be visited explicitly. Nested stubs are examined
+ -- recursively in Visit_Node.
if Nkind (N) in N_Body_Stub then
Do_Search (Library_Unit (N));