annotate gcc/ada/sem_aux.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S E M _ A U X --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- As a special exception, if other files instantiate generics from this --
kono
parents:
diff changeset
22 -- unit, or you link this unit with other files to produce an executable, --
kono
parents:
diff changeset
23 -- this unit does not by itself cause the resulting executable to be --
kono
parents:
diff changeset
24 -- covered by the GNU General Public License. This exception does not --
kono
parents:
diff changeset
25 -- however invalidate any other reasons why the executable file might be --
kono
parents:
diff changeset
26 -- covered by the GNU Public License. --
kono
parents:
diff changeset
27 -- --
kono
parents:
diff changeset
28 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
29 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
30 -- --
kono
parents:
diff changeset
31 ------------------------------------------------------------------------------
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 -- Package containing utility procedures used throughout the compiler,
kono
parents:
diff changeset
34 -- and also by ASIS so dependencies are limited to ASIS included packages.
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- Historical note. Many of the routines here were originally in Einfo, but
kono
parents:
diff changeset
37 -- Einfo is supposed to be a relatively low level package dealing with the
kono
parents:
diff changeset
38 -- content of entities in the tree, so this package is used for routines that
kono
parents:
diff changeset
39 -- require more than minimal semantic knowledge.
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 with Alloc;
kono
parents:
diff changeset
42 with Namet; use Namet;
kono
parents:
diff changeset
43 with Table;
kono
parents:
diff changeset
44 with Types; use Types;
kono
parents:
diff changeset
45 with Sinfo; use Sinfo;
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 package Sem_Aux is
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 --------------------------------
kono
parents:
diff changeset
50 -- Obsolescent Warnings Table --
kono
parents:
diff changeset
51 --------------------------------
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 -- This table records entities for which a pragma Obsolescent with a
kono
parents:
diff changeset
54 -- message argument has been processed.
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 type OWT_Record is record
kono
parents:
diff changeset
57 Ent : Entity_Id;
kono
parents:
diff changeset
58 -- The entity to which the pragma applies
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 Msg : String_Id;
kono
parents:
diff changeset
61 -- The string containing the message
kono
parents:
diff changeset
62 end record;
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 package Obsolescent_Warnings is new Table.Table (
kono
parents:
diff changeset
65 Table_Component_Type => OWT_Record,
kono
parents:
diff changeset
66 Table_Index_Type => Int,
kono
parents:
diff changeset
67 Table_Low_Bound => 0,
kono
parents:
diff changeset
68 Table_Initial => Alloc.Obsolescent_Warnings_Initial,
kono
parents:
diff changeset
69 Table_Increment => Alloc.Obsolescent_Warnings_Increment,
kono
parents:
diff changeset
70 Table_Name => "Obsolescent_Warnings");
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 procedure Initialize;
kono
parents:
diff changeset
73 -- Called at the start of compilation of each new main source file to
kono
parents:
diff changeset
74 -- initialize the allocation of the Obsolescent_Warnings table. Note that
kono
parents:
diff changeset
75 -- Initialize must not be called if Tree_Read is used.
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 procedure Tree_Read;
kono
parents:
diff changeset
78 -- Initializes Obsolescent_Warnings table from current tree file using the
kono
parents:
diff changeset
79 -- relevant Table.Tree_Read routine.
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 procedure Tree_Write;
kono
parents:
diff changeset
82 -- Writes out Obsolescent_Warnings table to current tree file using the
kono
parents:
diff changeset
83 -- relevant Table.Tree_Write routine.
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 -----------------
kono
parents:
diff changeset
86 -- Subprograms --
kono
parents:
diff changeset
87 -----------------
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 function Ancestor_Subtype (Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
90 -- The argument Id is a type or subtype entity. If the argument is a
kono
parents:
diff changeset
91 -- subtype then it returns the subtype or type from which the subtype was
kono
parents:
diff changeset
92 -- obtained, otherwise it returns Empty.
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 function Available_View (Ent : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
95 -- Ent denotes an abstract state or a type that may come from a limited
kono
parents:
diff changeset
96 -- with clause. Return the non-limited view of Ent if there is one or Ent
kono
parents:
diff changeset
97 -- if this is not the case.
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 function Constant_Value (Ent : Entity_Id) return Node_Id;
kono
parents:
diff changeset
100 -- Ent is a variable, constant, named integer, or named real entity. This
kono
parents:
diff changeset
101 -- call obtains the initialization expression for the entity. Will return
kono
parents:
diff changeset
102 -- Empty for a deferred constant whose full view is not available or
kono
parents:
diff changeset
103 -- in some other cases of internal entities, which cannot be treated as
kono
parents:
diff changeset
104 -- constants from the point of view of constant folding. Empty is also
kono
parents:
diff changeset
105 -- returned for variables with no initialization expression.
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 function Corresponding_Unsigned_Type (Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
108 -- Typ is a signed integer subtype. This routine returns the standard
kono
parents:
diff changeset
109 -- unsigned type with the same Esize as the implementation base type of
kono
parents:
diff changeset
110 -- Typ, e.g. Long_Integer => Long_Unsigned.
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 function Enclosing_Dynamic_Scope (Ent : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
113 -- For any entity, Ent, returns the closest dynamic scope in which the
kono
parents:
diff changeset
114 -- entity is declared or Standard_Standard for library-level entities.
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 function First_Discriminant (Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
117 -- Typ is a type with discriminants. The discriminants are the first
kono
parents:
diff changeset
118 -- entities declared in the type, so normally this is equivalent to
kono
parents:
diff changeset
119 -- First_Entity. The exception arises for tagged types, where the tag
kono
parents:
diff changeset
120 -- itself is prepended to the front of the entity chain, so the
kono
parents:
diff changeset
121 -- First_Discriminant function steps past the tag if it is present.
kono
parents:
diff changeset
122 -- The caller is responsible for checking that the type has discriminants.
kono
parents:
diff changeset
123 -- When called on a private type with unknown discriminants, the function
kono
parents:
diff changeset
124 -- always returns Empty.
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 function First_Stored_Discriminant (Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
127 -- Typ is a type with discriminants. Gives the first discriminant stored
kono
parents:
diff changeset
128 -- in an object of this type. In many cases, these are the same as the
kono
parents:
diff changeset
129 -- normal visible discriminants for the type, but in the case of renamed
kono
parents:
diff changeset
130 -- discriminants, this is not always the case.
kono
parents:
diff changeset
131 --
kono
parents:
diff changeset
132 -- For tagged types, and untagged types which are root types or derived
kono
parents:
diff changeset
133 -- types but which do not rename discriminants in their root type, the
kono
parents:
diff changeset
134 -- stored discriminants are the same as the actual discriminants of the
kono
parents:
diff changeset
135 -- type, and hence this function is the same as First_Discriminant.
kono
parents:
diff changeset
136 --
kono
parents:
diff changeset
137 -- For derived untagged types that rename discriminants in the root type
kono
parents:
diff changeset
138 -- this is the first of the discriminants that occur in the root type. To
kono
parents:
diff changeset
139 -- be precise, in this case stored discriminants are entities attached to
kono
parents:
diff changeset
140 -- the entity chain of the derived type which are a copy of the
kono
parents:
diff changeset
141 -- discriminants of the root type. Furthermore their Is_Completely_Hidden
kono
parents:
diff changeset
142 -- flag is set since although they are actually stored in the object, they
kono
parents:
diff changeset
143 -- are not in the set of discriminants that is visible in the type.
kono
parents:
diff changeset
144 --
kono
parents:
diff changeset
145 -- For derived untagged types, the set of stored discriminants are the real
kono
parents:
diff changeset
146 -- discriminants from Gigi's standpoint, i.e. those that will be stored in
kono
parents:
diff changeset
147 -- actual objects of the type.
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 function First_Subtype (Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
150 -- Applies to all types and subtypes. For types, yields the first subtype
kono
parents:
diff changeset
151 -- of the type. For subtypes, yields the first subtype of the base type of
kono
parents:
diff changeset
152 -- the subtype.
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 function First_Tag_Component (Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
155 -- Typ must be a tagged record type. This function returns the Entity for
kono
parents:
diff changeset
156 -- the first _Tag field in the record type.
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 function Get_Binary_Nkind (Op : Entity_Id) return Node_Kind;
kono
parents:
diff changeset
159 -- Op must be an entity with an Ekind of E_Operator. This function returns
kono
parents:
diff changeset
160 -- the Nkind value that would be used to construct a binary operator node
kono
parents:
diff changeset
161 -- referencing this entity. It is an error to call this function if Ekind
kono
parents:
diff changeset
162 -- (Op) /= E_Operator.
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 function Get_Called_Entity (Call : Node_Id) return Entity_Id;
kono
parents:
diff changeset
165 -- Obtain the entity of the entry, operator, or subprogram being invoked
kono
parents:
diff changeset
166 -- by call Call.
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168 function Get_Low_Bound (E : Entity_Id) return Node_Id;
kono
parents:
diff changeset
169 -- For an index subtype or string literal subtype, returns its low bound
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 function Get_Unary_Nkind (Op : Entity_Id) return Node_Kind;
kono
parents:
diff changeset
172 -- Op must be an entity with an Ekind of E_Operator. This function returns
kono
parents:
diff changeset
173 -- the Nkind value that would be used to construct a unary operator node
kono
parents:
diff changeset
174 -- referencing this entity. It is an error to call this function if Ekind
kono
parents:
diff changeset
175 -- (Op) /= E_Operator.
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 function Get_Rep_Item
kono
parents:
diff changeset
178 (E : Entity_Id;
kono
parents:
diff changeset
179 Nam : Name_Id;
kono
parents:
diff changeset
180 Check_Parents : Boolean := True) return Node_Id;
kono
parents:
diff changeset
181 -- Searches the Rep_Item chain for a given entity E, for an instance of a
kono
parents:
diff changeset
182 -- rep item (pragma, attribute definition clause, or aspect specification)
kono
parents:
diff changeset
183 -- whose name matches the given name Nam. If Check_Parents is False then it
kono
parents:
diff changeset
184 -- only returns rep item that has been directly specified for E (and not
kono
parents:
diff changeset
185 -- inherited from its parents, if any). If one is found, it is returned,
kono
parents:
diff changeset
186 -- otherwise Empty is returned. A special case is that when Nam is
kono
parents:
diff changeset
187 -- Name_Priority, the call will also find Interrupt_Priority.
kono
parents:
diff changeset
188
kono
parents:
diff changeset
189 function Get_Rep_Item
kono
parents:
diff changeset
190 (E : Entity_Id;
kono
parents:
diff changeset
191 Nam1 : Name_Id;
kono
parents:
diff changeset
192 Nam2 : Name_Id;
kono
parents:
diff changeset
193 Check_Parents : Boolean := True) return Node_Id;
kono
parents:
diff changeset
194 -- Searches the Rep_Item chain for a given entity E, for an instance of a
kono
parents:
diff changeset
195 -- rep item (pragma, attribute definition clause, or aspect specification)
kono
parents:
diff changeset
196 -- whose name matches one of the given names Nam1 or Nam2. If Check_Parents
kono
parents:
diff changeset
197 -- is False then it only returns rep item that has been directly specified
kono
parents:
diff changeset
198 -- for E (and not inherited from its parents, if any). If one is found, it
kono
parents:
diff changeset
199 -- is returned, otherwise Empty is returned. A special case is that when
kono
parents:
diff changeset
200 -- one of the given names is Name_Priority, the call will also find
kono
parents:
diff changeset
201 -- Interrupt_Priority.
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 function Get_Rep_Pragma
kono
parents:
diff changeset
204 (E : Entity_Id;
kono
parents:
diff changeset
205 Nam : Name_Id;
kono
parents:
diff changeset
206 Check_Parents : Boolean := True) return Node_Id;
kono
parents:
diff changeset
207 -- Searches the Rep_Item chain for a given entity E, for an instance of a
kono
parents:
diff changeset
208 -- representation pragma whose name matches the given name Nam. If
kono
parents:
diff changeset
209 -- Check_Parents is False then it only returns representation pragma that
kono
parents:
diff changeset
210 -- has been directly specified for E (and not inherited from its parents,
kono
parents:
diff changeset
211 -- if any). If one is found and if it is the first rep item in the list
kono
parents:
diff changeset
212 -- that matches Nam, it is returned, otherwise Empty is returned. A special
kono
parents:
diff changeset
213 -- case is that when Nam is Name_Priority, the call will also find
kono
parents:
diff changeset
214 -- Interrupt_Priority.
kono
parents:
diff changeset
215
kono
parents:
diff changeset
216 function Get_Rep_Pragma
kono
parents:
diff changeset
217 (E : Entity_Id;
kono
parents:
diff changeset
218 Nam1 : Name_Id;
kono
parents:
diff changeset
219 Nam2 : Name_Id;
kono
parents:
diff changeset
220 Check_Parents : Boolean := True) return Node_Id;
kono
parents:
diff changeset
221 -- Searches the Rep_Item chain for a given entity E, for an instance of a
kono
parents:
diff changeset
222 -- representation pragma whose name matches one of the given names Nam1 or
kono
parents:
diff changeset
223 -- Nam2. If Check_Parents is False then it only returns representation
kono
parents:
diff changeset
224 -- pragma that has been directly specified for E (and not inherited from
kono
parents:
diff changeset
225 -- its parents, if any). If one is found and if it is the first rep item in
kono
parents:
diff changeset
226 -- the list that matches one of the given names, it is returned, otherwise
kono
parents:
diff changeset
227 -- Empty is returned. A special case is that when one of the given names is
kono
parents:
diff changeset
228 -- Name_Priority, the call will also find Interrupt_Priority.
kono
parents:
diff changeset
229
kono
parents:
diff changeset
230 function Has_Rep_Item
kono
parents:
diff changeset
231 (E : Entity_Id;
kono
parents:
diff changeset
232 Nam : Name_Id;
kono
parents:
diff changeset
233 Check_Parents : Boolean := True) return Boolean;
kono
parents:
diff changeset
234 -- Searches the Rep_Item chain for the given entity E, for an instance of a
kono
parents:
diff changeset
235 -- rep item (pragma, attribute definition clause, or aspect specification)
kono
parents:
diff changeset
236 -- with the given name Nam. If Check_Parents is False then it only checks
kono
parents:
diff changeset
237 -- for a rep item that has been directly specified for E (and not inherited
kono
parents:
diff changeset
238 -- from its parents, if any). If found then True is returned, otherwise
kono
parents:
diff changeset
239 -- False indicates that no matching entry was found.
kono
parents:
diff changeset
240
kono
parents:
diff changeset
241 function Has_Rep_Item
kono
parents:
diff changeset
242 (E : Entity_Id;
kono
parents:
diff changeset
243 Nam1 : Name_Id;
kono
parents:
diff changeset
244 Nam2 : Name_Id;
kono
parents:
diff changeset
245 Check_Parents : Boolean := True) return Boolean;
kono
parents:
diff changeset
246 -- Searches the Rep_Item chain for the given entity E, for an instance of a
kono
parents:
diff changeset
247 -- rep item (pragma, attribute definition clause, or aspect specification)
kono
parents:
diff changeset
248 -- with the given names Nam1 or Nam2. If Check_Parents is False then it
kono
parents:
diff changeset
249 -- only checks for a rep item that has been directly specified for E (and
kono
parents:
diff changeset
250 -- not inherited from its parents, if any). If found then True is returned,
kono
parents:
diff changeset
251 -- otherwise False indicates that no matching entry was found.
kono
parents:
diff changeset
252
kono
parents:
diff changeset
253 function Has_Rep_Item (E : Entity_Id; N : Node_Id) return Boolean;
kono
parents:
diff changeset
254 -- Determine whether the Rep_Item chain of arbitrary entity E contains item
kono
parents:
diff changeset
255 -- N. N must denote a valid rep item.
kono
parents:
diff changeset
256
kono
parents:
diff changeset
257 function Has_Rep_Pragma
kono
parents:
diff changeset
258 (E : Entity_Id;
kono
parents:
diff changeset
259 Nam : Name_Id;
kono
parents:
diff changeset
260 Check_Parents : Boolean := True) return Boolean;
kono
parents:
diff changeset
261 -- Searches the Rep_Item chain for the given entity E, for an instance of a
kono
parents:
diff changeset
262 -- representation pragma with the given name Nam. If Check_Parents is False
kono
parents:
diff changeset
263 -- then it only checks for a representation pragma that has been directly
kono
parents:
diff changeset
264 -- specified for E (and not inherited from its parents, if any). If found
kono
parents:
diff changeset
265 -- and if it is the first rep item in the list that matches Nam then True
kono
parents:
diff changeset
266 -- is returned, otherwise False indicates that no matching entry was found.
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 function Has_Rep_Pragma
kono
parents:
diff changeset
269 (E : Entity_Id;
kono
parents:
diff changeset
270 Nam1 : Name_Id;
kono
parents:
diff changeset
271 Nam2 : Name_Id;
kono
parents:
diff changeset
272 Check_Parents : Boolean := True) return Boolean;
kono
parents:
diff changeset
273 -- Searches the Rep_Item chain for the given entity E, for an instance of a
kono
parents:
diff changeset
274 -- representation pragma with the given names Nam1 or Nam2. If
kono
parents:
diff changeset
275 -- Check_Parents is False then it only checks for a rep item that has been
kono
parents:
diff changeset
276 -- directly specified for E (and not inherited from its parents, if any).
kono
parents:
diff changeset
277 -- If found and if it is the first rep item in the list that matches one of
kono
parents:
diff changeset
278 -- the given names then True is returned, otherwise False indicates that no
kono
parents:
diff changeset
279 -- matching entry was found.
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 function Has_External_Tag_Rep_Clause (T : Entity_Id) return Boolean;
kono
parents:
diff changeset
282 -- Defined in tagged types. Set if an External_Tag rep. clause has been
kono
parents:
diff changeset
283 -- given for this type. Use to avoid the generation of the default
kono
parents:
diff changeset
284 -- External_Tag.
kono
parents:
diff changeset
285 --
kono
parents:
diff changeset
286 -- Note: we used to use an entity flag for this purpose, but that was wrong
kono
parents:
diff changeset
287 -- because it was not propagated from the private view to the full view. We
kono
parents:
diff changeset
288 -- could have added that propagation, but it would have been an annoying
kono
parents:
diff changeset
289 -- irregularity compared to other representation aspects, and the cost of
kono
parents:
diff changeset
290 -- looking up the aspect when needed is small.
kono
parents:
diff changeset
291
kono
parents:
diff changeset
292 function Has_Unconstrained_Elements (T : Entity_Id) return Boolean;
kono
parents:
diff changeset
293 -- True if T has discriminants and is unconstrained, or is an array type
kono
parents:
diff changeset
294 -- whose element type Has_Unconstrained_Elements.
kono
parents:
diff changeset
295
kono
parents:
diff changeset
296 function Has_Variant_Part (Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
297 -- Return True if the first subtype of Typ is a discriminated record type
kono
parents:
diff changeset
298 -- which has a variant part. False otherwise.
kono
parents:
diff changeset
299
kono
parents:
diff changeset
300 function In_Generic_Body (Id : Entity_Id) return Boolean;
kono
parents:
diff changeset
301 -- Determine whether entity Id appears inside a generic body
kono
parents:
diff changeset
302
kono
parents:
diff changeset
303 function Initialization_Suppressed (Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
304 pragma Inline (Initialization_Suppressed);
kono
parents:
diff changeset
305 -- Returns True if initialization should be suppressed for the given type
kono
parents:
diff changeset
306 -- or subtype. This is true if Suppress_Initialization is set either for
kono
parents:
diff changeset
307 -- the subtype itself, or for the corresponding base type.
kono
parents:
diff changeset
308
kono
parents:
diff changeset
309 function Is_Body (N : Node_Id) return Boolean;
kono
parents:
diff changeset
310 -- Determine whether an arbitrary node denotes a body
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 function Is_By_Copy_Type (Ent : Entity_Id) return Boolean;
kono
parents:
diff changeset
313 -- Ent is any entity. Returns True if Ent is a type entity where the type
kono
parents:
diff changeset
314 -- is required to be passed by copy, as defined in (RM 6.2(3)).
kono
parents:
diff changeset
315
kono
parents:
diff changeset
316 function Is_By_Reference_Type (Ent : Entity_Id) return Boolean;
kono
parents:
diff changeset
317 -- Ent is any entity. Returns True if Ent is a type entity where the type
kono
parents:
diff changeset
318 -- is required to be passed by reference, as defined in (RM 6.2(4-9)).
kono
parents:
diff changeset
319
kono
parents:
diff changeset
320 function Is_Definite_Subtype (T : Entity_Id) return Boolean;
kono
parents:
diff changeset
321 -- T is a type entity. Returns True if T is a definite subtype.
kono
parents:
diff changeset
322 -- Indefinite subtypes are unconstrained arrays, unconstrained
kono
parents:
diff changeset
323 -- discriminated types without defaulted discriminants, class-wide types,
kono
parents:
diff changeset
324 -- and types with unknown discriminants. Definite subtypes are all others
kono
parents:
diff changeset
325 -- (elementary, constrained composites (including the case of records
kono
parents:
diff changeset
326 -- without discriminants), and types with defaulted discriminants).
kono
parents:
diff changeset
327
kono
parents:
diff changeset
328 function Is_Derived_Type (Ent : Entity_Id) return Boolean;
kono
parents:
diff changeset
329 -- Determines if the given entity Ent is a derived type. Result is always
kono
parents:
diff changeset
330 -- false if argument is not a type.
kono
parents:
diff changeset
331
kono
parents:
diff changeset
332 function Is_Generic_Formal (E : Entity_Id) return Boolean;
kono
parents:
diff changeset
333 -- Determine whether E is a generic formal parameter. In particular this is
kono
parents:
diff changeset
334 -- used to set the visibility of generic formals of a generic package
kono
parents:
diff changeset
335 -- declared with a box or with partial parameterization.
kono
parents:
diff changeset
336
kono
parents:
diff changeset
337 function Is_Immutably_Limited_Type (Ent : Entity_Id) return Boolean;
kono
parents:
diff changeset
338 -- Implements definition in Ada 2012 RM-7.5 (8.1/3). This differs from the
kono
parents:
diff changeset
339 -- following predicate in that an untagged record with immutably limited
kono
parents:
diff changeset
340 -- components is NOT by itself immutably limited. This matters, e.g. when
kono
parents:
diff changeset
341 -- checking the legality of an access to the current instance.
kono
parents:
diff changeset
342
kono
parents:
diff changeset
343 function Is_Limited_View (Ent : Entity_Id) return Boolean;
kono
parents:
diff changeset
344 -- Ent is any entity. True for a type that is "inherently" limited (i.e.
kono
parents:
diff changeset
345 -- cannot become nonlimited). From the Ada 2005 RM-7.5(8.1/2), "a type with
kono
parents:
diff changeset
346 -- a part that is of a task, protected, or explicitly limited record type".
kono
parents:
diff changeset
347 -- These are the types that are defined as return-by-reference types in Ada
kono
parents:
diff changeset
348 -- 95 (see RM95-6.5(11-16)). In Ada 2005, these are the types that require
kono
parents:
diff changeset
349 -- build-in-place for function calls. Note that build-in-place is allowed
kono
parents:
diff changeset
350 -- for other types, too. This is also used for identifying pure procedures
kono
parents:
diff changeset
351 -- whose calls should not be eliminated (RM 10.2.1(18/2)).
kono
parents:
diff changeset
352
kono
parents:
diff changeset
353 function Is_Limited_Type (Ent : Entity_Id) return Boolean;
kono
parents:
diff changeset
354 -- Ent is any entity. Returns true if Ent is a limited type (limited
kono
parents:
diff changeset
355 -- private type, limited interface type, task type, protected type,
kono
parents:
diff changeset
356 -- composite containing a limited component, or a subtype of any of
kono
parents:
diff changeset
357 -- these types). This older routine overlaps with the previous one, this
kono
parents:
diff changeset
358 -- should be cleaned up???
kono
parents:
diff changeset
359
kono
parents:
diff changeset
360 function Nearest_Ancestor (Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
361 -- Given a subtype Typ, this function finds out the nearest ancestor from
kono
parents:
diff changeset
362 -- which constraints and predicates are inherited. There is no simple link
kono
parents:
diff changeset
363 -- for doing this, consider:
kono
parents:
diff changeset
364 --
kono
parents:
diff changeset
365 -- subtype R is Integer range 1 .. 10;
kono
parents:
diff changeset
366 -- type T is new R;
kono
parents:
diff changeset
367 --
kono
parents:
diff changeset
368 -- In this case the nearest ancestor is R, but the Etype of T'Base will
kono
parents:
diff changeset
369 -- point to R'Base, so we have to go rummaging in the declarations to get
kono
parents:
diff changeset
370 -- this information. It is used for making sure we freeze this before we
kono
parents:
diff changeset
371 -- freeze Typ, and also for retrieving inherited predicate information.
kono
parents:
diff changeset
372 -- For the case of base types or first subtypes, there is no useful entity
kono
parents:
diff changeset
373 -- to return, so Empty is returned.
kono
parents:
diff changeset
374 --
kono
parents:
diff changeset
375 -- Note: this is similar to Ancestor_Subtype except that it also deals
kono
parents:
diff changeset
376 -- with the case of derived types.
kono
parents:
diff changeset
377
kono
parents:
diff changeset
378 function Nearest_Dynamic_Scope (Ent : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
379 -- This is similar to Enclosing_Dynamic_Scope except that if Ent is itself
kono
parents:
diff changeset
380 -- a dynamic scope, then it is returned. Otherwise the result is the same
kono
parents:
diff changeset
381 -- as that returned by Enclosing_Dynamic_Scope.
kono
parents:
diff changeset
382
kono
parents:
diff changeset
383 function Next_Tag_Component (Tag : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
384 -- Tag must be an entity representing a _Tag field of a tagged record.
kono
parents:
diff changeset
385 -- The result returned is the next _Tag field in this record, or Empty
kono
parents:
diff changeset
386 -- if this is the last such field.
kono
parents:
diff changeset
387
kono
parents:
diff changeset
388 function Number_Components (Typ : Entity_Id) return Nat;
kono
parents:
diff changeset
389 -- Typ is a record type, yields number of components (including
kono
parents:
diff changeset
390 -- discriminants) in type.
kono
parents:
diff changeset
391
kono
parents:
diff changeset
392 function Number_Discriminants (Typ : Entity_Id) return Pos;
kono
parents:
diff changeset
393 -- Typ is a type with discriminants, yields number of discriminants in type
kono
parents:
diff changeset
394
kono
parents:
diff changeset
395 function Object_Type_Has_Constrained_Partial_View
kono
parents:
diff changeset
396 (Typ : Entity_Id;
kono
parents:
diff changeset
397 Scop : Entity_Id) return Boolean;
kono
parents:
diff changeset
398 -- Return True if type of object has attribute Has_Constrained_Partial_View
kono
parents:
diff changeset
399 -- set to True; in addition, within a generic body, return True if subtype
kono
parents:
diff changeset
400 -- of the object is a descendant of an untagged generic formal private or
kono
parents:
diff changeset
401 -- derived type, and the subtype is not an unconstrained array subtype
kono
parents:
diff changeset
402 -- (RM 3.3(23.10/3)).
kono
parents:
diff changeset
403
kono
parents:
diff changeset
404 function Package_Body (E : Entity_Id) return Node_Id;
kono
parents:
diff changeset
405 -- Given an entity for a package (spec or body), return the corresponding
kono
parents:
diff changeset
406 -- package body if any, or else Empty.
kono
parents:
diff changeset
407
kono
parents:
diff changeset
408 function Package_Spec (E : Entity_Id) return Node_Id;
kono
parents:
diff changeset
409 -- Given an entity for a package spec, return the corresponding package
kono
parents:
diff changeset
410 -- spec if any, or else Empty.
kono
parents:
diff changeset
411
kono
parents:
diff changeset
412 function Package_Specification (E : Entity_Id) return Node_Id;
kono
parents:
diff changeset
413 -- Given an entity for a package, return the corresponding package
kono
parents:
diff changeset
414 -- specification.
kono
parents:
diff changeset
415
kono
parents:
diff changeset
416 function Subprogram_Body (E : Entity_Id) return Node_Id;
kono
parents:
diff changeset
417 -- Given an entity for a subprogram (spec or body), return the
kono
parents:
diff changeset
418 -- corresponding subprogram body if any, or else Empty.
kono
parents:
diff changeset
419
kono
parents:
diff changeset
420 function Subprogram_Body_Entity (E : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
421 -- Given an entity for a subprogram (spec or body), return the entity
kono
parents:
diff changeset
422 -- corresponding to the subprogram body, which may be the same as E or
kono
parents:
diff changeset
423 -- Empty if no body is available.
kono
parents:
diff changeset
424
kono
parents:
diff changeset
425 function Subprogram_Spec (E : Entity_Id) return Node_Id;
kono
parents:
diff changeset
426 -- Given an entity for a subprogram spec, return the corresponding
kono
parents:
diff changeset
427 -- subprogram spec if any, or else Empty.
kono
parents:
diff changeset
428
kono
parents:
diff changeset
429 function Subprogram_Specification (E : Entity_Id) return Node_Id;
kono
parents:
diff changeset
430 -- Given an entity for a subprogram, return the corresponding subprogram
kono
parents:
diff changeset
431 -- specification. If the entity is an inherited subprogram without
kono
parents:
diff changeset
432 -- specification itself, return the specification of the inherited
kono
parents:
diff changeset
433 -- subprogram.
kono
parents:
diff changeset
434
kono
parents:
diff changeset
435 function Ultimate_Alias (Prim : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
436 pragma Inline (Ultimate_Alias);
kono
parents:
diff changeset
437 -- Return the last entity in the chain of aliased entities of Prim. If Prim
kono
parents:
diff changeset
438 -- has no alias return Prim.
kono
parents:
diff changeset
439
kono
parents:
diff changeset
440 function Unit_Declaration_Node (Unit_Id : Entity_Id) return Node_Id;
kono
parents:
diff changeset
441 -- Unit_Id is the simple name of a program unit, this function returns the
kono
parents:
diff changeset
442 -- corresponding xxx_Declaration node for the entity. Also applies to the
kono
parents:
diff changeset
443 -- body entities for subprograms, tasks and protected units, in which case
kono
parents:
diff changeset
444 -- it returns the subprogram, task or protected body node for it. The unit
kono
parents:
diff changeset
445 -- may be a child unit with any number of ancestors.
kono
parents:
diff changeset
446
kono
parents:
diff changeset
447 end Sem_Aux;