OSDN Git Service

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