1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
27 ------------------------------------------------------------------------------
29 -- Expand routines for chapter 3 constructs
31 with Types; use Types;
32 with Elists; use Elists;
36 procedure Expand_N_Object_Declaration (N : Node_Id);
37 procedure Expand_N_Subtype_Indication (N : Node_Id);
38 procedure Expand_N_Variant_Part (N : Node_Id);
39 procedure Expand_N_Full_Type_Declaration (N : Node_Id);
41 procedure Expand_Previous_Access_Type (N : Node_Id; Def_Id : Entity_Id);
42 -- For a full type declaration that contains tasks, or that is a task,
43 -- check whether there exists an access type whose designated type is an
44 -- incomplete declarations for the current composite type. If so, build
45 -- the master for that access type, now that it is known to denote an
48 procedure Expand_Derived_Record (T : Entity_Id; Def : Node_Id);
49 -- Add a field _parent in the extension part of the record.
51 procedure Build_Discr_Checking_Funcs (N : Node_Id);
52 -- Builds function which checks whether the component name is consistent
53 -- with the current discriminants. N is the full type declaration node,
54 -- and the discriminant checking functions are inserted after this node.
56 function Build_Initialization_Call
60 In_Init_Proc : Boolean := False;
61 Enclos_Type : Entity_Id := Empty;
62 Discr_Map : Elist_Id := New_Elmt_List)
64 -- Builds a call to the initialization procedure of the Id entity. Id_Ref
65 -- is either a new reference to Id (for record fields), or an indexed
66 -- component (for array elements). Loc is the source location for the
67 -- constructed tree, and Typ is the type of the entity (the initialization
68 -- procedure of the base type is the procedure that actually gets called).
69 -- In_Init_Proc has to be set to True when the call is itself in an Init
70 -- procedure in order to enable the use of discriminals. Enclos_type is
71 -- the type of the init_proc and it is used for various expansion cases
72 -- including the case where Typ is a task type which is a array component,
73 -- the indices of the enclosing type are used to build the string that
74 -- identifies each task at runtime.
76 -- Discr_Map is used to replace discriminants by their discriminals in
77 -- expressions used to constrain record components. In the presence of
78 -- entry families bounded by discriminants, protected type discriminants
79 -- can appear within expressions in array bounds (not as stand-alone
80 -- identifiers) and a general replacement is necessary.
82 procedure Freeze_Type (N : Node_Id);
83 -- This procedure executes the freezing actions associated with the given
84 -- freeze type node N.
86 function Needs_Simple_Initialization (T : Entity_Id) return Boolean;
87 -- Certain types need initialization even though there is no specific
88 -- initialization routine. In this category are access types (which
89 -- need initializing to null), packed array types whose implementation
90 -- is a modular type, and all scalar types if Normalize_Scalars is set,
91 -- as well as private types whose underlying type is present and meets
92 -- any of these criteria. Finally, descendants of String and Wide_String
93 -- also need initialization in Initialize/Normalize_Scalars mode.
95 function Get_Simple_Init_Val
99 -- For a type which Needs_Simple_Initialization (see above), prepares
100 -- the tree for an expression representing the required initial value.
101 -- Loc is the source location used in constructing this tree which is
102 -- returned as the result of the call.