Add an UNSPEC_PROLOGUE_USE to prevent the link register from being considered dead.
[official-gcc.git] / gcc / ada / sem_ch3.ads
blob3647edecbfbfa3595045444ef5956c09ca068c9a
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S E M _ C H 3 --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
22 -- --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 -- --
26 ------------------------------------------------------------------------------
28 with Nlists; use Nlists;
29 with Types; use Types;
31 package Sem_Ch3 is
32 procedure Analyze_Component_Declaration (N : Node_Id);
33 procedure Analyze_Incomplete_Type_Decl (N : Node_Id);
34 procedure Analyze_Itype_Reference (N : Node_Id);
35 procedure Analyze_Number_Declaration (N : Node_Id);
36 procedure Analyze_Object_Declaration (N : Node_Id);
37 procedure Analyze_Others_Choice (N : Node_Id);
38 procedure Analyze_Private_Extension_Declaration (N : Node_Id);
39 procedure Analyze_Subtype_Declaration (N : Node_Id);
40 procedure Analyze_Subtype_Indication (N : Node_Id);
41 procedure Analyze_Type_Declaration (N : Node_Id);
42 procedure Analyze_Variant_Part (N : Node_Id);
44 function Access_Definition
45 (Related_Nod : Node_Id;
46 N : Node_Id)
47 return Entity_Id;
48 -- An access definition defines a general access type for a formal
49 -- parameter. The procedure is called when processing formals, when
50 -- the current scope is the subprogram. The Implicit type is attached
51 -- to the Related_Nod put into the enclosing scope, so that the only
52 -- entities defined in the spec are the formals themselves.
54 procedure Access_Subprogram_Declaration
55 (T_Name : Entity_Id;
56 T_Def : Node_Id);
57 -- The subprogram specification yields the signature of an implicit
58 -- type, whose Ekind is Access_Subprogram_Type. This implicit type is
59 -- the designated type of the declared access type. In subprogram calls,
60 -- the signature of the implicit type works like the profile of a regular
61 -- subprogram.
63 procedure Analyze_Declarations (L : List_Id);
64 -- Called to analyze a list of declarations (in what context ???). Also
65 -- performs necessary freezing actions (more description needed ???)
67 procedure Analyze_Default_Expression (N : Node_Id; T : Entity_Id);
68 -- Default expressions do not freeze their components, and must be
69 -- analyzed and resolved accordingly, by calling the
70 -- Pre_Analyze_And_Resolve routine and setting the global
71 -- In_Default_Expression flag.
73 procedure Array_Type_Declaration (T : in out Entity_Id; Def : Node_Id);
74 -- Process an array type declaration. If the array is constrained, we
75 -- create an implicit parent array type, with the same index types and
76 -- component type.
78 procedure Access_Type_Declaration (T : Entity_Id; Def : Node_Id);
79 -- Process an access type declaration
81 procedure Check_Abstract_Overriding (T : Entity_Id);
82 -- Check that all abstract subprograms inherited from T's parent type
83 -- have been overridden as required, and that nonabstract subprograms
84 -- have not been incorrectly overridden with an abstract subprogram.
86 procedure Check_Aliased_Component_Types (T : Entity_Id);
87 -- Given an array type or record type T, check that if the type is
88 -- nonlimited, then the nominal subtype of any components of T
89 -- that have discriminants must be constrained.
91 procedure Check_Completion (Body_Id : Node_Id := Empty);
92 -- At the end of a declarative part, verify that all entities that
93 -- require completion have received one. If Body_Id is absent, the
94 -- error indicating a missing completion is placed on the declaration
95 -- that needs completion. If Body_Id is present, it is the defining
96 -- identifier of a package body, and errors are posted on that node,
97 -- rather than on the declarations that require completion in the package
98 -- declaration.
100 procedure Derive_Subprogram
101 (New_Subp : in out Entity_Id;
102 Parent_Subp : Entity_Id;
103 Derived_Type : Entity_Id;
104 Parent_Type : Entity_Id;
105 Actual_Subp : Entity_Id := Empty);
106 -- Derive the subprogram Parent_Subp from Parent_Type, and replace the
107 -- subsidiary subtypes with the derived type to build the specification
108 -- of the inherited subprogram (returned in New_Subp). For tagged types,
109 -- the derived subprogram is aliased to that of the actual (in the
110 -- case where Actual_Subp is nonempty) rather than to the corresponding
111 -- subprogram of the parent type.
113 procedure Derive_Subprograms
114 (Parent_Type : Entity_Id;
115 Derived_Type : Entity_Id;
116 Generic_Actual : Entity_Id := Empty);
117 -- To complete type derivation, collect or retrieve the primitive
118 -- operations of the parent type, and replace the subsidiary subtypes
119 -- with the derived type, to build the specs of the inherited ops.
120 -- For generic actuals, the mapping of the primitive operations to those
121 -- of the parent type is also done by rederiving the operations within
122 -- the instance. For tagged types, the derived subprograms are aliased to
123 -- those of the actual, not those of the ancestor.
125 function Expand_To_Girder_Constraint
126 (Typ : Entity_Id;
127 Constraint : Elist_Id)
128 return Elist_Id;
129 -- Given a Constraint (ie a list of expressions) on the discriminants of
130 -- Typ, expand it into a constraint on the girder discriminants and
131 -- return the new list of expressions constraining the girder
132 -- discriminants.
134 function Find_Type_Name (N : Node_Id) return Entity_Id;
135 -- Enter the identifier in a type definition, or find the entity already
136 -- declared, in the case of the full declaration of an incomplete or
137 -- private type.
139 function Get_Discriminant_Value
140 (Discriminant : Entity_Id;
141 Typ_For_Constraint : Entity_Id;
142 Constraint : Elist_Id)
143 return Node_Id;
144 -- ??? MORE DOCUMENTATION
145 -- Given a discriminant somewhere in the Typ_For_Constraint tree
146 -- and a Constraint, return the value of that discriminant.
148 function Is_Visible_Component (C : Entity_Id) return Boolean;
149 -- Determines if a record component C is visible in the present context.
150 -- Note that even though component C could appear in the entity chain
151 -- of a record type, C may not be visible in the current context. For
152 -- instance, C may be a component inherited in the full view of a private
153 -- extension which is not visible in the current context.
155 procedure Make_Index
156 (I : Node_Id;
157 Related_Nod : Node_Id;
158 Related_Id : Entity_Id := Empty;
159 Suffix_Index : Nat := 1);
160 -- Process an index that is given in an array declaration, an entry
161 -- family declaration or a loop iteration. The index is given by an
162 -- index declaration (a 'box'), or by a discrete range. The later can
163 -- be the name of a discrete type, or a subtype indication.
164 -- Related_Nod is the node where the potential generated implicit types
165 -- will be inserted. The 2 last parameters are used for creating the name.
167 procedure Make_Class_Wide_Type (T : Entity_Id);
168 -- A Class_Wide_Type is created for each tagged type definition. The
169 -- attributes of a class wide type are inherited from those of the type
170 -- T. If T is introduced by a private declaration, the corresponding
171 -- class wide type is created at the same time, and therefore there is
172 -- a private and a full declaration for the class wide type type as well.
174 procedure Process_Full_View (N : Node_Id; Full_T, Priv_T : Entity_Id);
175 -- Process some semantic actions when the full view of a private type is
176 -- encountered and analyzed. The first action is to create the full views
177 -- of the dependent private subtypes. The second action is to recopy the
178 -- primitive operations of the private view (in the tagged case).
179 -- N is the N_Full_Type_Declaration node.
181 -- Full_T is the full view of the type whose full declaration is in N.
183 -- Priv_T is the private view of the type whose full declaration is in N.
185 procedure Process_Range_Expr_In_Decl
186 (R : Node_Id;
187 T : Entity_Id;
188 Check_List : List_Id := Empty_List;
189 R_Check_Off : Boolean := False);
190 -- Process a range expression that appears in a declaration context. The
191 -- range is analyzed and resolved with the base type of the given type,
192 -- and an appropriate check for expressions in non-static contexts made
193 -- on the bounds. R is analyzed and resolved using T, so the caller should
194 -- if necessary link R into the tree before the call, and in particular in
195 -- the case of a subtype declaration, it is appropriate to set the parent
196 -- pointer of R so that the types get properly frozen. The Check_List
197 -- parameter is used when the subprogram is called from
198 -- Build_Record_Init_Proc and is used to return a set of constraint
199 -- checking statements generated by the Checks package. R_Check_Off is
200 -- set to True when the call to Range_Check is to be skipped.
202 function Process_Subtype
203 (S : Node_Id;
204 Related_Nod : Node_Id;
205 Related_Id : Entity_Id := Empty;
206 Suffix : Character := ' ')
207 return Entity_Id;
208 -- Process a subtype indication S and return corresponding entity.
209 -- Related_Nod is the node where the potential generated implicit types
210 -- will be inserted. The Related_Id and Suffix parameters are used to
211 -- build the associated Implicit type name.
213 procedure Process_Discriminants (N : Node_Id);
214 -- Process the discriminants contained in an N_Full_Type_Declaration or
215 -- N_Incomplete_Type_Decl node N.
217 procedure Set_Completion_Referenced (E : Entity_Id);
218 -- If E is the completion of a private or incomplete type declaration,
219 -- or the completion of a deferred constant declaration, mark the entity
220 -- as referenced. Warnings on unused entities, if needed, go on the
221 -- partial view.
223 procedure Set_Girder_Constraint_From_Discriminant_Constraint
224 (E : Entity_Id);
225 -- E is some record type. This routine computes E's Girder_Constraint
226 -- from its Discriminant_Constraint.
228 end Sem_Ch3;