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