]> gcc.gnu.org Git - gcc.git/blob - gcc/ada/sem_util.ads
[Ada] Minor reformattings
[gcc.git] / gcc / ada / sem_util.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S E M _ U T I L --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2021, Free Software Foundation, Inc. --
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 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
25
26 -- Package containing utility procedures used throughout the semantics
27
28 with Aspects; use Aspects;
29 with Atree; use Atree;
30 with Einfo; use Einfo;
31 with Einfo.Entities; use Einfo.Entities;
32 with Exp_Tss; use Exp_Tss;
33 with Namet; use Namet;
34 with Opt; use Opt;
35 with Snames; use Snames;
36 with Types; use Types;
37 with Uintp; use Uintp;
38 with Urealp; use Urealp;
39
40 package Sem_Util is
41
42 function Abstract_Interface_List (Typ : Entity_Id) return List_Id;
43 -- The list of interfaces implemented by Typ. Empty if there are none,
44 -- including the cases where there can't be any because e.g. the type is
45 -- not tagged.
46
47 type Accessibility_Level_Kind is
48 (Dynamic_Level,
49 Object_Decl_Level,
50 Zero_On_Dynamic_Level);
51 -- Accessibility_Level_Kind is an enumerated type which captures the
52 -- different modes in which an accessibility level could be obtained for
53 -- a given expression.
54
55 -- When in the context of the function Accessibility_Level,
56 -- Accessibility_Level_Kind signals what type of accessibility level to
57 -- obtain. For example, when Level is Dynamic_Level, a defining identifier
58 -- associated with a SAOOAAT may be returned or an N_Integer_Literal node.
59 -- When the level is Object_Decl_Level, an N_Integer_Literal node is
60 -- returned containing the level of the declaration of the object if
61 -- relevant (be it a SAOOAAT or otherwise). Finally, Zero_On_Dynamic_Level
62 -- returns library level for all cases where the accessibility level is
63 -- dynamic (used to bypass static accessibility checks in dynamic cases).
64
65 function Accessibility_Level
66 (Expr : Node_Id;
67 Level : Accessibility_Level_Kind;
68 In_Return_Context : Boolean := False) return Node_Id;
69 -- Centralized accessibility level calculation routine for finding the
70 -- accessibility level of a given expression Expr.
71
72 -- In_Return_Context forcing the Accessibility_Level calculations to be
73 -- carried out "as if" Expr existed in a return value. This is useful for
74 -- calculating the accessibility levels for discriminant associations
75 -- and return aggregates.
76
77 function Acquire_Warning_Match_String (Str_Lit : Node_Id) return String;
78 -- Used by pragma Warnings (Off, string), and Warn_As_Error (string) to get
79 -- the given string argument, adding leading and trailing asterisks if they
80 -- are not already present. Str_Lit is the static value of the pragma
81 -- argument.
82
83 procedure Add_Access_Type_To_Process (E : Entity_Id; A : Entity_Id);
84 -- Add A to the list of access types to process when expanding the
85 -- freeze node of E.
86
87 procedure Add_Block_Identifier (N : Node_Id; Id : out Entity_Id);
88 -- Given a block statement N, generate an internal E_Block label and make
89 -- it the identifier of the block. Id denotes the generated entity. If the
90 -- block already has an identifier, Id returns the entity of its label.
91
92 procedure Add_Global_Declaration (N : Node_Id);
93 -- These procedures adds a declaration N at the library level, to be
94 -- elaborated before any other code in the unit. It is used for example
95 -- for the entity that marks whether a unit has been elaborated. The
96 -- declaration is added to the Declarations list of the Aux_Decls_Node
97 -- for the current unit. The declarations are added in the current scope,
98 -- so the caller should push a new scope as required before the call.
99
100 function Add_Suffix (E : Entity_Id; Suffix : Character) return Name_Id;
101 -- Returns the name of E adding Suffix
102
103 function Address_Integer_Convert_OK (T1, T2 : Entity_Id) return Boolean;
104 -- Given two types, returns True if we are in Allow_Integer_Address mode
105 -- and one of the types is (a descendant of) System.Address (and this type
106 -- is private), and the other type is any integer type.
107
108 function Address_Value (N : Node_Id) return Node_Id;
109 -- Return the underlying value of the expression N of an address clause
110
111 function Addressable (V : Uint) return Boolean;
112 function Addressable (V : Int) return Boolean;
113 pragma Inline (Addressable);
114 -- Returns True if the value of V is the word size or an addressable factor
115 -- or multiple of the word size (typically 8, 16, 32, 64 or 128).
116
117 procedure Aggregate_Constraint_Checks
118 (Exp : Node_Id;
119 Check_Typ : Entity_Id);
120 -- Checks expression Exp against subtype Check_Typ. If Exp is an aggregate
121 -- and Check_Typ a constrained record type with discriminants, we generate
122 -- the appropriate discriminant checks. If Exp is an array aggregate then
123 -- emit the appropriate length checks. If Exp is a scalar type, or a string
124 -- literal, Exp is changed into Check_Typ'(Exp) to ensure that range checks
125 -- are performed at run time. Also used for expressions in the argument of
126 -- 'Update, which shares some of the features of an aggregate.
127
128 function Alignment_In_Bits (E : Entity_Id) return Uint;
129 -- If the alignment of the type or object E is currently known to the
130 -- compiler, then this function returns the alignment value in bits.
131 -- Otherwise Uint_0 is returned, indicating that the alignment of the
132 -- entity is not yet known to the compiler.
133
134 function All_Composite_Constraints_Static (Constr : Node_Id) return Boolean;
135 -- Used to implement pragma Restrictions (No_Dynamic_Sized_Objects).
136 -- Given a constraint or subtree of a constraint on a composite
137 -- subtype/object, returns True if there are no nonstatic constraints,
138 -- which might cause objects to be created with dynamic size.
139 -- Called for subtype declarations (including implicit ones created for
140 -- subtype indications in object declarations, as well as discriminated
141 -- record aggregate cases). For record aggregates, only records containing
142 -- discriminant-dependent arrays matter, because the discriminants must be
143 -- static when governing a variant part. Access discriminants are
144 -- irrelevant. Also called for array aggregates, but only named notation,
145 -- because those are the only dynamic cases.
146
147 procedure Append_Entity_Name (Buf : in out Bounded_String; E : Entity_Id);
148 -- Recursive procedure to construct string for qualified name of enclosing
149 -- program unit. The qualification stops at an enclosing scope has no
150 -- source name (block or loop). If entity is a subprogram instance, skip
151 -- enclosing wrapper package. The name is appended to Buf.
152
153 procedure Append_Inherited_Subprogram (S : Entity_Id);
154 -- If the parent of the operation is declared in the visible part of
155 -- the current scope, the inherited operation is visible even though the
156 -- derived type that inherits the operation may be completed in the private
157 -- part of the current package.
158
159 procedure Apply_Compile_Time_Constraint_Error
160 (N : Node_Id;
161 Msg : String;
162 Reason : RT_Exception_Code;
163 Ent : Entity_Id := Empty;
164 Typ : Entity_Id := Empty;
165 Loc : Source_Ptr := No_Location;
166 Warn : Boolean := False);
167 -- N is a subexpression that will raise Constraint_Error when evaluated
168 -- at run time. Msg is a message that explains the reason for raising the
169 -- exception. The last character is ? if the message is always a warning,
170 -- even in Ada 95, and is not a ? if the message represents an illegality
171 -- (because of violation of static expression rules) in Ada 95 (but not
172 -- in Ada 83). Typically this routine posts all messages at the Sloc of
173 -- node N. However, if Loc /= No_Location, Loc is the Sloc used to output
174 -- the message. After posting the appropriate message, this routine
175 -- replaces the expression with an appropriate N_Raise_Constraint_Error
176 -- node using the given Reason code. This node is then marked as being
177 -- static if the original node is static, but sets the flag
178 -- Raises_Constraint_Error, preventing further evaluation. The error
179 -- message may contain a } or & insertion character. This normally
180 -- references Etype (N), unless the Ent argument is given explicitly, in
181 -- which case it is used instead. The type of the raise node that is built
182 -- is normally Etype (N), but if the Typ parameter is present, this is used
183 -- instead. Warn is normally False. If it is True then the message is
184 -- treated as a warning even though it does not end with a ? (this is used
185 -- when the caller wants to parameterize whether an error or warning is
186 -- given), or when the message should be treated as a warning even when
187 -- SPARK_Mode is On (which otherwise would force an error).
188
189 function Async_Readers_Enabled (Id : Entity_Id) return Boolean;
190 -- Id should be the entity of a state abstraction, an object, or a type.
191 -- Returns True iff Id is subject to external property Async_Readers.
192
193 function Async_Writers_Enabled (Id : Entity_Id) return Boolean;
194 -- Id should be the entity of a state abstraction, an object, or a type.
195 -- Returns True iff Id is subject to external property Async_Writers.
196
197 function Available_Full_View_Of_Component (T : Entity_Id) return Boolean;
198 -- If at the point of declaration an array type has a private or limited
199 -- component, several array operations are not available on the type, and
200 -- the array type is flagged accordingly. If in the immediate scope of
201 -- the array type the component becomes non-private or non-limited, these
202 -- operations become available. This can happen if the scopes of both types
203 -- are open, and the scope of the array is not outside the scope of the
204 -- component.
205
206 procedure Bad_Attribute
207 (N : Node_Id;
208 Nam : Name_Id;
209 Warn : Boolean := False);
210 -- Called when node N is expected to contain a valid attribute name, and
211 -- Nam is found instead. If Warn is set True this is a warning, else this
212 -- is an error.
213
214 procedure Bad_Predicated_Subtype_Use
215 (Msg : String;
216 N : Node_Id;
217 Typ : Entity_Id;
218 Suggest_Static : Boolean := False);
219 -- This is called when Typ, a predicated subtype, is used in a context
220 -- which does not allow the use of a predicated subtype. Msg is passed to
221 -- Error_Msg_FE to output an appropriate message using N as the location,
222 -- and Typ as the entity. The caller must set up any insertions other than
223 -- the & for the type itself. Note that if Typ is a generic actual type,
224 -- then the message will be output as a warning, and a raise Program_Error
225 -- is inserted using Insert_Action with node N as the insertion point. Node
226 -- N also supplies the source location for construction of the raise node.
227 -- If Typ does not have any predicates, the call has no effect. Set flag
228 -- Suggest_Static when the context warrants an advice on how to avoid the
229 -- use error.
230
231 function Bad_Unordered_Enumeration_Reference
232 (N : Node_Id;
233 T : Entity_Id) return Boolean;
234 -- Node N contains a potentially dubious reference to type T, either an
235 -- explicit comparison, or an explicit range. This function returns True
236 -- if the type T is an enumeration type for which No pragma Order has been
237 -- given, and the reference N is not in the same extended source unit as
238 -- the declaration of T.
239
240 function Begin_Keyword_Location (N : Node_Id) return Source_Ptr;
241 -- Given block statement, entry body, package body, subprogram body, or
242 -- task body N, return the closest source location to the "begin" keyword.
243
244 function Build_Actual_Subtype
245 (T : Entity_Id;
246 N : Node_Or_Entity_Id) return Node_Id;
247 -- Build an anonymous subtype for an entity or expression, using the
248 -- bounds of the entity or the discriminants of the enclosing record.
249 -- T is the type for which the actual subtype is required, and N is either
250 -- a defining identifier, or any subexpression.
251
252 function Build_Actual_Subtype_Of_Component
253 (T : Entity_Id;
254 N : Node_Id) return Node_Id;
255 -- Determine whether a selected component has a type that depends on
256 -- discriminants, and build actual subtype for it if so.
257
258 -- Handling of inherited primitives whose ancestors have class-wide
259 -- pre/postconditions.
260
261 -- If a primitive operation of a parent type has a class-wide pre/post-
262 -- condition that includes calls to other primitives, and that operation
263 -- is inherited by a descendant type that also overrides some of these
264 -- other primitives, the condition that applies to the inherited
265 -- operation has a modified condition in which the overridden primitives
266 -- have been replaced by the primitives of the descendent type. A call
267 -- to the inherited operation cannot be simply a call to the parent
268 -- operation (with an appropriate conversion) as is the case for other
269 -- inherited operations, but must appear with a wrapper subprogram to which
270 -- the modified conditions apply. Furthermore the call to the parent
271 -- operation must not be subject to the original class-wide condition,
272 -- given that modified conditions apply. To implement these semantics
273 -- economically we create a subprogram body (a "class-wide clone") to
274 -- which no pre/postconditions apply, and we create bodies for the
275 -- original and the inherited operation that have their respective
276 -- pre/postconditions and simply call the clone. The following operations
277 -- take care of constructing declaration and body of the clone, and
278 -- building the calls to it within the appropriate wrappers.
279
280 procedure Build_Class_Wide_Clone_Body
281 (Spec_Id : Entity_Id;
282 Bod : Node_Id);
283 -- Build body of subprogram that has a class-wide condition that contains
284 -- calls to other primitives. Spec_Id is the Id of the subprogram, and B
285 -- is its source body, which becomes the body of the clone.
286
287 function Build_Class_Wide_Clone_Call
288 (Loc : Source_Ptr;
289 Decls : List_Id;
290 Spec_Id : Entity_Id;
291 Spec : Node_Id) return Node_Id;
292 -- Build a call to the common class-wide clone of a subprogram with
293 -- class-wide conditions. The body of the subprogram becomes a wrapper
294 -- for a call to the clone. The inherited operation becomes a similar
295 -- wrapper to which modified conditions apply, and the call to the
296 -- clone includes the proper conversion in a call the parent operation.
297
298 procedure Build_Class_Wide_Clone_Decl (Spec_Id : Entity_Id);
299 -- For a subprogram that has a class-wide condition that contains calls
300 -- to other primitives, build an internal subprogram that is invoked
301 -- through a type-specific wrapper for all inherited subprograms that
302 -- may have a modified condition.
303
304 procedure Build_Constrained_Itype
305 (N : Node_Id;
306 Typ : Entity_Id;
307 New_Assoc_List : List_Id);
308 -- Build a constrained itype for the newly created record aggregate N and
309 -- set it as a type of N. The itype will have Typ as its base type and
310 -- will be constrained by the values of discriminants from the component
311 -- association list New_Assoc_List.
312
313 -- ??? This code used to be pretty much a copy of Build_Subtype, but now
314 -- those two routines behave differently for types with unknown
315 -- discriminants. They are both exported in from this package in the hope
316 -- to eventually unify them (a not duplicate them even more until then).
317
318 -- ??? Performance WARNING. The current implementation creates a new itype
319 -- for all aggregates whose base type is discriminated. This means that
320 -- for record aggregates nested inside an array aggregate we will create
321 -- a new itype for each record aggregate if the array component type has
322 -- discriminants. For large aggregates this may be a problem. What should
323 -- be done in this case is to reuse itypes as much as possible.
324
325 function Build_Default_Subtype
326 (T : Entity_Id;
327 N : Node_Id) return Entity_Id;
328 -- If T is an unconstrained type with defaulted discriminants, build a
329 -- subtype constrained by the default values, insert the subtype
330 -- declaration in the tree before N, and return the entity of that
331 -- subtype. Otherwise, simply return T.
332
333 function Build_Discriminal_Subtype_Of_Component
334 (T : Entity_Id) return Node_Id;
335 -- Determine whether a record component has a type that depends on
336 -- discriminants, and build actual subtype for it if so.
337
338 procedure Build_Elaboration_Entity (N : Node_Id; Spec_Id : Entity_Id);
339 -- Given a compilation unit node N, allocate an elaboration counter for
340 -- the compilation unit, and install it in the Elaboration_Entity field
341 -- of Spec_Id, the entity for the compilation unit.
342
343 procedure Build_Explicit_Dereference
344 (Expr : Node_Id;
345 Disc : Entity_Id);
346 -- AI05-139: Names with implicit dereference. If the expression N is a
347 -- reference type and the context imposes the corresponding designated
348 -- type, convert N into N.Disc.all. Such expressions are always over-
349 -- loaded with both interpretations, and the dereference interpretation
350 -- carries the name of the reference discriminant.
351
352 function Build_Overriding_Spec
353 (Op : Node_Id;
354 Typ : Entity_Id) return Node_Id;
355 -- Build a subprogram specification for the wrapper of an inherited
356 -- operation with a modified pre- or postcondition (See AI12-0113).
357 -- Op is the parent operation, and Typ is the descendant type that
358 -- inherits the operation.
359
360 function Build_Subtype
361 (Related_Node : Node_Id;
362 Loc : Source_Ptr;
363 Typ : Entity_Id;
364 Constraints : List_Id)
365 return Entity_Id;
366 -- Typ is an array or discriminated type, Constraints is a list of
367 -- constraints that apply to Typ. This routine builds the constrained
368 -- subtype using Loc as the source location and attached this subtype
369 -- declaration to Related_Node. The returned subtype inherits predicates
370 -- from Typ.
371
372 -- ??? The routine is mostly a duplicate of Build_Constrained_Itype, so be
373 -- careful which of the two better suits your needs (and certainly do not
374 -- duplicate their code).
375
376 function Cannot_Raise_Constraint_Error (Expr : Node_Id) return Boolean;
377 -- Returns True if the expression cannot possibly raise Constraint_Error.
378 -- The response is conservative in the sense that a result of False does
379 -- not necessarily mean that CE could be raised, but a response of True
380 -- means that for sure CE cannot be raised.
381
382 procedure Check_Ambiguous_Aggregate (Call : Node_Id);
383 -- Additional information on an ambiguous call in Ada_2020 when a
384 -- subprogram call has an actual that is an aggregate, and the
385 -- presence of container aggregates (or types with the correwponding
386 -- aspect) provides an additional interpretation. Message indicates
387 -- that an aggregate actual should carry a type qualification.
388
389 procedure Check_Dynamically_Tagged_Expression
390 (Expr : Node_Id;
391 Typ : Entity_Id;
392 Related_Nod : Node_Id);
393 -- Check wrong use of dynamically tagged expression
394
395 procedure Check_Fully_Declared (T : Entity_Id; N : Node_Id);
396 -- Verify that the full declaration of type T has been seen. If not, place
397 -- error message on node N. Used in object declarations, type conversions
398 -- and qualified expressions.
399
400 procedure Check_Function_With_Address_Parameter (Subp_Id : Entity_Id);
401 -- A subprogram that has an Address parameter and is declared in a Pure
402 -- package is not considered Pure, because the parameter may be used as a
403 -- pointer and the referenced data may change even if the address value
404 -- itself does not.
405 -- If the programmer gave an explicit Pure_Function pragma, then we respect
406 -- the pragma and leave the subprogram Pure.
407
408 procedure Check_Function_Writable_Actuals (N : Node_Id);
409 -- (Ada 2012): If the construct N has two or more direct constituents that
410 -- are names or expressions whose evaluation may occur in an arbitrary
411 -- order, at least one of which contains a function call with an in out or
412 -- out parameter, then the construct is legal only if: for each name that
413 -- is passed as a parameter of mode in out or out to some inner function
414 -- call C2 (not including the construct N itself), there is no other name
415 -- anywhere within a direct constituent of the construct C other than
416 -- the one containing C2, that is known to refer to the same object (RM
417 -- 6.4.1(6.17/3)).
418
419 procedure Check_Implicit_Dereference (N : Node_Id; Typ : Entity_Id);
420 -- AI05-139-2: Accessors and iterators for containers. This procedure
421 -- checks whether T is a reference type, and if so it adds an interprettion
422 -- to N whose type is the designated type of the reference_discriminant.
423 -- If N is a generalized indexing operation, the interpretation is added
424 -- both to the corresponding function call, and to the indexing node.
425
426 procedure Check_Internal_Protected_Use (N : Node_Id; Nam : Entity_Id);
427 -- Within a protected function, the current object is a constant, and
428 -- internal calls to a procedure or entry are illegal. Similarly, other
429 -- uses of a protected procedure in a renaming or a generic instantiation
430 -- in the context of a protected function are illegal (AI05-0225).
431
432 procedure Check_Later_Vs_Basic_Declarations
433 (Decls : List_Id;
434 During_Parsing : Boolean);
435 -- If During_Parsing is True, check for misplacement of later vs basic
436 -- declarations in Ada 83. If During_Parsing is False, and the SPARK
437 -- restriction is set, do the same: although SPARK 95 removes the
438 -- distinction between initial and later declarative items, the distinction
439 -- remains in the Examiner (JB01-005). Note that the Examiner does not
440 -- count package declarations in later declarative items.
441
442 procedure Check_No_Hidden_State (Id : Entity_Id);
443 -- Determine whether object or state Id introduces a hidden state. If this
444 -- is the case, emit an error.
445
446 procedure Check_Inherited_Nonoverridable_Aspects
447 (Inheritor : Entity_Id;
448 Interface_List : List_Id;
449 Parent_Type : Entity_Id);
450 -- Verify consistency of inherited nonoverridable aspects
451 -- when aspects are inherited from more than one source.
452 -- Parent_Type may be void (e.g., for a tagged task/protected type
453 -- whose declaration includes a non-empty interface list).
454 -- In the error case, error message is associate with Inheritor;
455 -- Inheritor parameter is otherwise unused.
456
457 procedure Check_Nonvolatile_Function_Profile (Func_Id : Entity_Id);
458 -- Verify that the profile of nonvolatile function Func_Id does not contain
459 -- effectively volatile parameters or return type for reading.
460
461 procedure Check_Part_Of_Reference (Var_Id : Entity_Id; Ref : Node_Id);
462 -- Verify the legality of reference Ref to variable Var_Id when the
463 -- variable is a constituent of a single protected/task type.
464
465 procedure Check_Potentially_Blocking_Operation (N : Node_Id);
466 -- N is one of the statement forms that is a potentially blocking
467 -- operation. If it appears within a protected action, emit warning.
468
469 procedure Check_Previous_Null_Procedure
470 (Decl : Node_Id;
471 Prev : Entity_Id);
472 -- A null procedure or a subprogram renaming can complete a previous
473 -- declaration, unless that previous declaration is itself a null
474 -- procedure. This must be treated specially because the analysis of
475 -- the null procedure leaves the corresponding entity as having no
476 -- completion, because its completion is provided by a generated body
477 -- inserted after all other declarations.
478
479 procedure Check_Result_And_Post_State (Subp_Id : Entity_Id);
480 -- Determine whether the contract of subprogram Subp_Id mentions attribute
481 -- 'Result and it contains an expression that evaluates differently in pre-
482 -- and post-state.
483
484 procedure Check_State_Refinements
485 (Context : Node_Id;
486 Is_Main_Unit : Boolean := False);
487 -- Verify that all abstract states declared in a block statement, entry
488 -- body, package body, protected body, subprogram body, task body, or a
489 -- package declaration denoted by Context have proper refinement. Emit an
490 -- error if this is not the case. Flag Is_Main_Unit should be set when
491 -- Context denotes the main compilation unit.
492
493 procedure Check_Unused_Body_States (Body_Id : Entity_Id);
494 -- Verify that all abstract states and objects declared in the state space
495 -- of package body Body_Id are used as constituents. Emit an error if this
496 -- is not the case.
497
498 procedure Check_Unprotected_Access
499 (Context : Node_Id;
500 Expr : Node_Id);
501 -- Check whether the expression is a pointer to a protected component,
502 -- and the context is external to the protected operation, to warn against
503 -- a possible unlocked access to data.
504
505 procedure Check_Volatility_Compatibility
506 (Id1, Id2 : Entity_Id;
507 Description_1, Description_2 : String;
508 Srcpos_Bearer : Node_Id);
509 -- Id1 and Id2 should each be the entity of a state abstraction, a
510 -- variable, or a type (i.e., something suitable for passing to
511 -- Async_Readers_Enabled and similar functions).
512 -- Does nothing if SPARK_Mode /= On. Otherwise, flags a legality violation
513 -- if one or more of the four volatility-related aspects is False for Id1
514 -- and True for Id2. The two descriptions are included in the error message
515 -- text; the source position for the generated message is determined by
516 -- Srcpos_Bearer.
517
518 function Choice_List (N : Node_Id) return List_Id;
519 -- Utility to retrieve the choices of a Component_Association or the
520 -- Discrete_Choices of an Iterated_Component_Association. For various
521 -- reasons these nodes have a different structure even though they play
522 -- similar roles in array aggregates.
523
524 function Collect_Body_States (Body_Id : Entity_Id) return Elist_Id;
525 -- Gather the entities of all abstract states and objects declared in the
526 -- body state space of package body Body_Id.
527
528 procedure Collect_Interfaces
529 (T : Entity_Id;
530 Ifaces_List : out Elist_Id;
531 Exclude_Parents : Boolean := False;
532 Use_Full_View : Boolean := True);
533 -- Ada 2005 (AI-251): Collect whole list of abstract interfaces that are
534 -- directly or indirectly implemented by T. Exclude_Parents is used to
535 -- avoid the addition of inherited interfaces to the generated list.
536 -- Use_Full_View is used to collect the interfaces using the full-view
537 -- (if available).
538
539 procedure Collect_Interface_Components
540 (Tagged_Type : Entity_Id;
541 Components_List : out Elist_Id);
542 -- Ada 2005 (AI-251): Collect all the tag components associated with the
543 -- secondary dispatch tables of a tagged type.
544
545 procedure Collect_Interfaces_Info
546 (T : Entity_Id;
547 Ifaces_List : out Elist_Id;
548 Components_List : out Elist_Id;
549 Tags_List : out Elist_Id);
550 -- Ada 2005 (AI-251): Collect all the interfaces associated with T plus
551 -- the record component and tag associated with each of these interfaces.
552 -- On exit Ifaces_List, Components_List and Tags_List have the same number
553 -- of elements, and elements at the same position on these tables provide
554 -- information on the same interface type.
555
556 procedure Collect_Parents
557 (T : Entity_Id;
558 List : out Elist_Id;
559 Use_Full_View : Boolean := True);
560 -- Collect all the parents of Typ. Use_Full_View is used to collect them
561 -- using the full-view of private parents (if available).
562
563 function Collect_Primitive_Operations (T : Entity_Id) return Elist_Id;
564 -- Called upon type derivation and extension. We scan the declarative part
565 -- in which the type appears, and collect subprograms that have one
566 -- subsidiary subtype of the type. These subprograms can only appear after
567 -- the type itself.
568
569 function Compile_Time_Constraint_Error
570 (N : Node_Id;
571 Msg : String;
572 Ent : Entity_Id := Empty;
573 Loc : Source_Ptr := No_Location;
574 Warn : Boolean := False;
575 Extra_Msg : String := "") return Node_Id;
576 -- This is similar to Apply_Compile_Time_Constraint_Error in that it
577 -- generates a warning (or error) message in the same manner, but it does
578 -- not replace any nodes. For convenience, the function always returns its
579 -- first argument. The message is a warning if the message ends with ?, or
580 -- we are operating in Ada 83 mode, or the Warn parameter is set to True.
581 -- If Extra_Msg is not a null string, then it's associated with N and
582 -- emitted immediately after the main message (and before output of any
583 -- message indicating that Constraint_Error will be raised).
584
585 generic
586 with function Predicate (Typ : Entity_Id) return Boolean;
587 function Collect_Types_In_Hierarchy
588 (Typ : Entity_Id;
589 Examine_Components : Boolean := False) return Elist_Id;
590 -- Inspect the ancestor and progenitor types of Typ and Typ itself -
591 -- collecting those for which function Predicate is True. The resulting
592 -- list is ordered in a type-to-ultimate-ancestor fashion.
593
594 -- When Examine_Components is True, components types in the hierarchy also
595 -- get collected.
596
597 procedure Conditional_Delay (New_Ent, Old_Ent : Entity_Id);
598 -- Sets the Has_Delayed_Freeze flag of New_Ent if the Delayed_Freeze flag
599 -- of Old_Ent is set and Old_Ent has not yet been Frozen (i.e. Is_Frozen is
600 -- False).
601
602 function Copy_Component_List
603 (R_Typ : Entity_Id;
604 Loc : Source_Ptr) return List_Id;
605 -- Copy components from record type R_Typ that come from source. Used to
606 -- create a new compatible record type. Loc is the source location assigned
607 -- to the created nodes.
608
609 function Copy_Parameter_List (Subp_Id : Entity_Id) return List_Id;
610 -- Utility to create a parameter profile for a new subprogram spec, when
611 -- the subprogram has a body that acts as spec. This is done for some cases
612 -- of inlining, and for private protected ops. Also used to create bodies
613 -- for stubbed subprograms.
614
615 procedure Copy_SPARK_Mode_Aspect (From : Node_Id; To : Node_Id);
616 -- Copy the SPARK_Mode aspect if present in the aspect specifications
617 -- of node From to node To. On entry it is assumed that To does not have
618 -- aspect specifications. If From has no aspects, the routine has no
619 -- effect.
620
621 function Copy_Subprogram_Spec (Spec : Node_Id) return Node_Id;
622 -- Replicate a function or a procedure specification denoted by Spec. The
623 -- resulting tree is an exact duplicate of the original tree. New entities
624 -- are created for the unit name and the formal parameters.
625
626 function Corresponding_Generic_Type (T : Entity_Id) return Entity_Id;
627 -- If a type is a generic actual type, return the corresponding formal in
628 -- the generic parent unit. There is no direct link in the tree for this
629 -- attribute, except in the case of formal private and derived types.
630 -- Possible optimization???
631
632 function Current_Entity (N : Node_Id) return Entity_Id;
633 pragma Inline (Current_Entity);
634 -- Find the currently visible definition for a given identifier, that is to
635 -- say the first entry in the visibility chain for the Chars of N.
636
637 function Current_Entity_In_Scope (N : Name_Id) return Entity_Id;
638 function Current_Entity_In_Scope (N : Node_Id) return Entity_Id;
639 -- Find whether there is a previous definition for name or identifier N in
640 -- the current scope. Because declarations for a scope are not necessarily
641 -- contiguous (e.g. for packages) the first entry on the visibility chain
642 -- for N is not necessarily in the current scope.
643
644 function Current_Scope return Entity_Id;
645 -- Get entity representing current scope
646
647 function Current_Scope_No_Loops return Entity_Id;
648 -- Return the current scope ignoring internally generated loops
649
650 function Current_Subprogram return Entity_Id;
651 -- Returns current enclosing subprogram. If Current_Scope is a subprogram,
652 -- then that is what is returned, otherwise the Enclosing_Subprogram of the
653 -- Current_Scope is returned. The returned value is Empty if this is called
654 -- from a library package which is not within any subprogram.
655
656 function Deepest_Type_Access_Level (Typ : Entity_Id) return Uint;
657 -- Same as Type_Access_Level, except that if the type is the type of an Ada
658 -- 2012 stand-alone object of an anonymous access type, then return the
659 -- static accessibility level of the object. In that case, the dynamic
660 -- accessibility level of the object may take on values in a range. The low
661 -- bound of that range is returned by Type_Access_Level; this function
662 -- yields the high bound of that range. Also differs from Type_Access_Level
663 -- in the case of a descendant of a generic formal type (returns Int'Last
664 -- instead of 0).
665
666 function Defining_Entity (N : Node_Id) return Entity_Id;
667 -- Given a declaration N, returns the associated defining entity. If the
668 -- declaration has a specification, the entity is obtained from the
669 -- specification. If the declaration has a defining unit name, then the
670 -- defining entity is obtained from the defining unit name ignoring any
671 -- child unit prefixes.
672 --
673 -- Iterator loops also have a defining entity, which holds the list of
674 -- local entities declared during loop expansion. These entities need
675 -- debugging information, generated through Qualify_Entity_Names, and
676 -- the loop declaration must be placed in the table Name_Qualify_Units.
677
678 -- WARNING: There is a matching C declaration of this subprogram in fe.h
679
680 function Defining_Entity_Or_Empty (N : Node_Id) return Entity_Id;
681 -- This is equivalent to Defining_Entity but it returns Empty for nodes
682 -- without an entity instead of raising Program_Error.
683
684 function Denotes_Discriminant
685 (N : Node_Id;
686 Check_Concurrent : Boolean := False) return Boolean;
687 -- Returns True if node N is an Entity_Name node for a discriminant. If the
688 -- flag Check_Concurrent is true, function also returns true when N denotes
689 -- the discriminal of the discriminant of a concurrent type. This is needed
690 -- to disable some optimizations on private components of protected types,
691 -- and constraint checks on entry families constrained by discriminants.
692
693 function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean;
694 -- Detect suspicious overlapping between actuals in a call, when both are
695 -- writable (RM 2012 6.4.1(6.4/3)).
696
697 function Denotes_Same_Prefix (A1, A2 : Node_Id) return Boolean;
698 -- Functions to detect suspicious overlapping between actuals in a call,
699 -- when one of them is writable. The predicates are those proposed in
700 -- AI05-0144, to detect dangerous order dependence in complex calls.
701 -- I would add a parameter Warn which enables more extensive testing of
702 -- cases as we find appropriate when we are only warning ??? Or perhaps
703 -- return an indication of (Error, Warn, OK) ???
704
705 function Denotes_Variable (N : Node_Id) return Boolean;
706 -- Returns True if node N denotes a single variable without parentheses
707
708 function Depends_On_Discriminant (N : Node_Id) return Boolean;
709 -- Returns True if N denotes a discriminant or if N is a range, a subtype
710 -- indication or a scalar subtype where one of the bounds is a
711 -- discriminant.
712
713 function Derivation_Too_Early_To_Inherit
714 (Typ : Entity_Id; Streaming_Op : TSS_Name_Type) return Boolean;
715 -- Returns True if Typ is a derived type, the given Streaming_Op
716 -- (one of Read, Write, Input, or Output) is explicitly specified
717 -- for Typ's parent type, and that attribute specification is *not*
718 -- inherited by Typ because the declaration of Typ precedes that
719 -- of the attribute specification.
720
721 function Designate_Same_Unit
722 (Name1 : Node_Id;
723 Name2 : Node_Id) return Boolean;
724 -- Returns True if Name1 and Name2 designate the same unit name; each of
725 -- these names is supposed to be a selected component name, an expanded
726 -- name, a defining program unit name or an identifier.
727
728 procedure Diagnose_Iterated_Component_Association (N : Node_Id);
729 -- Emit an error if iterated component association N is actually an illegal
730 -- quantified expression lacking a quantifier.
731
732 function Discriminated_Size (Comp : Entity_Id) return Boolean;
733 -- If a component size is not static then a warning will be emitted
734 -- in Ravenscar or other restricted contexts. When a component is non-
735 -- static because of a discriminant constraint we can specialize the
736 -- warning by mentioning discriminants explicitly. This was created for
737 -- private components of protected objects, but is generally useful when
738 -- restriction No_Implicit_Heap_Allocation is active.
739
740 function Effective_Extra_Accessibility (Id : Entity_Id) return Entity_Id;
741 -- Same as Einfo.Extra_Accessibility except thtat object renames
742 -- are looked through.
743
744 function Effective_Reads_Enabled (Id : Entity_Id) return Boolean;
745 -- Id should be the entity of a state abstraction, an object, or a type.
746 -- Returns True iff Id is subject to external property Effective_Reads.
747
748 function Effective_Writes_Enabled (Id : Entity_Id) return Boolean;
749 -- Id should be the entity of a state abstraction, an object, or a type.
750 -- Returns True iff Id is subject to external property Effective_Writes.
751
752 function Enclosing_Comp_Unit_Node (N : Node_Id) return Node_Id;
753 -- Returns the enclosing N_Compilation_Unit node that is the root of a
754 -- subtree containing N.
755
756 function Enclosing_CPP_Parent (Typ : Entity_Id) return Entity_Id;
757 -- Returns the closest ancestor of Typ that is a CPP type.
758
759 function Enclosing_Declaration (N : Node_Id) return Node_Id;
760 -- Returns the declaration node enclosing N (including possibly N itself),
761 -- if any, or Empty otherwise.
762
763 function Enclosing_Generic_Body (N : Node_Id) return Node_Id;
764 -- Returns the Node_Id associated with the innermost enclosing generic
765 -- body, if any. If none, then returns Empty.
766
767 function Enclosing_Generic_Unit (N : Node_Id) return Node_Id;
768 -- Returns the Node_Id associated with the innermost enclosing generic
769 -- unit, if any. If none, then returns Empty.
770
771 function Enclosing_HSS (Stmt : Node_Id) return Node_Id;
772 -- Returns the nearest handled sequence of statements that encloses a given
773 -- statement, or Empty.
774
775 function Enclosing_Lib_Unit_Entity
776 (E : Entity_Id := Current_Scope) return Entity_Id;
777 -- Returns the entity of enclosing library unit node which is the root of
778 -- the current scope (which must not be Standard_Standard, and the caller
779 -- is responsible for ensuring this condition) or other specified entity.
780
781 function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id;
782 -- Returns the N_Compilation_Unit node of the library unit that is directly
783 -- or indirectly (through a subunit) at the root of a subtree containing
784 -- N. This may be either the same as Enclosing_Comp_Unit_Node, or if
785 -- Enclosing_Comp_Unit_Node returns a subunit, then the corresponding
786 -- library unit. If no such item is found, returns Empty.
787
788 function Enclosing_Package (E : Entity_Id) return Entity_Id;
789 -- Utility function to return the Ada entity of the package enclosing
790 -- the entity E, if any. Returns Empty if no enclosing package.
791
792 function Enclosing_Package_Or_Subprogram (E : Entity_Id) return Entity_Id;
793 -- Returns the entity of the package or subprogram enclosing E, if any.
794 -- Returns Empty if no enclosing package or subprogram.
795
796 function Enclosing_Subprogram (E : Entity_Id) return Entity_Id;
797 -- Utility function to return the Ada entity of the subprogram enclosing
798 -- the entity E, if any. Returns Empty if no enclosing subprogram.
799
800 function End_Keyword_Location (N : Node_Id) return Source_Ptr;
801 -- Given block statement, entry body, package body, package declaration,
802 -- protected body, [single] protected type declaration, subprogram body,
803 -- task body, or [single] task type declaration N, return the closest
804 -- source location of the "end" keyword.
805
806 procedure Ensure_Freeze_Node (E : Entity_Id);
807 -- Make sure a freeze node is allocated for entity E. If necessary, build
808 -- and initialize a new freeze node and set Has_Delayed_Freeze True for E.
809
810 procedure Enter_Name (Def_Id : Entity_Id);
811 -- Insert new name in symbol table of current scope with check for
812 -- duplications (error message is issued if a conflict is found).
813 -- Note: Enter_Name is not used for overloadable entities, instead these
814 -- are entered using Sem_Ch6.Enter_Overloaded_Entity.
815
816 function Entity_Of (N : Node_Id) return Entity_Id;
817 -- Obtain the entity of arbitrary node N. If N is a renaming, return the
818 -- entity of the earliest renamed source abstract state or whole object.
819 -- If no suitable entity is available, return Empty. This routine carries
820 -- out actions that are tied to SPARK semantics.
821
822 function Exceptions_OK return Boolean;
823 -- Determine whether exceptions are allowed to be caught, propagated, or
824 -- raised.
825
826 procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id);
827 -- This procedure is called after issuing a message complaining about an
828 -- inappropriate use of limited type T. If useful, it adds additional
829 -- continuation lines to the message explaining why type T is limited.
830 -- Messages are placed at node N.
831
832 function Expression_Of_Expression_Function
833 (Subp : Entity_Id) return Node_Id;
834 -- Return the expression of expression function Subp
835
836 type Extensions_Visible_Mode is
837 (Extensions_Visible_None,
838 -- Extensions_Visible does not yield a mode when SPARK_Mode is off. This
839 -- value acts as a default in a non-SPARK compilation.
840
841 Extensions_Visible_False,
842 -- A value of "False" signifies that Extensions_Visible is either
843 -- missing or the pragma is present and the value of its Boolean
844 -- expression is False.
845
846 Extensions_Visible_True);
847 -- A value of "True" signifies that Extensions_Visible is present and
848 -- the value of its Boolean expression is True.
849
850 function Extensions_Visible_Status
851 (Id : Entity_Id) return Extensions_Visible_Mode;
852 -- Given the entity of a subprogram or formal parameter subject to pragma
853 -- Extensions_Visible, return the Boolean value denoted by the expression
854 -- of the pragma.
855
856 procedure Find_Actual
857 (N : Node_Id;
858 Formal : out Entity_Id;
859 Call : out Node_Id);
860 -- Determines if the node N is an actual parameter of a function or a
861 -- procedure call. If so, then Formal points to the entity for the formal
862 -- (Ekind is E_In_Parameter, E_Out_Parameter, or E_In_Out_Parameter) and
863 -- Call is set to the node for the corresponding call. If the node N is not
864 -- an actual parameter then Formal and Call are set to Empty.
865
866 function Find_Body_Discriminal
867 (Spec_Discriminant : Entity_Id) return Entity_Id;
868 -- Given a discriminant of the record type that implements a task or
869 -- protected type, return the discriminal of the corresponding discriminant
870 -- of the actual concurrent type.
871
872 function Find_Corresponding_Discriminant
873 (Id : Node_Id;
874 Typ : Entity_Id) return Entity_Id;
875 -- Because discriminants may have different names in a generic unit and in
876 -- an instance, they are resolved positionally when possible. A reference
877 -- to a discriminant carries the discriminant that it denotes when it is
878 -- analyzed. Subsequent uses of this id on a different type denotes the
879 -- discriminant at the same position in this new type.
880
881 function Find_DIC_Type (Typ : Entity_Id) return Entity_Id;
882 -- Subsidiary to all Build_DIC_Procedure_xxx routines. Find the type which
883 -- defines the Default_Initial_Condition pragma of type Typ. This is either
884 -- Typ itself or a parent type when the pragma is inherited.
885
886 function Find_Enclosing_Iterator_Loop (Id : Entity_Id) return Entity_Id;
887 -- Find the nearest iterator loop which encloses arbitrary entity Id. If
888 -- such a loop exists, return the entity of its identifier (E_Loop scope),
889 -- otherwise return Empty.
890
891 function Find_Enclosing_Scope (N : Node_Id) return Entity_Id;
892 -- Find the nearest scope which encloses arbitrary node N
893
894 function Find_Loop_In_Conditional_Block (N : Node_Id) return Node_Id;
895 -- Find the nested loop statement in a conditional block. Loops subject to
896 -- attribute 'Loop_Entry are transformed into blocks. Parts of the original
897 -- loop are nested within the block.
898
899 procedure Find_Overlaid_Entity
900 (N : Node_Id;
901 Ent : out Entity_Id;
902 Off : out Boolean);
903 -- The node N should be an address representation clause. Determines if
904 -- the target expression is the address of an entity with an optional
905 -- offset. If so, set Ent to the entity and, if there is an offset, set
906 -- Off to True, otherwise to False. If N is not an address representation
907 -- clause, or if it is not possible to determine that the address is of
908 -- this form, then set Ent to Empty.
909
910 function Find_Parameter_Type (Param : Node_Id) return Entity_Id;
911 -- Return the type of formal parameter Param as determined by its
912 -- specification.
913
914 -- The following type describes the placement of an arbitrary entity with
915 -- respect to SPARK visible / hidden state space.
916
917 type State_Space_Kind is
918 (Not_In_Package,
919 -- An entity is not in the visible, private or body state space when
920 -- the immediate enclosing construct is not a package.
921
922 Visible_State_Space,
923 -- An entity is in the visible state space when it appears immediately
924 -- within the visible declarations of a package or when it appears in
925 -- the visible state space of a nested package which in turn is declared
926 -- in the visible declarations of an enclosing package:
927
928 -- package Pack is
929 -- Visible_Variable : ...
930 -- package Nested
931 -- with Abstract_State => Visible_State
932 -- is
933 -- Visible_Nested_Variable : ...
934 -- end Nested;
935 -- end Pack;
936
937 -- Entities associated with a package instantiation inherit the state
938 -- space from the instance placement:
939
940 -- generic
941 -- package Gen is
942 -- Generic_Variable : ...
943 -- end Gen;
944
945 -- with Gen;
946 -- package Pack is
947 -- package Inst is new Gen;
948 -- -- Generic_Variable is in the visible state space of Pack
949 -- end Pack;
950
951 Private_State_Space,
952 -- An entity is in the private state space when it appears immediately
953 -- within the private declarations of a package or when it appears in
954 -- the visible state space of a nested package which in turn is declared
955 -- in the private declarations of an enclosing package:
956
957 -- package Pack is
958 -- private
959 -- Private_Variable : ...
960 -- package Nested
961 -- with Abstract_State => Private_State
962 -- is
963 -- Private_Nested_Variable : ...
964 -- end Nested;
965 -- end Pack;
966
967 -- The same placement principle applies to package instantiations
968
969 Body_State_Space);
970 -- An entity is in the body state space when it appears immediately
971 -- within the declarations of a package body or when it appears in the
972 -- visible state space of a nested package which in turn is declared in
973 -- the declarations of an enclosing package body:
974
975 -- package body Pack is
976 -- Body_Variable : ...
977 -- package Nested
978 -- with Abstract_State => Body_State
979 -- is
980 -- Body_Nested_Variable : ...
981 -- end Nested;
982 -- end Pack;
983
984 -- The same placement principle applies to package instantiations
985
986 procedure Find_Placement_In_State_Space
987 (Item_Id : Entity_Id;
988 Placement : out State_Space_Kind;
989 Pack_Id : out Entity_Id);
990 -- Determine the state space placement of an item. Item_Id denotes the
991 -- entity of an abstract state, object, or package instantiation. Placement
992 -- captures the precise placement of the item in the enclosing state space.
993 -- If the state space is that of a package, Pack_Id denotes its entity,
994 -- otherwise Pack_Id is Empty.
995
996 function Find_Primitive_Eq (Typ : Entity_Id) return Entity_Id;
997 -- Locate primitive equality for type if it exists. Return Empty if it is
998 -- not available.
999
1000 function Find_Specific_Type (CW : Entity_Id) return Entity_Id;
1001 -- Find specific type of a class-wide type, and handle the case of an
1002 -- incomplete type coming either from a limited_with clause or from an
1003 -- incomplete type declaration. If resulting type is private return its
1004 -- full view.
1005
1006 function Find_Static_Alternative (N : Node_Id) return Node_Id;
1007 -- N is a case statement whose expression is a compile-time value.
1008 -- Determine the alternative chosen, so that the code of non-selected
1009 -- alternatives, and the warnings that may apply to them, are removed.
1010
1011 function First_Actual (Node : Node_Id) return Node_Id;
1012 -- Node is an N_Function_Call, N_Procedure_Call_Statement or
1013 -- N_Entry_Call_Statement node. The result returned is the first actual
1014 -- parameter in declaration order (not the order of parameters as they
1015 -- appeared in the source, which can be quite different as a result of the
1016 -- use of named parameters). Empty is returned for a call with no
1017 -- parameters. The procedure for iterating through the actuals in
1018 -- declaration order is to use this function to find the first actual, and
1019 -- then use Next_Actual to obtain the next actual in declaration order.
1020 -- Note that the value returned is always the expression (not the
1021 -- N_Parameter_Association nodes, even if named association is used).
1022
1023 -- WARNING: There is a matching C declaration of this subprogram in fe.h
1024
1025 function First_Global
1026 (Subp : Entity_Id;
1027 Global_Mode : Name_Id;
1028 Refined : Boolean := False) return Node_Id;
1029 -- Returns the first global item of mode Global_Mode (which can be
1030 -- Name_Input, Name_Output, Name_In_Out or Name_Proof_In) associated to
1031 -- subprogram Subp, or Empty otherwise. If Refined is True, the global item
1032 -- is retrieved from the Refined_Global aspect/pragma associated to the
1033 -- body of Subp if present. Next_Global can be used to get the next global
1034 -- item with the same mode.
1035
1036 function Fix_Msg (Id : Entity_Id; Msg : String) return String;
1037 -- Replace all occurrences of a particular word in string Msg depending on
1038 -- the Ekind of Id as follows:
1039 -- * Replace "subprogram" with
1040 -- - "entry" when Id is an entry [family]
1041 -- - "task type" when Id is a single task object, task type or task
1042 -- body.
1043 -- * Replace "protected" with
1044 -- - "task" when Id is a single task object, task type or task body
1045 -- All other non-matching words remain as is
1046
1047 function From_Nested_Package (T : Entity_Id) return Boolean;
1048 -- A type declared in a nested package may be frozen by a declaration
1049 -- appearing after the package but before the package is frozen. If the
1050 -- type has aspects that generate subprograms, these may contain references
1051 -- to entities local to the nested package. In that case the package must
1052 -- be installed on the scope stack to prevent spurious visibility errors.
1053
1054 procedure Gather_Components
1055 (Typ : Entity_Id;
1056 Comp_List : Node_Id;
1057 Governed_By : List_Id;
1058 Into : Elist_Id;
1059 Report_Errors : out Boolean;
1060 Allow_Compile_Time : Boolean := False;
1061 Include_Interface_Tag : Boolean := False);
1062 -- The purpose of this procedure is to gather the valid components in a
1063 -- record type according to the values of its discriminants, in order to
1064 -- validate the components of a record aggregate.
1065 --
1066 -- Typ is the type of the aggregate when its constrained discriminants
1067 -- need to be collected, otherwise it is Empty.
1068 --
1069 -- Comp_List is an N_Component_List node.
1070 --
1071 -- Governed_By is a list of N_Component_Association nodes, where each
1072 -- choice list contains the name of a discriminant and the expression
1073 -- field gives its value. The values of the discriminants governing
1074 -- the (possibly nested) variant parts in Comp_List are found in this
1075 -- Component_Association List.
1076 --
1077 -- Into is the list where the valid components are appended. Note that
1078 -- Into need not be an Empty list. If it's not, components are attached
1079 -- to its tail.
1080 --
1081 -- Report_Errors is set to True if the values of the discriminants are
1082 -- non-static.
1083 --
1084 -- Allow_Compile_Time if set to True, allows compile time known values in
1085 -- Governed_By expressions in addition to static expressions.
1086 --
1087 -- Include_Interface_Tag if set to True, gather any interface tag
1088 -- component, otherwise exclude them.
1089 --
1090 -- This procedure is also used when building a record subtype. If the
1091 -- discriminant constraint of the subtype is static, the components of the
1092 -- subtype are only those of the variants selected by the values of the
1093 -- discriminants. Otherwise all components of the parent must be included
1094 -- in the subtype for semantic analysis.
1095
1096 function Get_Dynamic_Accessibility (E : Entity_Id) return Entity_Id;
1097 -- Obtain the accessibility level for a given entity formal taking into
1098 -- account both extra and minimum accessibility.
1099
1100 function Get_Actual_Subtype (N : Node_Id) return Entity_Id;
1101 -- Given a node for an expression, obtain the actual subtype of the
1102 -- expression. In the case of a parameter where the formal is an
1103 -- unconstrained array or discriminated type, this will be the previously
1104 -- constructed subtype of the actual. Note that this is not quite the
1105 -- "Actual Subtype" of the RM, since it is always a constrained type, i.e.
1106 -- it is the subtype of the value of the actual. The actual subtype is also
1107 -- returned in other cases where it has already been constructed for an
1108 -- object. Otherwise the expression type is returned unchanged, except for
1109 -- the case of an unconstrained array type, where an actual subtype is
1110 -- created, using Insert_Actions if necessary to insert any associated
1111 -- actions.
1112
1113 function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id;
1114 -- This is like Get_Actual_Subtype, except that it never constructs an
1115 -- actual subtype. If an actual subtype is already available, i.e. the
1116 -- Actual_Subtype field of the corresponding entity is set, then it is
1117 -- returned. Otherwise the Etype of the node is returned.
1118
1119 function Get_Body_From_Stub (N : Node_Id) return Node_Id;
1120 -- Return the body node for a stub
1121
1122 function Get_Cursor_Type
1123 (Aspect : Node_Id;
1124 Typ : Entity_Id) return Entity_Id;
1125 -- Find Cursor type in scope of type Typ with Iterable aspect, by locating
1126 -- primitive operation First. For use in resolving the other primitive
1127 -- operations of an Iterable type and expanding loops and quantified
1128 -- expressions over formal containers.
1129
1130 function Get_Cursor_Type (Typ : Entity_Id) return Entity_Id;
1131 -- Find Cursor type in scope of type Typ with Iterable aspect, by locating
1132 -- primitive operation First. For use after resolving the primitive
1133 -- operations of an Iterable type.
1134
1135 function Get_Default_External_Name (E : Node_Or_Entity_Id) return Node_Id;
1136 -- This is used to construct the string literal node representing a
1137 -- default external name, i.e. one that is constructed from the name of an
1138 -- entity, or (in the case of extended DEC import/export pragmas) an
1139 -- identifier provided as the external name. Letters in the name are
1140 -- according to the setting of Opt.External_Name_Default_Casing.
1141
1142 function Get_Enclosing_Object (N : Node_Id) return Entity_Id;
1143 -- If expression N references a part of an object, return this object.
1144 -- Otherwise return Empty. Expression N should have been resolved already.
1145
1146 function Get_Generic_Entity (N : Node_Id) return Entity_Id;
1147 -- Returns the true generic entity in an instantiation. If the name in the
1148 -- instantiation is a renaming, the function returns the renamed generic.
1149
1150 function Get_Incomplete_View_Of_Ancestor (E : Entity_Id) return Entity_Id;
1151 -- Implements the notion introduced ever-so briefly in RM 7.3.1 (5.2/3):
1152 -- in a child unit a derived type is within the derivation class of an
1153 -- ancestor declared in a parent unit, even if there is an intermediate
1154 -- derivation that does not see the full view of that ancestor.
1155
1156 procedure Get_Index_Bounds
1157 (N : Node_Id;
1158 L : out Node_Id;
1159 H : out Node_Id;
1160 Use_Full_View : Boolean := False);
1161 -- This procedure assigns to L and H respectively the values of the low and
1162 -- high bounds of node N, which must be a range, subtype indication, or the
1163 -- name of a scalar subtype. The result in L, H may be set to Error if
1164 -- there was an earlier error in the range.
1165 -- Use_Full_View is intended for use by clients other than the compiler
1166 -- (specifically, gnat2scil) to indicate that we want the full view if
1167 -- the index type turns out to be a partial view; this case should not
1168 -- arise during normal compilation of semantically correct programs.
1169
1170 procedure Get_Interfacing_Aspects
1171 (Iface_Asp : Node_Id;
1172 Conv_Asp : out Node_Id;
1173 EN_Asp : out Node_Id;
1174 Expo_Asp : out Node_Id;
1175 Imp_Asp : out Node_Id;
1176 LN_Asp : out Node_Id;
1177 Do_Checks : Boolean := False);
1178 -- Given a single interfacing aspect Iface_Asp, retrieve other interfacing
1179 -- aspects that apply to the same related entity. The aspects considered by
1180 -- this routine are as follows:
1181 --
1182 -- Conv_Asp - aspect Convention
1183 -- EN_Asp - aspect External_Name
1184 -- Expo_Asp - aspect Export
1185 -- Imp_Asp - aspect Import
1186 -- LN_Asp - aspect Link_Name
1187 --
1188 -- When flag Do_Checks is set, this routine will flag duplicate uses of
1189 -- aspects.
1190
1191 function Get_Enum_Lit_From_Pos
1192 (T : Entity_Id;
1193 Pos : Uint;
1194 Loc : Source_Ptr) return Node_Id;
1195 -- This function returns an identifier denoting the E_Enumeration_Literal
1196 -- entity for the specified value from the enumeration type or subtype T.
1197 -- The second argument is the Pos value. Constraint_Error is raised if
1198 -- argument Pos is not in range. The third argument supplies a source
1199 -- location for constructed nodes returned by this function. If No_Location
1200 -- is supplied as source location, the location of the returned node is
1201 -- copied from the original source location for the enumeration literal,
1202 -- when available.
1203
1204 function Get_Iterable_Type_Primitive
1205 (Typ : Entity_Id;
1206 Nam : Name_Id) return Entity_Id;
1207 -- Retrieve one of the primitives First, Last, Next, Previous, Has_Element,
1208 -- Element from the value of the Iterable aspect of a type.
1209
1210 procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id);
1211 -- Retrieve the fully expanded name of the library unit declared by
1212 -- Decl_Node into the name buffer.
1213
1214 function Get_Max_Queue_Length (Id : Entity_Id) return Uint;
1215 -- Return the argument of pragma Max_Queue_Length or zero if the annotation
1216 -- is not present. It is assumed that Id denotes an entry.
1217
1218 function Get_Name_Entity_Id (Id : Name_Id) return Entity_Id;
1219 pragma Inline (Get_Name_Entity_Id);
1220 -- An entity value is associated with each name in the name table. The
1221 -- Get_Name_Entity_Id function fetches the Entity_Id of this entity, which
1222 -- is the innermost visible entity with the given name. See the body of
1223 -- Sem_Ch8 for further details on handling of entity visibility.
1224
1225 function Get_Name_From_CTC_Pragma (N : Node_Id) return String_Id;
1226 -- Return the Name component of Test_Case pragma N
1227 -- Bad name now that this no longer applies to Contract_Case ???
1228
1229 function Get_Parent_Entity (Unit : Node_Id) return Entity_Id;
1230 -- Get defining entity of parent unit of a child unit. In most cases this
1231 -- is the defining entity of the unit, but for a child instance whose
1232 -- parent needs a body for inlining, the instantiation node of the parent
1233 -- has not yet been rewritten as a package declaration, and the entity has
1234 -- to be retrieved from the Instance_Spec of the unit.
1235
1236 function Get_Pragma_Id (N : Node_Id) return Pragma_Id;
1237 pragma Inline (Get_Pragma_Id);
1238 -- Obtains the Pragma_Id from Pragma_Name_Unmapped (N)
1239
1240 function Get_Qualified_Name
1241 (Id : Entity_Id;
1242 Suffix : Entity_Id := Empty) return Name_Id;
1243 -- Obtain the fully qualified form of entity Id. The format is:
1244 -- scope_of_id-1__scope_of_id__chars_of_id__chars_of_suffix
1245
1246 function Get_Qualified_Name
1247 (Nam : Name_Id;
1248 Suffix : Name_Id := No_Name;
1249 Scop : Entity_Id := Current_Scope) return Name_Id;
1250 -- Obtain the fully qualified form of name Nam assuming it appears in scope
1251 -- Scop. The format is:
1252 -- scop-1__scop__nam__suffix
1253
1254 procedure Get_Reason_String (N : Node_Id);
1255 -- Recursive routine to analyze reason argument for pragma Warnings. The
1256 -- value of the reason argument is appended to the current string using
1257 -- Store_String_Chars. The reason argument is expected to be a string
1258 -- literal or concatenation of string literals. An error is given for
1259 -- any other form.
1260
1261 function Get_Reference_Discriminant (Typ : Entity_Id) return Entity_Id;
1262 -- If Typ has Implicit_Dereference, return discriminant specified in the
1263 -- corresponding aspect.
1264
1265 function Get_Referenced_Object (N : Node_Id) return Node_Id;
1266 -- Given an arbitrary node, return the renamed object if the node
1267 -- represents a renamed object; otherwise return the node unchanged.
1268 -- The node can represent an arbitrary expression or any other kind of
1269 -- node (such as the name of a type).
1270
1271 function Get_Renamed_Entity (E : Entity_Id) return Entity_Id;
1272 -- Given an entity for an exception, package, subprogram or generic unit,
1273 -- returns the ultimately renamed entity if this is a renaming. If this is
1274 -- not a renamed entity, returns its argument. It is an error to call this
1275 -- with any other kind of entity.
1276
1277 function Get_Return_Object (N : Node_Id) return Entity_Id;
1278 -- Given an extended return statement, return the corresponding return
1279 -- object, identified as the one for which Is_Return_Object = True.
1280
1281 function Get_Subprogram_Entity (Nod : Node_Id) return Entity_Id;
1282 -- Nod is either a procedure call statement, or a function call, or an
1283 -- accept statement node. This procedure finds the Entity_Id of the related
1284 -- subprogram or entry and returns it, or if no subprogram can be found,
1285 -- returns Empty.
1286
1287 function Get_Task_Body_Procedure (E : Entity_Id) return Entity_Id;
1288 -- Given an entity for a task type or subtype, retrieves the
1289 -- Task_Body_Procedure field from the corresponding task type declaration.
1290
1291 function Get_User_Defined_Eq (E : Entity_Id) return Entity_Id;
1292 -- For a type entity, return the entity of the primitive equality function
1293 -- for the type if it exists, otherwise return Empty.
1294
1295 procedure Get_Views
1296 (Typ : Entity_Id;
1297 Priv_Typ : out Entity_Id;
1298 Full_Typ : out Entity_Id;
1299 UFull_Typ : out Entity_Id;
1300 CRec_Typ : out Entity_Id);
1301 -- Obtain the partial and full views of type Typ and in addition any extra
1302 -- types the full views may have. The return entities are as follows:
1303 --
1304 -- Priv_Typ - the partial view (a private type)
1305 -- Full_Typ - the full view
1306 -- UFull_Typ - the underlying full view, if the full view is private
1307 -- CRec_Typ - the corresponding record type of the full views
1308
1309 function Get_Fullest_View
1310 (E : Entity_Id; Include_PAT : Boolean := True) return Entity_Id;
1311 -- Get the fullest possible view of E, looking through private,
1312 -- limited, packed array and other implementation types. If Include_PAT
1313 -- is False, don't look inside packed array types.
1314
1315 function Has_Access_Values (T : Entity_Id) return Boolean;
1316 -- Returns true if type or subtype T is an access type, or has a component
1317 -- (at any recursive level) that is an access type. This is a conservative
1318 -- predicate, if it is not known whether or not T contains access values
1319 -- (happens for generic formals in some cases), then False is returned.
1320 -- Note that tagged types return False. Even though the tag is implemented
1321 -- as an access type internally, this function tests only for access types
1322 -- known to the programmer. See also Has_Tagged_Component.
1323
1324 function Has_Anonymous_Access_Discriminant (Typ : Entity_Id) return Boolean;
1325 -- Returns True if Typ has one or more anonymous access discriminants
1326
1327 type Alignment_Result is (Known_Compatible, Unknown, Known_Incompatible);
1328 -- Result of Has_Compatible_Alignment test, description found below. Note
1329 -- that the values are arranged in increasing order of problematicness.
1330
1331 function Has_Compatible_Alignment
1332 (Obj : Entity_Id;
1333 Expr : Node_Id;
1334 Layout_Done : Boolean) return Alignment_Result;
1335 -- Obj is an object entity, and expr is a node for an object reference. If
1336 -- the alignment of the object referenced by Expr is known to be compatible
1337 -- with the alignment of Obj (i.e. is larger or the same), then the result
1338 -- is Known_Compatible. If the alignment of the object referenced by Expr
1339 -- is known to be less than the alignment of Obj, then Known_Incompatible
1340 -- is returned. If neither condition can be reliably established at compile
1341 -- time, then Unknown is returned. If Layout_Done is True, the function can
1342 -- assume that the information on size and alignment of types and objects
1343 -- is present in the tree. This is used to determine if alignment checks
1344 -- are required for address clauses (Layout_Done is False in this case) as
1345 -- well as to issue appropriate warnings for them in the post compilation
1346 -- phase (Layout_Done is True in this case).
1347 --
1348 -- Note: Known_Incompatible does not mean that at run time the alignment
1349 -- of Expr is known to be wrong for Obj, just that it can be determined
1350 -- that alignments have been explicitly or implicitly specified which are
1351 -- incompatible (whereas Unknown means that even this is not known). The
1352 -- appropriate reaction of a caller to Known_Incompatible is to treat it as
1353 -- Unknown, but issue a warning that there may be an alignment error.
1354
1355 function Has_Declarations (N : Node_Id) return Boolean;
1356 -- Determines if the node can have declarations
1357
1358 function Has_Defaulted_Discriminants (Typ : Entity_Id) return Boolean;
1359 -- Simple predicate to test for defaulted discriminants
1360
1361 function Has_Denormals (E : Entity_Id) return Boolean;
1362 -- Determines if the floating-point type E supports denormal numbers.
1363 -- Returns False if E is not a floating-point type.
1364
1365 function Has_Discriminant_Dependent_Constraint
1366 (Comp : Entity_Id) return Boolean;
1367 -- Returns True if and only if Comp has a constrained subtype that depends
1368 -- on a discriminant.
1369
1370 function Has_Effectively_Volatile_Profile
1371 (Subp_Id : Entity_Id) return Boolean;
1372 -- Determine whether subprogram Subp_Id has an effectively volatile formal
1373 -- parameter for reading or returns an effectively volatile value for
1374 -- reading.
1375
1376 function Has_Full_Default_Initialization (Typ : Entity_Id) return Boolean;
1377 -- Determine whether type Typ defines "full default initialization" as
1378 -- specified by SPARK RM 3.1. To qualify as such, the type must be
1379 -- * A scalar type with specified Default_Value
1380 -- * An array-of-scalar type with specified Default_Component_Value
1381 -- * An array type whose element type defines full default initialization
1382 -- * A protected type, record type or type extension whose components
1383 -- either include a default expression or have a type which defines
1384 -- full default initialization. In the case of type extensions, the
1385 -- parent type defines full default initialization.
1386 -- * A task type
1387 -- * A private type with pragma Default_Initial_Condition that provides
1388 -- full default initialization.
1389 -- This function is not used in GNATprove anymore, but is used in CodePeer.
1390
1391 function Has_Fully_Default_Initializing_DIC_Pragma
1392 (Typ : Entity_Id) return Boolean;
1393 -- Determine whether type Typ has a suitable Default_Initial_Condition
1394 -- pragma which provides the full default initialization of the type.
1395
1396 function Has_Inferable_Discriminants (N : Node_Id) return Boolean;
1397 -- Ada 2005 (AI-216): A view of an Unchecked_Union object has inferable
1398 -- discriminants if it has a constrained nominal type, unless the object
1399 -- is a component of an enclosing Unchecked_Union object that is subject
1400 -- to a per-object constraint and the enclosing object lacks inferable
1401 -- discriminants.
1402 --
1403 -- An expression of an Unchecked_Union type has inferable discriminants
1404 -- if it is either a name of an object with inferable discriminants or a
1405 -- qualified expression whose subtype mark denotes a constrained subtype.
1406
1407 function Has_Infinities (E : Entity_Id) return Boolean;
1408 -- Determines if the range of the floating-point type E includes
1409 -- infinities. Returns False if E is not a floating-point type.
1410
1411 function Has_Interfaces
1412 (T : Entity_Id;
1413 Use_Full_View : Boolean := True) return Boolean;
1414 -- Where T is a concurrent type or a record type, returns true if T covers
1415 -- any abstract interface types. In case of private types the argument
1416 -- Use_Full_View controls if the check is done using its full view (if
1417 -- available).
1418
1419 function Has_Max_Queue_Length (Id : Entity_Id) return Boolean;
1420 -- Determine whether Id is subject to pragma Max_Queue_Length. It is
1421 -- assumed that Id denotes an entry.
1422
1423 function Has_No_Obvious_Side_Effects (N : Node_Id) return Boolean;
1424 -- This is a simple minded function for determining whether an expression
1425 -- has no obvious side effects. It is used only for determining whether
1426 -- warnings are needed in certain situations, and is not guaranteed to
1427 -- be accurate in either direction. Exceptions may mean an expression
1428 -- does in fact have side effects, but this may be ignored and True is
1429 -- returned, or a complex expression may in fact be side effect free
1430 -- but we don't recognize it here and return False. The Side_Effect_Free
1431 -- routine in Remove_Side_Effects is much more extensive and perhaps could
1432 -- be shared, so that this routine would be more accurate.
1433
1434 function Has_Non_Null_Refinement (Id : Entity_Id) return Boolean;
1435 -- Determine whether abstract state Id has at least one nonnull constituent
1436 -- as expressed in pragma Refined_State. This function does not take into
1437 -- account the visible refinement region of abstract state Id.
1438
1439 function Has_Non_Trivial_Precondition (Subp : Entity_Id) return Boolean;
1440 -- Determine whether subprogram Subp has a class-wide precondition that is
1441 -- not statically True.
1442
1443 function Has_Null_Body (Proc_Id : Entity_Id) return Boolean;
1444 -- Determine whether the body of procedure Proc_Id contains a sole null
1445 -- statement, possibly followed by an optional return. Used to optimize
1446 -- useless calls to assertion checks.
1447
1448 function Has_Null_Exclusion (N : Node_Id) return Boolean;
1449 -- Determine whether node N has a null exclusion
1450
1451 function Has_Null_Refinement (Id : Entity_Id) return Boolean;
1452 -- Determine whether abstract state Id has a null refinement as expressed
1453 -- in pragma Refined_State. This function does not take into account the
1454 -- visible refinement region of abstract state Id.
1455
1456 function Has_Non_Null_Statements (L : List_Id) return Boolean;
1457 -- Return True if L has non-null statements
1458
1459 function Side_Effect_Free_Statements (L : List_Id) return Boolean;
1460 -- Return True if L has no statements with side effects
1461
1462 function Side_Effect_Free_Loop (N : Node_Id) return Boolean;
1463 -- Return True if the loop has no side effect and can therefore be
1464 -- marked for removal. Return False if N is not a N_Loop_Statement.
1465
1466 subtype Static_Accessibility_Level_Kind
1467 is Accessibility_Level_Kind range Object_Decl_Level
1468 .. Zero_On_Dynamic_Level;
1469 -- Restrict the reange of Accessibility_Level_Kind to be non-dynamic for
1470 -- use in the static version of Accessibility_Level below.
1471
1472 function Static_Accessibility_Level
1473 (Expr : Node_Id;
1474 Level : Static_Accessibility_Level_Kind;
1475 In_Return_Context : Boolean := False) return Uint;
1476 -- Overloaded version of Accessibility_Level which returns a universal
1477 -- integer for use in compile-time checking. Note: Level is restricted to
1478 -- be non-dynamic.
1479
1480 function Has_Overriding_Initialize (T : Entity_Id) return Boolean;
1481 -- Predicate to determine whether a controlled type has a user-defined
1482 -- Initialize primitive (and, in Ada 2012, whether that primitive is
1483 -- non-null), which causes the type to not have preelaborable
1484 -- initialization.
1485
1486 function Has_Preelaborable_Initialization (E : Entity_Id) return Boolean;
1487 -- Return True iff type E has preelaborable initialization as defined in
1488 -- Ada 2005 (see AI-161 for details of the definition of this attribute).
1489
1490 function Has_Prefix (N : Node_Id) return Boolean;
1491 -- Return True if N has attribute Prefix
1492
1493 function Has_Private_Component (Type_Id : Entity_Id) return Boolean;
1494 -- Check if a type has a (sub)component of a private type that has not
1495 -- yet received a full declaration.
1496
1497 function Has_Relaxed_Initialization (E : Entity_Id) return Boolean;
1498 -- Returns True iff entity E is subject to the Relaxed_Initialization
1499 -- aspect. Entity E can be either type, variable, constant, subprogram,
1500 -- entry or an abstract state. For private types and deferred constants
1501 -- E should be the private view, because aspect can only be attached there.
1502
1503 function Has_Signed_Zeros (E : Entity_Id) return Boolean;
1504 -- Determines if the floating-point type E supports signed zeros.
1505 -- Returns False if E is not a floating-point type.
1506
1507 function Has_Significant_Contract (Subp_Id : Entity_Id) return Boolean;
1508 -- Determine whether subprogram [body] Subp_Id has a significant contract.
1509 -- All subprograms have a N_Contract node, but this does not mean that the
1510 -- contract is useful.
1511
1512 function Has_Static_Array_Bounds (Typ : Node_Id) return Boolean;
1513 -- Return whether an array type has static bounds
1514
1515 function Has_Static_Non_Empty_Array_Bounds (Typ : Node_Id) return Boolean;
1516 -- Determine whether array type Typ has static non-empty bounds
1517
1518 function Has_Stream (T : Entity_Id) return Boolean;
1519 -- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or in the
1520 -- case of a composite type, has a component for which this predicate is
1521 -- True, and if so returns True. Otherwise a result of False means that
1522 -- there is no Stream type in sight. For a private type, the test is
1523 -- applied to the underlying type (or returns False if there is no
1524 -- underlying type).
1525
1526 function Has_Suffix (E : Entity_Id; Suffix : Character) return Boolean;
1527 -- Returns true if the last character of E is Suffix. Used in Assertions.
1528
1529 function Has_Tagged_Component (Typ : Entity_Id) return Boolean;
1530 -- Returns True if Typ is a composite type (array or record) that is either
1531 -- a tagged type or has a subcomponent that is tagged. Returns False for a
1532 -- noncomposite type, or if no tagged subcomponents are present.
1533
1534 function Has_Unconstrained_Access_Discriminants
1535 (Subtyp : Entity_Id) return Boolean;
1536 -- Returns True if the given subtype is unconstrained and has one or more
1537 -- access discriminants.
1538
1539 function Has_Undefined_Reference (Expr : Node_Id) return Boolean;
1540 -- Given arbitrary expression Expr, determine whether it contains at
1541 -- least one name whose entity is Any_Id.
1542
1543 function Has_Volatile_Component (Typ : Entity_Id) return Boolean;
1544 -- Given arbitrary type Typ, determine whether it contains at least one
1545 -- volatile component.
1546
1547 function Implementation_Kind (Subp : Entity_Id) return Name_Id;
1548 -- Subp is a subprogram marked with pragma Implemented. Return the specific
1549 -- implementation requirement which the pragma imposes. The return value is
1550 -- either Name_By_Any, Name_By_Entry or Name_By_Protected_Procedure.
1551
1552 function Implements_Interface
1553 (Typ_Ent : Entity_Id;
1554 Iface_Ent : Entity_Id;
1555 Exclude_Parents : Boolean := False) return Boolean;
1556 -- Returns true if the Typ_Ent implements interface Iface_Ent
1557
1558 function Implicitly_Designated_Type (Typ : Entity_Id) return Entity_Id;
1559 -- Called when Typ is the type of the prefix of an implicit dereference.
1560 -- Return the designated type of Typ, taking into account that this type
1561 -- may be a limited view, when the nonlimited view is visible.
1562
1563 function In_Assertion_Expression_Pragma (N : Node_Id) return Boolean;
1564 -- Returns True if node N appears within a pragma that acts as an assertion
1565 -- expression. See Sem_Prag for the list of qualifying pragmas.
1566
1567 function In_Check_Node (N : Node_Id) return Boolean;
1568 -- Return True if N is part of a N_Raise_xxx_Error node
1569
1570 function In_Generic_Formal_Package (E : Entity_Id) return Boolean;
1571 -- Returns True if entity E is inside a generic formal package
1572
1573 function In_Generic_Scope (E : Entity_Id) return Boolean;
1574 -- Returns True if entity E is inside a generic scope
1575
1576 function In_Instance return Boolean;
1577 -- Returns True if the current scope is within a generic instance
1578
1579 function In_Instance_Body return Boolean;
1580 -- Returns True if current scope is within the body of an instance, where
1581 -- several semantic checks (e.g. accessibility checks) are relaxed.
1582
1583 function In_Instance_Not_Visible return Boolean;
1584 -- Returns True if current scope is with the private part or the body of
1585 -- an instance. Other semantic checks are suppressed in this context.
1586
1587 function In_Instance_Visible_Part
1588 (Id : Entity_Id := Current_Scope) return Boolean;
1589 -- Returns True if arbitrary entity Id is within the visible part of a
1590 -- package instance, where several additional semantic checks apply.
1591
1592 function In_Package_Body return Boolean;
1593 -- Returns True if current scope is within a package body
1594
1595 function In_Pragma_Expression (N : Node_Id; Nam : Name_Id) return Boolean;
1596 -- Returns true if the expression N occurs within a pragma with name Nam
1597
1598 function In_Pre_Post_Condition (N : Node_Id) return Boolean;
1599 -- Returns True if node N appears within a pre/postcondition pragma. Note
1600 -- the pragma Check equivalents are NOT considered.
1601
1602 function In_Quantified_Expression (N : Node_Id) return Boolean;
1603 -- Returns true if the expression N occurs within a quantified expression
1604
1605 function In_Return_Value (Expr : Node_Id) return Boolean;
1606 -- Returns true if the expression Expr occurs within a simple return
1607 -- statement or is part of an assignment to the return object in an
1608 -- extended return statement.
1609
1610 function In_Reverse_Storage_Order_Object (N : Node_Id) return Boolean;
1611 -- Returns True if N denotes a component or subcomponent in a record or
1612 -- array that has Reverse_Storage_Order.
1613
1614 function In_Same_Declarative_Part
1615 (Context : Node_Id;
1616 N : Node_Id) return Boolean;
1617 -- True if the node N appears within the same declarative part denoted by
1618 -- the node Context.
1619
1620 function In_Subprogram_Or_Concurrent_Unit return Boolean;
1621 -- Determines if the current scope is within a subprogram compilation unit
1622 -- (inside a subprogram declaration, subprogram body, or generic subprogram
1623 -- declaration) or within a task or protected body. The test is for
1624 -- appearing anywhere within such a construct (that is it does not need
1625 -- to be directly within).
1626
1627 function In_Subtree (N : Node_Id; Root : Node_Id) return Boolean;
1628 -- Determine whether node N is within the subtree rooted at Root
1629
1630 function In_Subtree
1631 (N : Node_Id;
1632 Root1 : Node_Id;
1633 Root2 : Node_Id) return Boolean;
1634 -- Determine whether node N is within the subtree rooted at Root1 or Root2.
1635 -- This version is more efficient than calling the single root version of
1636 -- Is_Subtree twice.
1637
1638 function In_Visible_Part (Scope_Id : Entity_Id) return Boolean;
1639 -- Determine whether a declaration occurs within the visible part of a
1640 -- package specification. The package must be on the scope stack, and the
1641 -- corresponding private part must not.
1642
1643 function In_While_Loop_Condition (N : Node_Id) return Boolean;
1644 -- Returns true if the expression N occurs within the condition of a while
1645
1646 function Incomplete_Or_Partial_View (Id : Entity_Id) return Entity_Id;
1647 -- Given the entity of a constant or a type, retrieve the incomplete or
1648 -- partial view of the same entity. Note that Id may not have a partial
1649 -- view in which case the function returns Empty.
1650
1651 function Incomplete_View_From_Limited_With
1652 (Typ : Entity_Id) return Entity_Id;
1653 -- Typ is a type entity. This normally returns Typ. However, if there is
1654 -- an incomplete view of this entity that comes from a limited-with'ed
1655 -- package, then this returns that incomplete view.
1656
1657 function Indexed_Component_Bit_Offset (N : Node_Id) return Uint;
1658 -- Given an N_Indexed_Component node, return the first bit position of the
1659 -- component if it is known at compile time. A value of No_Uint means that
1660 -- either the value is not yet known before back-end processing or it is
1661 -- not known at compile time after back-end processing.
1662
1663 procedure Inherit_Predicate_Flags (Subt, Par : Entity_Id);
1664 -- Propagate static and dynamic predicate flags from a parent to the
1665 -- subtype in a subtype declaration with and without constraints.
1666
1667 procedure Inherit_Rep_Item_Chain (Typ : Entity_Id; From_Typ : Entity_Id);
1668 -- Inherit the rep item chain of type From_Typ without clobbering any
1669 -- existing rep items on Typ's chain. Typ is the destination type.
1670
1671 function Inherits_From_Tagged_Full_View (Typ : Entity_Id) return Boolean;
1672 pragma Inline (Inherits_From_Tagged_Full_View);
1673 -- Return True if Typ is an untagged private type completed with a
1674 -- derivation of an untagged private type declaration whose full view
1675 -- is a tagged type.
1676
1677 procedure Insert_Explicit_Dereference (N : Node_Id);
1678 -- In a context that requires a composite or subprogram type and where a
1679 -- prefix is an access type, rewrite the access type node N (which is the
1680 -- prefix, e.g. of an indexed component) as an explicit dereference.
1681
1682 procedure Inspect_Deferred_Constant_Completion (Decls : List_Id);
1683 -- Examine all deferred constants in the declaration list Decls and check
1684 -- whether they have been completed by a full constant declaration or an
1685 -- Import pragma. Emit the error message if that is not the case.
1686
1687 procedure Install_Elaboration_Model (Unit_Id : Entity_Id);
1688 -- Install the elaboration model specified by pragma Elaboration_Checks
1689 -- associated with compilation unit Unit_Id. No action is taken when the
1690 -- unit lacks such pragma.
1691
1692 procedure Install_Generic_Formals (Subp_Id : Entity_Id);
1693 -- Install both the generic formal parameters and the formal parameters of
1694 -- generic subprogram Subp_Id into visibility.
1695
1696 procedure Install_SPARK_Mode (Mode : SPARK_Mode_Type; Prag : Node_Id);
1697 -- Establish the SPARK_Mode and SPARK_Mode_Pragma currently in effect
1698
1699 function Invalid_Scalar_Value
1700 (Loc : Source_Ptr;
1701 Scal_Typ : Scalar_Id) return Node_Id;
1702 -- Obtain the invalid value for scalar type Scal_Typ as either specified by
1703 -- pragma Initialize_Scalars or by the binder. Return an expression created
1704 -- at source location Loc, which denotes the invalid value.
1705
1706 function Is_Anonymous_Access_Actual (N : Node_Id) return Boolean;
1707 -- Determine if N is used as an actual for a call whose corresponding
1708 -- formal is of an anonymous access type.
1709
1710 function Is_Access_Subprogram_Wrapper (E : Entity_Id) return Boolean;
1711 -- True if E is the constructed wrapper for an access_to_subprogram
1712 -- type with Pre/Postconditions.
1713
1714 function Is_Access_Variable (E : Entity_Id) return Boolean;
1715 -- Determines if type E is an access-to-variable
1716
1717 function Is_Actual_In_Out_Parameter (N : Node_Id) return Boolean;
1718 -- Determines if N is an actual parameter of in-out mode in a subprogram
1719 -- call.
1720
1721 function Is_Actual_Out_Parameter (N : Node_Id) return Boolean;
1722 -- Determines if N is an actual parameter of out mode in a subprogram call
1723
1724 function Is_Actual_Out_Or_In_Out_Parameter (N : Node_Id) return Boolean;
1725 -- Determines if N is an actual parameter of out or in out mode in a
1726 -- subprogram call.
1727
1728 function Is_Actual_Parameter (N : Node_Id) return Boolean;
1729 -- Determines if N is an actual parameter in a subprogram call
1730
1731 function Is_Actual_Tagged_Parameter (N : Node_Id) return Boolean;
1732 -- Determines if N is an actual parameter of a formal of tagged type in a
1733 -- subprogram call.
1734
1735 function Is_Aliased_View (Obj : Node_Id) return Boolean;
1736 -- Determine if Obj is an aliased view, i.e. the name of an object to which
1737 -- 'Access or 'Unchecked_Access can apply. Note that this routine uses the
1738 -- rules of the language, it does not take into account the restriction
1739 -- No_Implicit_Aliasing, so it can return True if the restriction is active
1740 -- and Obj violates the restriction. The caller is responsible for calling
1741 -- Restrict.Check_No_Implicit_Aliasing if True is returned, but there is a
1742 -- requirement for obeying the restriction in the call context.
1743
1744 function Is_Ancestor_Package
1745 (E1 : Entity_Id;
1746 E2 : Entity_Id) return Boolean;
1747 -- Determine whether package E1 is an ancestor of E2
1748
1749 function Is_Atomic_Object (N : Node_Id) return Boolean;
1750 -- Determine whether arbitrary node N denotes a reference to an atomic
1751 -- object as per RM C.6(7) and the crucial remark in RM C.6(8).
1752
1753 function Is_Attribute_Loop_Entry (N : Node_Id) return Boolean;
1754 -- Determine whether node N denotes attribute 'Loop_Entry
1755
1756 function Is_Attribute_Old (N : Node_Id) return Boolean;
1757 -- Determine whether node N denotes attribute 'Old
1758
1759 function Is_Attribute_Result (N : Node_Id) return Boolean;
1760 -- Determine whether node N denotes attribute 'Result
1761
1762 function Is_Attribute_Update (N : Node_Id) return Boolean;
1763 -- Determine whether node N denotes attribute 'Update
1764
1765 function Is_Body_Or_Package_Declaration (N : Node_Id) return Boolean;
1766 -- Determine whether node N denotes a body or a package declaration
1767
1768 function Is_Bounded_String (T : Entity_Id) return Boolean;
1769 -- True if T is a bounded string type. Used to make sure "=" composes
1770 -- properly for bounded string types.
1771
1772 function Is_By_Protected_Procedure (Id : Entity_Id) return Boolean;
1773 -- Determine whether entity Id denotes a procedure with synchronization
1774 -- kind By_Protected_Procedure.
1775
1776 function Is_Confirming (Aspect : Nonoverridable_Aspect_Id;
1777 Aspect_Spec_1, Aspect_Spec_2 : Node_Id)
1778 return Boolean;
1779 -- Returns true if the two specifications of the given
1780 -- nonoverridable aspect are compatible.
1781
1782 function Is_Constant_Bound (Exp : Node_Id) return Boolean;
1783 -- Exp is the expression for an array bound. Determines whether the
1784 -- bound is a compile-time known value, or a constant entity, or an
1785 -- enumeration literal, or an expression composed of constant-bound
1786 -- subexpressions which are evaluated by means of standard operators.
1787
1788 function Is_Container_Element (Exp : Node_Id) return Boolean;
1789 -- This routine recognizes expressions that denote an element of one of
1790 -- the predefined containers, when the source only contains an indexing
1791 -- operation and an implicit dereference is inserted by the compiler.
1792 -- In the absence of this optimization, the indexing creates a temporary
1793 -- controlled cursor that sets the tampering bit of the container, and
1794 -- restricts the use of the convenient notation C (X) to contexts that
1795 -- do not check the tampering bit (e.g. C.Include (X, C (Y)). Exp is an
1796 -- explicit dereference. The transformation applies when it has the form
1797 -- F (X).Discr.all.
1798
1799 function Is_Contract_Annotation (Item : Node_Id) return Boolean;
1800 -- Determine whether aspect specification or pragma Item is a contract
1801 -- annotation.
1802
1803 function Is_Controlling_Limited_Procedure
1804 (Proc_Nam : Entity_Id) return Boolean;
1805 -- Ada 2005 (AI-345): Determine whether Proc_Nam is a primitive procedure
1806 -- of a limited interface with a controlling first parameter.
1807
1808 function Is_CPP_Constructor_Call (N : Node_Id) return Boolean;
1809 -- Returns True if N is a call to a CPP constructor
1810
1811 function Is_CCT_Instance
1812 (Ref_Id : Entity_Id;
1813 Context_Id : Entity_Id) return Boolean;
1814 -- Subsidiary to the analysis of pragmas [Refined_]Depends and [Refined_]
1815 -- Global; also used when analyzing default expressions of protected and
1816 -- record components. Determine whether entity Ref_Id (which must represent
1817 -- either a protected type or a task type) denotes the current instance of
1818 -- a concurrent type. Context_Id denotes the associated context where the
1819 -- pragma appears.
1820
1821 function Is_Child_Or_Sibling
1822 (Pack_1 : Entity_Id;
1823 Pack_2 : Entity_Id) return Boolean;
1824 -- Determine the following relations between two arbitrary packages:
1825 -- 1) One package is the parent of a child package
1826 -- 2) Both packages are siblings and share a common parent
1827
1828 function Is_Concurrent_Interface (T : Entity_Id) return Boolean;
1829 -- First determine whether type T is an interface and then check whether
1830 -- it is of protected, synchronized or task kind.
1831
1832 function Is_Current_Instance (N : Node_Id) return Boolean;
1833 -- Predicate is true if N legally denotes a type name within its own
1834 -- declaration. Prior to Ada 2012 this covered only synchronized type
1835 -- declarations. In Ada 2012 it also covers type and subtype declarations
1836 -- with aspects: Invariant, Predicate, and Default_Initial_Condition.
1837
1838 function Is_Current_Instance_Reference_In_Type_Aspect
1839 (N : Node_Id) return Boolean;
1840 -- True if N is a reference to a current instance object that occurs within
1841 -- an aspect_specification for a type or subtype. In this case N will be
1842 -- a formal parameter of a subprogram created for a predicate, invariant,
1843 -- or Default_Initial_Condition aspect.
1844
1845 function Is_Declaration
1846 (N : Node_Id;
1847 Body_OK : Boolean := True;
1848 Concurrent_OK : Boolean := True;
1849 Formal_OK : Boolean := True;
1850 Generic_OK : Boolean := True;
1851 Instantiation_OK : Boolean := True;
1852 Renaming_OK : Boolean := True;
1853 Stub_OK : Boolean := True;
1854 Subprogram_OK : Boolean := True;
1855 Type_OK : Boolean := True) return Boolean;
1856 -- Determine whether arbitrary node N denotes a declaration depending
1857 -- on the allowed subsets of declarations. Set the following flags to
1858 -- consider specific subsets of declarations:
1859 --
1860 -- * Body_OK - body declarations
1861 --
1862 -- * Concurrent_OK - concurrent type declarations
1863 --
1864 -- * Formal_OK - formal declarations
1865 --
1866 -- * Generic_OK - generic declarations, including generic renamings
1867 --
1868 -- * Instantiation_OK - generic instantiations
1869 --
1870 -- * Renaming_OK - renaming declarations, including generic renamings
1871 --
1872 -- * Stub_OK - stub declarations
1873 --
1874 -- * Subprogram_OK - entry, expression function, and subprogram
1875 -- declarations.
1876 --
1877 -- * Type_OK - type declarations, including concurrent types
1878
1879 function Is_Declared_Within_Variant (Comp : Entity_Id) return Boolean;
1880 -- Returns True iff component Comp is declared within a variant part
1881
1882 function Is_Dependent_Component_Of_Mutable_Object
1883 (Object : Node_Id) return Boolean;
1884 -- Returns True if Object is the name of a subcomponent that depends on
1885 -- discriminants of a variable whose nominal subtype is unconstrained and
1886 -- not indefinite, and the variable is not aliased. Otherwise returns
1887 -- False. The nodes passed to this function are assumed to denote objects.
1888
1889 function Is_Dereferenced (N : Node_Id) return Boolean;
1890 -- N is a subexpression node of an access type. This function returns true
1891 -- if N appears as the prefix of a node that does a dereference of the
1892 -- access value (selected/indexed component, explicit dereference or a
1893 -- slice), and false otherwise.
1894
1895 function Is_Descendant_Of (T1 : Entity_Id; T2 : Entity_Id) return Boolean;
1896 -- Returns True if type T1 is a descendant of type T2, and false otherwise.
1897 -- This is the RM definition, a type is a descendant of another type if it
1898 -- is the same type or is derived from a descendant of the other type.
1899
1900 function Is_Descendant_Of_Suspension_Object
1901 (Typ : Entity_Id) return Boolean;
1902 -- Determine whether type Typ is a descendant of type Suspension_Object
1903 -- defined in Ada.Synchronous_Task_Control. This version is different from
1904 -- Is_Descendant_Of as the detection of Suspension_Object does not involve
1905 -- an entity and by extension a call to RTSfind.
1906
1907 function Is_Double_Precision_Floating_Point_Type
1908 (E : Entity_Id) return Boolean;
1909 -- Return whether E is a double precision floating point type,
1910 -- characterized by:
1911 -- . machine_radix = 2
1912 -- . machine_mantissa = 53
1913 -- . machine_emax = 2**10
1914 -- . machine_emin = 3 - machine_emax
1915
1916 function Is_Effectively_Volatile
1917 (Id : Entity_Id;
1918 Ignore_Protected : Boolean := False) return Boolean;
1919 -- Determine whether a type or object denoted by entity Id is effectively
1920 -- volatile (SPARK RM 7.1.2). To qualify as such, the entity must be either
1921 -- * Volatile without No_Caching
1922 -- * An array type subject to aspect Volatile_Components
1923 -- * An array type whose component type is effectively volatile
1924 -- * A protected type
1925 -- * Descendant of type Ada.Synchronous_Task_Control.Suspension_Object
1926 --
1927 -- If Ignore_Protected is True, then a protected object/type is treated
1928 -- like a non-protected record object/type for computing the result of
1929 -- this query.
1930
1931 function Is_Effectively_Volatile_For_Reading
1932 (Id : Entity_Id;
1933 Ignore_Protected : Boolean := False) return Boolean;
1934 -- Determine whether a type or object denoted by entity Id is effectively
1935 -- volatile for reading (SPARK RM 7.1.2). To qualify as such, the entity
1936 -- must be either
1937 -- * Volatile without No_Caching and have Async_Writers or
1938 -- Effective_Reads set to True
1939 -- * An array type subject to aspect Volatile_Components, unless it has
1940 -- Async_Writers and Effective_Reads set to False
1941 -- * An array type whose component type is effectively volatile for
1942 -- reading
1943 -- * A protected type
1944 -- * Descendant of type Ada.Synchronous_Task_Control.Suspension_Object
1945 --
1946 -- If Ignore_Protected is True, then a protected object/type is treated
1947 -- like a non-protected record object/type for computing the result of
1948 -- this query.
1949
1950 function Is_Effectively_Volatile_Object
1951 (N : Node_Id) return Boolean;
1952 -- Determine whether an arbitrary node denotes an effectively volatile
1953 -- object (SPARK RM 7.1.2).
1954
1955 function Is_Effectively_Volatile_Object_For_Reading
1956 (N : Node_Id) return Boolean;
1957 -- Determine whether an arbitrary node denotes an effectively volatile
1958 -- object for reading (SPARK RM 7.1.2).
1959
1960 function Is_Entry_Body (Id : Entity_Id) return Boolean;
1961 -- Determine whether entity Id is the body entity of an entry [family]
1962
1963 function Is_Entry_Declaration (Id : Entity_Id) return Boolean;
1964 -- Determine whether entity Id is the spec entity of an entry [family]
1965
1966 function Is_Explicitly_Aliased (N : Node_Id) return Boolean;
1967 -- Determine if a given node N is an explicitly aliased formal parameter.
1968
1969 function Is_Expanded_Priority_Attribute (E : Entity_Id) return Boolean;
1970 -- Check whether a function in a call is an expanded priority attribute,
1971 -- which is transformed into an Rtsfind call to Get_Ceiling. This expansion
1972 -- does not take place in a configurable runtime.
1973
1974 function Is_Expression_Function (Subp : Entity_Id) return Boolean;
1975 -- Determine whether subprogram [body] Subp denotes an expression function
1976
1977 function Is_Expression_Function_Or_Completion
1978 (Subp : Entity_Id) return Boolean;
1979 -- Determine whether subprogram [body] Subp denotes an expression function
1980 -- or is completed by an expression function body.
1981
1982 function Is_EVF_Expression (N : Node_Id) return Boolean;
1983 -- Determine whether node N denotes a reference to a formal parameter of
1984 -- a specific tagged type whose related subprogram is subject to pragma
1985 -- Extensions_Visible with value "False" (SPARK RM 6.1.7). Several other
1986 -- constructs fall under this category:
1987 -- 1) A qualified expression whose operand is EVF
1988 -- 2) A type conversion whose operand is EVF
1989 -- 3) An if expression with at least one EVF dependent_expression
1990 -- 4) A case expression with at least one EVF dependent_expression
1991
1992 function Is_False (U : Uint) return Boolean;
1993 pragma Inline (Is_False);
1994 -- The argument is a Uint value which is the Boolean'Pos value of a Boolean
1995 -- operand (i.e. is either 0 for False, or 1 for True). This function tests
1996 -- if it is False (i.e. zero).
1997
1998 function Is_Fixed_Model_Number (U : Ureal; T : Entity_Id) return Boolean;
1999 -- Returns True iff the number U is a model number of the fixed-point type
2000 -- T, i.e. if it is an exact multiple of Small.
2001
2002 function Is_Full_Access_Object (N : Node_Id) return Boolean;
2003 -- Determine whether arbitrary node N denotes a reference to a full access
2004 -- object as per Ada 2020 RM C.6(8.2).
2005
2006 function Is_Fully_Initialized_Type (Typ : Entity_Id) return Boolean;
2007 -- Typ is a type entity. This function returns true if this type is fully
2008 -- initialized, meaning that an object of the type is fully initialized.
2009 -- Note that initialization resulting from use of pragma Normalize_Scalars
2010 -- does not count. Note that this is only used for the purpose of issuing
2011 -- warnings for objects that are potentially referenced uninitialized. This
2012 -- means that the result returned is not crucial, but should err on the
2013 -- side of thinking things are fully initialized if it does not know.
2014
2015 function Is_Generic_Declaration_Or_Body (Decl : Node_Id) return Boolean;
2016 -- Determine whether arbitrary declaration Decl denotes a generic package,
2017 -- a generic subprogram or a generic body.
2018
2019 function Is_Independent_Object (N : Node_Id) return Boolean;
2020 -- Determine whether arbitrary node N denotes a reference to an independent
2021 -- object as per RM C.6(8).
2022
2023 function Is_Inherited_Operation (E : Entity_Id) return Boolean;
2024 -- E is a subprogram. Return True is E is an implicit operation inherited
2025 -- by a derived type declaration.
2026
2027 function Is_Inherited_Operation_For_Type
2028 (E : Entity_Id;
2029 Typ : Entity_Id) return Boolean;
2030 -- E is a subprogram. Return True is E is an implicit operation inherited
2031 -- by the derived type declaration for type Typ.
2032
2033 function Is_Inlinable_Expression_Function (Subp : Entity_Id) return Boolean;
2034 -- Return True if Subp is an expression function that fulfills all the
2035 -- following requirements for inlining:
2036 -- 1. pragma/aspect Inline_Always
2037 -- 2. No formals
2038 -- 3. No contracts
2039 -- 4. No dispatching primitive
2040 -- 5. Result subtype controlled (or with controlled components)
2041 -- 6. Result subtype not subject to type-invariant checks
2042 -- 7. Result subtype not a class-wide type
2043 -- 8. Return expression naming an object global to the function
2044 -- 9. Nominal subtype of the returned object statically compatible
2045 -- with the result subtype of the expression function.
2046
2047 function Is_Iterator (Typ : Entity_Id) return Boolean;
2048 -- AI05-0139-2: Check whether Typ is one of the predefined interfaces in
2049 -- Ada.Iterator_Interfaces, or it is derived from one.
2050
2051 function Is_Iterator_Over_Array (N : Node_Id) return Boolean;
2052 -- N is an iterator specification. Returns True iff N is an iterator over
2053 -- an array, either inside a loop of the form 'for X of A' or a quantified
2054 -- expression of the form 'for all/some X of A' where A is of array type.
2055
2056 type Is_LHS_Result is (Yes, No, Unknown);
2057 function Is_LHS (N : Node_Id) return Is_LHS_Result;
2058 -- Returns Yes if N is definitely used as Name in an assignment statement.
2059 -- Returns No if N is definitely NOT used as a Name in an assignment
2060 -- statement. Returns Unknown if we can't tell at this stage (happens in
2061 -- the case where we don't know the type of N yet, and we have something
2062 -- like N.A := 3, where this counts as N being used on the left side of
2063 -- an assignment only if N is not an access type. If it is an access type
2064 -- then it is N.all.A that is assigned, not N.
2065
2066 function Is_Library_Level_Entity (E : Entity_Id) return Boolean;
2067 -- A library-level declaration is one that is accessible from Standard,
2068 -- i.e. a library unit or an entity declared in a library package.
2069
2070 function Is_Limited_Class_Wide_Type (Typ : Entity_Id) return Boolean;
2071 -- Determine whether a given type is a limited class-wide type, in which
2072 -- case it needs a Master_Id, because extensions of its designated type
2073 -- may include task components. A class-wide type that comes from a
2074 -- limited view must be treated in the same way.
2075
2076 function Is_Local_Variable_Reference (Expr : Node_Id) return Boolean;
2077 -- Determines whether Expr is a reference to a variable or IN OUT mode
2078 -- parameter of the current enclosing subprogram.
2079 -- Why are OUT parameters not considered here ???
2080
2081 function Is_Master (N : Node_Id) return Boolean;
2082 -- Determine if the given node N constitutes a finalization master
2083
2084 function Is_Name_Reference (N : Node_Id) return Boolean;
2085 -- Determine whether arbitrary node N is a reference to a name. This is
2086 -- similar to Is_Object_Reference but returns True only if N can be renamed
2087 -- without the need for a temporary, the typical example of an object not
2088 -- in this category being a function call.
2089
2090 function Is_Non_Preelaborable_Construct (N : Node_Id) return Boolean;
2091 -- Determine whether arbitrary construct N violates preelaborability as
2092 -- defined in ARM 10.2.1 5-9/3. This routine takes into account both the
2093 -- syntactic and semantic properties of the construct.
2094
2095 function Is_Nontrivial_DIC_Procedure (Id : Entity_Id) return Boolean;
2096 -- Determine whether entity Id denotes the procedure that verifies the
2097 -- assertion expression of pragma Default_Initial_Condition and if it does,
2098 -- the encapsulated expression is nontrivial.
2099
2100 function Is_Null_Record_Type (T : Entity_Id) return Boolean;
2101 -- Determine whether T is declared with a null record definition or a
2102 -- null component list.
2103
2104 function Is_Object_Image (Prefix : Node_Id) return Boolean;
2105 -- Returns True if an 'Img, 'Image, 'Wide_Image, or 'Wide_Wide_Image
2106 -- attribute is applied to an object.
2107
2108 function Is_Object_Reference (N : Node_Id) return Boolean;
2109 -- Determines if the tree referenced by N represents an object. Both
2110 -- variable and constant objects return True (compare Is_Variable).
2111
2112 function Is_OK_Variable_For_Out_Formal (AV : Node_Id) return Boolean;
2113 -- Used to test if AV is an acceptable formal for an OUT or IN OUT formal.
2114 -- Note that the Is_Variable function is not quite the right test because
2115 -- this is a case in which conversions whose expression is a variable (in
2116 -- the Is_Variable sense) with an untagged type target are considered view
2117 -- conversions and hence variables.
2118
2119 function Is_OK_Volatile_Context
2120 (Context : Node_Id;
2121 Obj_Ref : Node_Id) return Boolean;
2122 -- Determine whether node Context denotes a "non-interfering context" (as
2123 -- defined in SPARK RM 7.1.3(10)) where volatile reference Obj_Ref can
2124 -- safely reside.
2125
2126 function Is_Package_Contract_Annotation (Item : Node_Id) return Boolean;
2127 -- Determine whether aspect specification or pragma Item is one of the
2128 -- following package contract annotations:
2129 -- Abstract_State
2130 -- Initial_Condition
2131 -- Initializes
2132 -- Refined_State
2133
2134 function Is_Partially_Initialized_Type
2135 (Typ : Entity_Id;
2136 Include_Implicit : Boolean := True) return Boolean;
2137 -- Typ is a type entity. This function returns true if this type is partly
2138 -- initialized, meaning that an object of the type is at least partly
2139 -- initialized (in particular in the record case, that at least one
2140 -- component has an initialization expression, including via Default_Value
2141 -- and Default_Component_Value aspects). Note that initialization
2142 -- resulting from the use of pragma Normalize_Scalars does not count.
2143 -- Include_Implicit controls whether implicit initialization of access
2144 -- values to null, and of discriminant values, is counted as making the
2145 -- type be partially initialized. For the default setting of True, these
2146 -- implicit cases do count, and discriminated types or types containing
2147 -- access values not explicitly initialized will return True. Otherwise
2148 -- if Include_Implicit is False, these cases do not count as making the
2149 -- type be partially initialized.
2150
2151 function Is_Potentially_Unevaluated (N : Node_Id) return Boolean;
2152 -- Predicate to implement definition given in RM 6.1.1 (20/3)
2153
2154 function Is_Potentially_Persistent_Type (T : Entity_Id) return Boolean;
2155 -- Determines if type T is a potentially persistent type. A potentially
2156 -- persistent type is defined (recursively) as a scalar type, an untagged
2157 -- record whose components are all of a potentially persistent type, or an
2158 -- array with all static constraints whose component type is potentially
2159 -- persistent. A private type is potentially persistent if the full type
2160 -- is potentially persistent.
2161
2162 function Is_Predefined_Dispatching_Operation (E : Entity_Id) return Boolean;
2163 -- Ada 2005 (AI-251): Determines if E is a predefined primitive operation
2164
2165 function Is_Predefined_Interface_Primitive (E : Entity_Id) return Boolean;
2166 -- Ada 2005 (AI-345): Returns True if E is one of the predefined primitives
2167 -- required to implement interfaces.
2168
2169 function Is_Predefined_Internal_Operation (E : Entity_Id) return Boolean;
2170 -- Similar to the previous one, but excludes stream operations, because
2171 -- these may be overridden, and need extra formals, like user-defined
2172 -- operations.
2173
2174 function Is_Preelaborable_Aggregate (Aggr : Node_Id) return Boolean;
2175 -- Determine whether aggregate Aggr violates the restrictions of
2176 -- preelaborable constructs as defined in ARM 10.2.1(5-9).
2177
2178 function Is_Preelaborable_Construct (N : Node_Id) return Boolean;
2179 -- Determine whether arbitrary node N violates the restrictions of
2180 -- preelaborable constructs as defined in ARM 10.2.1(5-9). Routine
2181 -- Is_Non_Preelaborable_Construct takes into account the syntactic
2182 -- and semantic properties of N for a more accurate diagnostic.
2183
2184 function Is_Protected_Self_Reference (N : Node_Id) return Boolean;
2185 -- Return True if node N denotes a protected type name which represents
2186 -- the current instance of a protected object according to RM 9.4(21/2).
2187
2188 function Is_RCI_Pkg_Spec_Or_Body (Cunit : Node_Id) return Boolean;
2189 -- Return True if a compilation unit is the specification or the
2190 -- body of a remote call interface package.
2191
2192 function Is_Remote_Access_To_Class_Wide_Type (E : Entity_Id) return Boolean;
2193 -- Return True if E is a remote access-to-class-wide type
2194
2195 function Is_Remote_Access_To_Subprogram_Type (E : Entity_Id) return Boolean;
2196 -- Return True if E is a remote access to subprogram type
2197
2198 function Is_Remote_Call (N : Node_Id) return Boolean;
2199 -- Return True if N denotes a potentially remote call
2200
2201 function Is_Renamed_Entry (Proc_Nam : Entity_Id) return Boolean;
2202 -- Return True if Proc_Nam is a procedure renaming of an entry
2203
2204 function Is_Reversible_Iterator (Typ : Entity_Id) return Boolean;
2205 -- AI05-0139-2: Check whether Typ is derived from the predefined interface
2206 -- Ada.Iterator_Interfaces.Reversible_Iterator.
2207
2208 function Is_Selector_Name (N : Node_Id) return Boolean;
2209 -- Given an N_Identifier node N, determines if it is a Selector_Name.
2210 -- As described in Sinfo, Selector_Names are special because they
2211 -- represent use of the N_Identifier node for a true identifier, when
2212 -- normally such nodes represent a direct name.
2213
2214 function Is_Single_Concurrent_Object (Id : Entity_Id) return Boolean;
2215 -- Determine whether arbitrary entity Id denotes the anonymous object
2216 -- created for a single protected or single task type.
2217
2218 function Is_Single_Concurrent_Type (Id : Entity_Id) return Boolean;
2219 -- Determine whether arbitrary entity Id denotes a single protected or
2220 -- single task type.
2221
2222 function Is_Single_Concurrent_Type_Declaration (N : Node_Id) return Boolean;
2223 -- Determine whether arbitrary node N denotes the declaration of a single
2224 -- protected type or single task type.
2225
2226 function Is_Single_Precision_Floating_Point_Type
2227 (E : Entity_Id) return Boolean;
2228 -- Return whether E is a single precision floating point type,
2229 -- characterized by:
2230 -- . machine_radix = 2
2231 -- . machine_mantissa = 24
2232 -- . machine_emax = 2**7
2233 -- . machine_emin = 3 - machine_emax
2234
2235 function Is_Single_Protected_Object (Id : Entity_Id) return Boolean;
2236 -- Determine whether arbitrary entity Id denotes the anonymous object
2237 -- created for a single protected type.
2238
2239 function Is_Single_Task_Object (Id : Entity_Id) return Boolean;
2240 -- Determine whether arbitrary entity Id denotes the anonymous object
2241 -- created for a single task type.
2242
2243 function Is_Special_Aliased_Formal_Access
2244 (Exp : Node_Id;
2245 In_Return_Context : Boolean := False) return Boolean;
2246 -- Determines whether a dynamic check must be generated for explicitly
2247 -- aliased formals within a function Scop for the expression Exp.
2248
2249 -- In_Return_Context forces Is_Special_Aliased_Formal_Access to assume
2250 -- that Exp is within a return value which is useful for checking
2251 -- expressions within discriminant associations of return objects.
2252
2253 -- More specially, Is_Special_Aliased_Formal_Access checks that Exp is a
2254 -- 'Access attribute reference within a return statement where the ultimate
2255 -- prefix is an aliased formal of Scop and that Scop returns an anonymous
2256 -- access type. See RM 3.10.2 for more details.
2257
2258 function Is_Specific_Tagged_Type (Typ : Entity_Id) return Boolean;
2259 -- Determine whether an arbitrary [private] type is specifically tagged
2260
2261 function Is_Statement (N : Node_Id) return Boolean;
2262 pragma Inline (Is_Statement);
2263 -- Check if the node N is a statement node. Note that this includes
2264 -- the case of procedure call statements (unlike the direct use of
2265 -- the N_Statement_Other_Than_Procedure_Call subtype from Sinfo).
2266 -- Note that a label is *not* a statement, and will return False.
2267
2268 function Is_Static_Discriminant_Component (N : Node_Id) return Boolean;
2269 -- Return True if N is guaranteed to a selected component containing a
2270 -- statically known discriminant.
2271 -- Note that this routine takes a conservative view and may return False
2272 -- in some cases where N would match the criteria. In other words this
2273 -- routine should be used to simplify or optimize the expanded code.
2274
2275 function Is_Static_Function (Subp : Entity_Id) return Boolean;
2276 -- Determine whether subprogram Subp denotes a static function,
2277 -- which is a function with the aspect Static with value True.
2278
2279 function Is_Static_Function_Call (Call : Node_Id) return Boolean;
2280 -- Determine whether Call is a static call to a static function,
2281 -- meaning that the name of the call denotes a static function
2282 -- and all of the call's actual parameters are given by static expressions.
2283
2284 function Is_Subcomponent_Of_Full_Access_Object (N : Node_Id) return Boolean;
2285 -- Determine whether arbitrary node N denotes a reference to a subcomponent
2286 -- of a full access object as per RM C.6(7).
2287
2288 function Is_Subprogram_Contract_Annotation (Item : Node_Id) return Boolean;
2289 -- Determine whether aspect specification or pragma Item is one of the
2290 -- following subprogram contract annotations:
2291 -- Contract_Cases
2292 -- Depends
2293 -- Extensions_Visible
2294 -- Global
2295 -- Post
2296 -- Post_Class
2297 -- Postcondition
2298 -- Pre
2299 -- Pre_Class
2300 -- Precondition
2301 -- Refined_Depends
2302 -- Refined_Global
2303 -- Refined_Post
2304 -- Subprogram_Variant
2305 -- Test_Case
2306
2307 function Is_Subprogram_Stub_Without_Prior_Declaration
2308 (N : Node_Id) return Boolean;
2309 -- Given an N_Subprogram_Body_Stub node N, return True if N is a subprogram
2310 -- stub with no prior subprogram declaration.
2311
2312 function Is_Suitable_Primitive (Subp_Id : Entity_Id) return Boolean;
2313 -- Determine whether arbitrary subprogram Subp_Id may act as a primitive of
2314 -- an arbitrary tagged type.
2315
2316 function Is_Suspension_Object (Id : Entity_Id) return Boolean;
2317 -- Determine whether arbitrary entity Id denotes Suspension_Object defined
2318 -- in Ada.Synchronous_Task_Control.
2319
2320 function Is_Synchronized_Object (Id : Entity_Id) return Boolean;
2321 -- Determine whether entity Id denotes an object and if it does, whether
2322 -- this object is synchronized as specified in SPARK RM 9.1. To qualify as
2323 -- such, the object must be
2324 -- * Of a type that yields a synchronized object
2325 -- * An atomic object with enabled Async_Writers
2326 -- * A constant not of access-to-variable type
2327 -- * A variable subject to pragma Constant_After_Elaboration
2328
2329 function Is_Synchronized_Tagged_Type (E : Entity_Id) return Boolean;
2330 -- Returns True if E is a synchronized tagged type (AARM 3.9.4 (6/2))
2331
2332 function Is_Transfer (N : Node_Id) return Boolean;
2333 -- Returns True if the node N is a statement which is known to cause an
2334 -- unconditional transfer of control at run time, i.e. the following
2335 -- statement definitely will not be executed.
2336
2337 function Is_True (U : Uint) return Boolean;
2338 pragma Inline (Is_True);
2339 -- The argument is a Uint value which is the Boolean'Pos value of a Boolean
2340 -- operand (i.e. is either 0 for False, or 1 for True). This function tests
2341 -- if it is True (i.e. non-zero).
2342
2343 function Is_Unchecked_Conversion_Instance (Id : Entity_Id) return Boolean;
2344 -- Determine whether an arbitrary entity denotes an instance of function
2345 -- Ada.Unchecked_Conversion.
2346
2347 function Is_Universal_Numeric_Type (T : Entity_Id) return Boolean;
2348 pragma Inline (Is_Universal_Numeric_Type);
2349 -- True if T is Universal_Integer or Universal_Real
2350
2351 function Is_User_Defined_Equality (Id : Entity_Id) return Boolean;
2352 -- Determine whether an entity denotes a user-defined equality
2353
2354 function Is_Validation_Variable_Reference (N : Node_Id) return Boolean;
2355 -- Determine whether N denotes a reference to a variable which captures the
2356 -- value of an object for validation purposes.
2357
2358 function Is_Variable_Size_Array (E : Entity_Id) return Boolean;
2359 -- Returns true if E has variable size components
2360
2361 function Is_Variable_Size_Record (E : Entity_Id) return Boolean;
2362 -- Returns true if E has variable size components
2363
2364 -- WARNING: There is a matching C declaration of this subprogram in fe.h
2365
2366 function Is_Variable
2367 (N : Node_Id;
2368 Use_Original_Node : Boolean := True) return Boolean;
2369 -- Determines if the tree referenced by N represents a variable, i.e. can
2370 -- appear on the left side of an assignment. There is one situation (formal
2371 -- parameters) in which untagged type conversions are also considered
2372 -- variables, but Is_Variable returns False for such cases, since it has
2373 -- no knowledge of the context. Note that this is the point at which
2374 -- Assignment_OK is checked, and True is returned for any tree thus marked.
2375 -- Use_Original_Node is used to perform the test on Original_Node (N). By
2376 -- default is True since this routine is commonly invoked as part of the
2377 -- semantic analysis and it must not be disturbed by the rewriten nodes.
2378
2379 function Is_View_Conversion (N : Node_Id) return Boolean;
2380 -- Returns True if N is a type_conversion whose operand is the name of an
2381 -- object and both its target type and operand type are tagged, or it
2382 -- appears in a call as an actual parameter of mode out or in out
2383 -- (RM 4.6(5/2)).
2384
2385 function Is_Visibly_Controlled (T : Entity_Id) return Boolean;
2386 -- Check whether T is derived from a visibly controlled type. This is true
2387 -- if the root type is declared in Ada.Finalization. If T is derived
2388 -- instead from a private type whose full view is controlled, an explicit
2389 -- Initialize/Adjust/Finalize subprogram does not override the inherited
2390 -- one.
2391
2392 function Is_Volatile_Full_Access_Object_Ref (N : Node_Id) return Boolean;
2393 -- Determine whether arbitrary node N denotes a reference to an object
2394 -- which is Volatile_Full_Access.
2395
2396 function Is_Volatile_Function (Func_Id : Entity_Id) return Boolean;
2397 -- Determine whether [generic] function Func_Id is subject to enabled
2398 -- pragma Volatile_Function. Protected functions are treated as volatile
2399 -- (SPARK RM 7.1.2).
2400
2401 function Is_Volatile_Object_Ref (N : Node_Id) return Boolean;
2402 -- Determine whether arbitrary node N denotes a reference to a volatile
2403 -- object as per RM C.6(8). Note that the test here is for something that
2404 -- is actually declared as volatile, not for an object that gets treated
2405 -- as volatile (see Einfo.Treat_As_Volatile).
2406
2407 generic
2408 with procedure Handle_Parameter (Formal : Entity_Id; Actual : Node_Id);
2409 procedure Iterate_Call_Parameters (Call : Node_Id);
2410 -- Calls Handle_Parameter for each pair of formal and actual parameters of
2411 -- a function, procedure, or entry call.
2412
2413 function Itype_Has_Declaration (Id : Entity_Id) return Boolean;
2414 -- Applies to Itypes. True if the Itype is attached to a declaration for
2415 -- the type through its Parent field, which may or not be present in the
2416 -- tree.
2417
2418 procedure Kill_Current_Values (Last_Assignment_Only : Boolean := False);
2419 -- This procedure is called to clear all constant indications from all
2420 -- entities in the current scope and in any parent scopes if the current
2421 -- scope is a block or a package (and that recursion continues to the top
2422 -- scope that is not a block or a package). This is used when the
2423 -- sequential flow-of-control assumption is violated (occurrence of a
2424 -- label, head of a loop, or start of an exception handler). The effect of
2425 -- the call is to clear the Current_Value field (but we do not need to
2426 -- clear the Is_True_Constant flag, since that only gets reset if there
2427 -- really is an assignment somewhere in the entity scope). This procedure
2428 -- also calls Kill_All_Checks, since this is a special case of needing to
2429 -- forget saved values. This procedure also clears the Is_Known_Null and
2430 -- Is_Known_Non_Null and Is_Known_Valid flags in variables, constants or
2431 -- parameters since these are also not known to be trustable any more.
2432 --
2433 -- The Last_Assignment_Only flag is set True to clear only Last_Assignment
2434 -- fields and leave other fields unchanged. This is used when we encounter
2435 -- an unconditional flow of control change (return, goto, raise). In such
2436 -- cases we don't need to clear the current values, since it may be that
2437 -- the flow of control change occurs in a conditional context, and if it
2438 -- is not taken, then it is just fine to keep the current values. But the
2439 -- Last_Assignment field is different, if we have a sequence assign-to-v,
2440 -- conditional-return, assign-to-v, we do not want to complain that the
2441 -- second assignment clobbers the first.
2442
2443 procedure Kill_Current_Values
2444 (Ent : Entity_Id;
2445 Last_Assignment_Only : Boolean := False);
2446 -- This performs the same processing as described above for the form with
2447 -- no argument, but for the specific entity given. The call has no effect
2448 -- if the entity Ent is not for an object. Last_Assignment_Only has the
2449 -- same meaning as for the call with no Ent.
2450
2451 procedure Kill_Size_Check_Code (E : Entity_Id);
2452 -- Called when an address clause or pragma Import is applied to an entity.
2453 -- If the entity is a variable or a constant, and size check code is
2454 -- present, this size check code is killed, since the object will not be
2455 -- allocated by the program.
2456
2457 function Known_Non_Null (N : Node_Id) return Boolean;
2458 -- Given a node N for a subexpression of an access type, determines if
2459 -- this subexpression yields a value that is known at compile time to
2460 -- be non-null and returns True if so. Returns False otherwise. It is
2461 -- an error to call this function if N is not of an access type.
2462
2463 function Known_Null (N : Node_Id) return Boolean;
2464 -- Given a node N for a subexpression of an access type, determines if this
2465 -- subexpression yields a value that is known at compile time to be null
2466 -- and returns True if so. Returns False otherwise. It is an error to call
2467 -- this function if N is not of an access type.
2468
2469 function Known_To_Be_Assigned (N : Node_Id) return Boolean;
2470 -- The node N is an entity reference. This function determines whether the
2471 -- reference is for sure an assignment of the entity, returning True if
2472 -- so. This differs from May_Be_Lvalue in that it defaults in the other
2473 -- direction. Cases which may possibly be assignments but are not known to
2474 -- be may return True from May_Be_Lvalue, but False from this function.
2475
2476 function Last_Source_Statement (HSS : Node_Id) return Node_Id;
2477 -- HSS is a handled statement sequence. This function returns the last
2478 -- statement in Statements (HSS) that has Comes_From_Source set. If no
2479 -- such statement exists, Empty is returned.
2480
2481 procedure Mark_Coextensions (Context_Nod : Node_Id; Root_Nod : Node_Id);
2482 -- Given a node which designates the context of analysis and an origin in
2483 -- the tree, traverse from Root_Nod and mark all allocators as either
2484 -- dynamic or static depending on Context_Nod. Any incorrect marking is
2485 -- cleaned up during resolution.
2486
2487 procedure Mark_Elaboration_Attributes
2488 (N_Id : Node_Or_Entity_Id;
2489 Checks : Boolean := False;
2490 Level : Boolean := False;
2491 Modes : Boolean := False;
2492 Warnings : Boolean := False);
2493 -- Preserve relevant elaboration-related properties of the context in
2494 -- arbitrary entity or node N_Id. The flags control the properties as
2495 -- follows:
2496 --
2497 -- Checks - Save the status of Elaboration_Check
2498 -- Level - Save the declaration level of N_Id (if appicable)
2499 -- Modes - Save the Ghost and SPARK modes in effect (if applicable)
2500 -- Warnings - Save the status of Elab_Warnings
2501
2502 procedure Mark_Save_Invocation_Graph_Of_Body;
2503 -- Notify the body of the main unit that the invocation constructs and
2504 -- relations expressed within it must be recorded by the ABE mechanism.
2505
2506 function Matching_Static_Array_Bounds
2507 (L_Typ : Node_Id;
2508 R_Typ : Node_Id) return Boolean;
2509 -- L_Typ and R_Typ are two array types. Returns True when they have the
2510 -- same number of dimensions, and the same static bounds for each index
2511 -- position.
2512
2513 function May_Be_Lvalue (N : Node_Id) return Boolean;
2514 -- Determines if N could be an lvalue (e.g. an assignment left hand side).
2515 -- An lvalue is defined as any expression which appears in a context where
2516 -- a name is required by the syntax, and the identity, rather than merely
2517 -- the value of the node is needed (for example, the prefix of an Access
2518 -- attribute is in this category). Note that, as implied by the name, this
2519 -- test is conservative. If it cannot be sure that N is NOT an lvalue, then
2520 -- it returns True. It tries hard to get the answer right, but it is hard
2521 -- to guarantee this in all cases. Note that it is more possible to give
2522 -- correct answer if the tree is fully analyzed.
2523
2524 function Might_Raise (N : Node_Id) return Boolean;
2525 -- True if evaluation of N might raise an exception. This is conservative;
2526 -- if we're not sure, we return True. If N is a subprogram body, this is
2527 -- about whether execution of that body can raise.
2528
2529 function Nearest_Enclosing_Instance (E : Entity_Id) return Entity_Id;
2530 -- Return the entity of the nearest enclosing instance which encapsulates
2531 -- entity E. If no such instance exits, return Empty.
2532
2533 function Needs_Finalization (Typ : Entity_Id) return Boolean;
2534 -- Determine whether type Typ is controlled and thus requires finalization
2535 -- actions.
2536
2537 function Needs_One_Actual (E : Entity_Id) return Boolean;
2538 -- Returns True if a function has defaults for all but its first formal,
2539 -- which is a controlling formal. Used in Ada 2005 mode to solve the
2540 -- syntactic ambiguity that results from an indexing of a function call
2541 -- that returns an array, so that Obj.F (X, Y) may mean F (Ob) (X, Y).
2542
2543 function Needs_Result_Accessibility_Level
2544 (Func_Id : Entity_Id) return Boolean;
2545 -- Ada 2012 (AI05-0234): Return True if the function needs an implicit
2546 -- parameter to identify the accessibility level of the function result
2547 -- "determined by the point of call".
2548
2549 function Needs_Simple_Initialization
2550 (Typ : Entity_Id;
2551 Consider_IS : Boolean := True) return Boolean;
2552 -- Certain types need initialization even though there is no specific
2553 -- initialization routine:
2554 -- Access types (which need initializing to null)
2555 -- All scalar types if Normalize_Scalars mode set
2556 -- Descendants of standard string types if Normalize_Scalars mode set
2557 -- Scalar types having a Default_Value attribute
2558 -- Regarding Initialize_Scalars mode, this is ignored if Consider_IS is
2559 -- set to False, but if Consider_IS is set to True, then the cases above
2560 -- mentioning Normalize_Scalars also apply for Initialize_Scalars mode.
2561
2562 function Needs_Variable_Reference_Marker
2563 (N : Node_Id;
2564 Calls_OK : Boolean) return Boolean;
2565 -- Determine whether arbitrary node N denotes a reference to a variable
2566 -- which is suitable for SPARK elaboration checks. Flag Calls_OK should
2567 -- be set when the reference is allowed to appear within calls.
2568
2569 function New_Copy_List_Tree (List : List_Id) return List_Id;
2570 -- Copy recursively an analyzed list of nodes. Uses New_Copy_Tree defined
2571 -- below. As for New_Copy_Tree, it is illegal to attempt to copy extended
2572 -- nodes (entities) either directly or indirectly using this function.
2573
2574 function New_Copy_Separate_List (List : List_Id) return List_Id;
2575 -- Copy recursively a list of nodes using New_Copy_Separate_Tree
2576
2577 function New_Copy_Separate_Tree (Source : Node_Id) return Node_Id;
2578 -- Perform a deep copy of the subtree rooted at Source using New_Copy_Tree
2579 -- replacing entities of local declarations by new entities. This behavior
2580 -- is required by the backend to ensure entities uniqueness when a copy of
2581 -- a subtree is attached to the tree. The new entities keep their original
2582 -- names to facilitate debugging the tree copy.
2583
2584 function New_Copy_Tree
2585 (Source : Node_Id;
2586 Map : Elist_Id := No_Elist;
2587 New_Sloc : Source_Ptr := No_Location;
2588 New_Scope : Entity_Id := Empty;
2589 Scopes_In_EWA_OK : Boolean := False) return Node_Id;
2590 -- Perform a deep copy of the subtree rooted at Source. Entities, itypes,
2591 -- and nodes are handled separately as follows:
2592 --
2593 -- * A node is replicated by first creating a shallow copy, then copying
2594 -- its syntactic fields, where all Parent pointers of the fields are
2595 -- updated to refer to the copy. In addition, the following semantic
2596 -- fields are recreated after the replication takes place.
2597 --
2598 -- First_Named_Actual
2599 -- First_Real_Statement
2600 -- Next_Named_Actual
2601 --
2602 -- If applicable, the Etype field (if any) is updated to refer to a
2603 -- local itype or type (see below).
2604 --
2605 -- * An entity defined within an N_Expression_With_Actions node in the
2606 -- subtree is given a new entity, and all references to the original
2607 -- entity are updated to refer to the new entity. In addition, the
2608 -- following semantic fields are replicated and/or updated to refer
2609 -- to a local entity or itype.
2610 --
2611 -- Discriminant_Constraint
2612 -- Etype
2613 -- First_Index
2614 -- Next_Entity
2615 -- Packed_Array_Impl_Type
2616 -- Scalar_Range
2617 -- Scope
2618 --
2619 -- Note that currently no other expression can define entities.
2620 --
2621 -- * An itype whose Associated_Node_For_Itype node is in the subtree
2622 -- is given a new entity, and all references to the original itype
2623 -- are updated to refer to the new itype. In addition, the following
2624 -- semantic fields are replicated and/or updated to refer to a local
2625 -- entity or itype.
2626 --
2627 -- Discriminant_Constraint
2628 -- Etype
2629 -- First_Index
2630 -- Next_Entity
2631 -- Packed_Array_Impl_Type
2632 -- Scalar_Range
2633 -- Scope
2634 --
2635 -- The Associated_Node_For_Itype is updated to refer to a replicated
2636 -- node.
2637 --
2638 -- The routine can replicate both analyzed and unanalyzed trees. Copying an
2639 -- Empty or Error node yields the same node.
2640 --
2641 -- Parameter Map may be used to specify a set of mappings between entities.
2642 -- These mappings are then taken into account when replicating entities.
2643 -- The format of Map must be as follows:
2644 --
2645 -- old entity 1
2646 -- new entity to replace references to entity 1
2647 -- old entity 2
2648 -- new entity to replace references to entity 2
2649 -- ...
2650 --
2651 -- Map and its contents are left unchanged.
2652 --
2653 -- Parameter New_Sloc may be used to specify a new source location for all
2654 -- replicated entities, itypes, and nodes. The Comes_From_Source indicator
2655 -- is defaulted if a new source location is provided.
2656 --
2657 -- Parameter New_Scope may be used to specify a new scope for all copied
2658 -- entities and itypes.
2659 --
2660 -- Parameter Scopes_In_EWA_OK may be used to force the replication of both
2661 -- scoping entities and non-scoping entities found within expression with
2662 -- actions nodes.
2663
2664 function New_External_Entity
2665 (Kind : Entity_Kind;
2666 Scope_Id : Entity_Id;
2667 Sloc_Value : Source_Ptr;
2668 Related_Id : Entity_Id;
2669 Suffix : Character;
2670 Suffix_Index : Int := 0;
2671 Prefix : Character := ' ') return Entity_Id;
2672 -- This function creates an N_Defining_Identifier node for an internal
2673 -- created entity, such as an implicit type or subtype, or a record
2674 -- initialization procedure. The entity name is constructed with a call
2675 -- to New_External_Name (Related_Id, Suffix, Suffix_Index, Prefix), so
2676 -- that the generated name may be referenced as a public entry, and the
2677 -- Is_Public flag is set if needed (using Set_Public_Status). If the
2678 -- entity is for a type or subtype, the size/align fields are initialized
2679 -- to unknown (Uint_0).
2680
2681 function New_Internal_Entity
2682 (Kind : Entity_Kind;
2683 Scope_Id : Entity_Id;
2684 Sloc_Value : Source_Ptr;
2685 Id_Char : Character) return Entity_Id;
2686 -- This function is similar to New_External_Entity, except that the
2687 -- name is constructed by New_Internal_Name (Id_Char). This is used
2688 -- when the resulting entity does not have to be referenced as a
2689 -- public entity (and in this case Is_Public is not set).
2690
2691 function Next_Actual (Actual_Id : Node_Id) return Node_Id;
2692 -- Find next actual parameter in declaration order. As described for
2693 -- First_Actual, this is the next actual in the declaration order, not
2694 -- the call order, so this does not correspond to simply taking the
2695 -- next entry of the Parameter_Associations list. The argument is an
2696 -- actual previously returned by a call to First_Actual or Next_Actual.
2697 -- Note that the result produced is always an expression, not a parameter
2698 -- association node, even if named notation was used.
2699
2700 -- WARNING: There is a matching C declaration of this subprogram in fe.h
2701
2702 procedure Next_Actual (Actual_Id : in out Node_Id);
2703 pragma Inline (Next_Actual);
2704 -- Next_Actual (N) is equivalent to N := Next_Actual (N). Note that we
2705 -- inline this procedural form, but not the functional form above.
2706
2707 function Next_Global (Node : Node_Id) return Node_Id;
2708 -- Node is a global item from a list, obtained through calling First_Global
2709 -- and possibly Next_Global a number of times. Returns the next global item
2710 -- with the same mode.
2711
2712 procedure Next_Global (Node : in out Node_Id);
2713 pragma Inline (Next_Global);
2714 -- Next_Global (N) is equivalent to N := Next_Global (N). Note that we
2715 -- inline this procedural form, but not the functional form above.
2716
2717 function No_Caching_Enabled (Id : Entity_Id) return Boolean;
2718 -- Given the entity of a variable, determine whether Id is subject to
2719 -- volatility property No_Caching and if it is, the related expression
2720 -- evaluates to True.
2721
2722 function No_Heap_Finalization (Typ : Entity_Id) return Boolean;
2723 -- Determine whether type Typ is subject to pragma No_Heap_Finalization
2724
2725 procedure Normalize_Actuals
2726 (N : Node_Id;
2727 S : Entity_Id;
2728 Report : Boolean;
2729 Success : out Boolean);
2730 -- Reorders lists of actuals according to names of formals, value returned
2731 -- in Success indicates success of reordering. For more details, see body.
2732 -- Errors are reported only if Report is set to True.
2733
2734 procedure Note_Possible_Modification (N : Node_Id; Sure : Boolean);
2735 -- This routine is called if the sub-expression N maybe the target of
2736 -- an assignment (e.g. it is the left side of an assignment, used as
2737 -- an out parameters, or used as prefixes of access attributes). It
2738 -- sets May_Be_Modified in the associated entity if there is one,
2739 -- taking into account the rule that in the case of renamed objects,
2740 -- it is the flag in the renamed object that must be set.
2741 --
2742 -- The parameter Sure is set True if the modification is sure to occur
2743 -- (e.g. target of assignment, or out parameter), and to False if the
2744 -- modification is only potential (e.g. address of entity taken).
2745
2746 function Null_To_Null_Address_Convert_OK
2747 (N : Node_Id;
2748 Typ : Entity_Id := Empty) return Boolean;
2749 -- Return True if we are compiling in relaxed RM semantics mode and:
2750 -- 1) N is a N_Null node and Typ is a descendant of System.Address, or
2751 -- 2) N is a comparison operator, one of the operands is null, and the
2752 -- type of the other operand is a descendant of System.Address.
2753
2754 function Number_Of_Elements_In_Array (T : Entity_Id) return Int;
2755 -- Returns the number of elements in the array T if the index bounds of T
2756 -- is known at compile time. If the bounds are not known at compile time,
2757 -- the function returns the value zero.
2758
2759 function Original_Aspect_Pragma_Name (N : Node_Id) return Name_Id;
2760 -- Retrieve the name of aspect or pragma N, taking into account a possible
2761 -- rewrite and whether the pragma is generated from an aspect as the names
2762 -- may be different. The routine also deals with 'Class in which case it
2763 -- returns the following values:
2764 --
2765 -- Invariant -> Name_uInvariant
2766 -- Post'Class -> Name_uPost
2767 -- Pre'Class -> Name_uPre
2768 -- Type_Invariant -> Name_uType_Invariant
2769 -- Type_Invariant'Class -> Name_uType_Invariant
2770
2771 function Original_Corresponding_Operation (S : Entity_Id) return Entity_Id;
2772 -- [Ada 2012: AI05-0125-1]: If S is an inherited dispatching primitive S2,
2773 -- or overrides an inherited dispatching primitive S2, the original
2774 -- corresponding operation of S is the original corresponding operation of
2775 -- S2. Otherwise, it is S itself.
2776
2777 procedure Output_Entity (Id : Entity_Id);
2778 -- Print entity Id to standard output. The name of the entity appears in
2779 -- fully qualified form.
2780 --
2781 -- WARNING: this routine should be used in debugging scenarios such as
2782 -- tracking down undefined symbols as it is fairly low level.
2783
2784 procedure Output_Name (Nam : Name_Id; Scop : Entity_Id := Current_Scope);
2785 -- Print name Nam to standard output. The name appears in fully qualified
2786 -- form assuming it appears in scope Scop. Note that this may not reflect
2787 -- the final qualification as the entity which carries the name may be
2788 -- relocated to a different scope.
2789 --
2790 -- WARNING: this routine should be used in debugging scenarios such as
2791 -- tracking down undefined symbols as it is fairly low level.
2792
2793 function Param_Entity (N : Node_Id) return Entity_Id;
2794 -- Given an expression N, determines if the expression is a reference
2795 -- to a formal (of a subprogram or entry), and if so returns the Id
2796 -- of the corresponding formal entity, otherwise returns Empty. Also
2797 -- handles the case of references to renamings of formals.
2798
2799 function Policy_In_Effect (Policy : Name_Id) return Name_Id;
2800 -- Given a policy, return the policy identifier associated with it. If no
2801 -- such policy is in effect, the value returned is No_Name.
2802
2803 function Predicate_Enabled (Typ : Entity_Id) return Boolean;
2804 -- Return True if a predicate check should be emitted for the given type
2805 -- Typ, taking into account Predicates_Ignored and
2806 -- Predicate_Checks_Suppressed.
2807
2808 function Predicate_Tests_On_Arguments (Subp : Entity_Id) return Boolean;
2809 -- Subp is the entity for a subprogram call. This function returns True if
2810 -- predicate tests are required for the arguments in this call (this is the
2811 -- normal case). It returns False for special cases where these predicate
2812 -- tests should be skipped (see body for details).
2813
2814 function Primitive_Names_Match (E1, E2 : Entity_Id) return Boolean;
2815 -- Returns True if the names of both entities correspond with matching
2816 -- primitives. This routine includes support for the case in which one
2817 -- or both entities correspond with entities built by Derive_Subprogram
2818 -- with a special name to avoid being overridden (i.e. return true in case
2819 -- of entities with names "nameP" and "name" or vice versa).
2820
2821 function Private_Component (Type_Id : Entity_Id) return Entity_Id;
2822 -- Returns some private component (if any) of the given Type_Id.
2823 -- Used to enforce the rules on visibility of operations on composite
2824 -- types, that depend on the full view of the component type. For a
2825 -- record type there may be several such components, we just return
2826 -- the first one.
2827
2828 procedure Process_End_Label
2829 (N : Node_Id;
2830 Typ : Character;
2831 Ent : Entity_Id);
2832 -- N is a node whose End_Label is to be processed, generating all
2833 -- appropriate cross-reference entries, and performing style checks
2834 -- for any identifier references in the end label. Typ is either
2835 -- 'e' or 't indicating the type of the cross-reference entity
2836 -- (e for spec, t for body, see Lib.Xref spec for details). The
2837 -- parameter Ent gives the entity to which the End_Label refers,
2838 -- and to which cross-references are to be generated.
2839
2840 procedure Propagate_Concurrent_Flags
2841 (Typ : Entity_Id;
2842 Comp_Typ : Entity_Id);
2843 -- Set Has_Task, Has_Protected and Has_Timing_Event on Typ when the flags
2844 -- are set on Comp_Typ. This follows the definition of these flags which
2845 -- are set (recursively) on any composite type which has a component marked
2846 -- by one of these flags. This procedure can only set flags for Typ, and
2847 -- never clear them. Comp_Typ is the type of a component or a parent.
2848
2849 procedure Propagate_DIC_Attributes
2850 (Typ : Entity_Id;
2851 From_Typ : Entity_Id);
2852 -- Inherit all Default_Initial_Condition-related attributes from type
2853 -- From_Typ. Typ is the destination type.
2854
2855 procedure Propagate_Invariant_Attributes
2856 (Typ : Entity_Id;
2857 From_Typ : Entity_Id);
2858 -- Inherit all invariant-related attributes form type From_Typ. Typ is the
2859 -- destination type.
2860
2861 procedure Propagate_Predicate_Attributes
2862 (Typ : Entity_Id;
2863 From_Typ : Entity_Id);
2864 -- Inherit some predicate-related attributes form type From_Typ. Typ is the
2865 -- destination type. Probably to be completed with more attributes???
2866
2867 procedure Record_Possible_Part_Of_Reference
2868 (Var_Id : Entity_Id;
2869 Ref : Node_Id);
2870 -- Save reference Ref to variable Var_Id when the variable is subject to
2871 -- pragma Part_Of. If the variable is known to be a constituent of a single
2872 -- protected/task type, the legality of the reference is verified and the
2873 -- save does not take place.
2874
2875 function Referenced (Id : Entity_Id; Expr : Node_Id) return Boolean;
2876 -- Determine whether entity Id is referenced within expression Expr
2877
2878 function References_Generic_Formal_Type (N : Node_Id) return Boolean;
2879 -- Returns True if the expression Expr contains any references to a generic
2880 -- type. This can only happen within a generic template.
2881
2882 procedure Remove_Entity_And_Homonym (Id : Entity_Id);
2883 -- Remove arbitrary entity Id from both the homonym and scope chains. Use
2884 -- Remove_Overloaded_Entity for overloadable entities. Note: the removal
2885 -- performed by this routine does not affect the visibility of existing
2886 -- homonyms.
2887
2888 procedure Remove_Homonym (Id : Entity_Id);
2889 -- Removes entity Id from the homonym chain
2890
2891 procedure Remove_Overloaded_Entity (Id : Entity_Id);
2892 -- Remove arbitrary entity Id from the homonym chain, the scope chain and
2893 -- the primitive operations list of the associated controlling type. Use
2894 -- Remove_Entity for non-overloadable entities. Note: the removal performed
2895 -- by this routine does not affect the visibility of existing homonyms.
2896
2897 function Remove_Suffix (E : Entity_Id; Suffix : Character) return Name_Id;
2898 -- Returns the name of E without Suffix
2899
2900 procedure Replace_Null_By_Null_Address (N : Node_Id);
2901 -- N is N_Null or a binary comparison operator, we are compiling in relaxed
2902 -- RM semantics mode, and one of the operands is null. Replace null with
2903 -- System.Null_Address.
2904
2905 function Rep_To_Pos_Flag (E : Entity_Id; Loc : Source_Ptr) return Node_Id;
2906 -- This is used to construct the second argument in a call to Rep_To_Pos
2907 -- which is Standard_True if range checks are enabled (E is an entity to
2908 -- which the Range_Checks_Suppressed test is applied), and Standard_False
2909 -- if range checks are suppressed. Loc is the location for the node that
2910 -- is returned (which is a New_Occurrence of the appropriate entity).
2911 --
2912 -- Note: one might think that it would be fine to always use True and
2913 -- to ignore the suppress in this case, but it is generally better to
2914 -- believe a request to suppress exceptions if possible, and further
2915 -- more there is at least one case in the generated code (the code for
2916 -- array assignment in a loop) that depends on this suppression.
2917
2918 procedure Require_Entity (N : Node_Id);
2919 -- N is a node which should have an entity value if it is an entity name.
2920 -- If not, then check if there were previous errors. If so, just fill
2921 -- in with Any_Id and ignore. Otherwise signal a program error exception.
2922 -- This is used as a defense mechanism against ill-formed trees caused by
2923 -- previous errors (particularly in -gnatq mode).
2924
2925 function Requires_Transient_Scope (Id : Entity_Id) return Boolean;
2926 -- Id is a type entity. The result is True when temporaries of this type
2927 -- need to be wrapped in a transient scope to be reclaimed properly when a
2928 -- secondary stack is in use. Examples of types requiring such wrapping are
2929 -- controlled types and variable-sized types including unconstrained
2930 -- arrays.
2931
2932 -- WARNING: There is a matching C declaration of this subprogram in fe.h
2933
2934 procedure Reset_Analyzed_Flags (N : Node_Id);
2935 -- Reset the Analyzed flags in all nodes of the tree whose root is N
2936
2937 procedure Restore_SPARK_Mode (Mode : SPARK_Mode_Type; Prag : Node_Id);
2938 -- Set the current SPARK_Mode to Mode and SPARK_Mode_Pragma to Prag. This
2939 -- routine must be used in tandem with Set_SPARK_Mode.
2940
2941 function Returns_Unconstrained_Type (Subp : Entity_Id) return Boolean;
2942 -- Return true if Subp is a function that returns an unconstrained type
2943
2944 function Root_Type_Of_Full_View (T : Entity_Id) return Entity_Id;
2945 -- Similar to attribute Root_Type, but this version always follows the
2946 -- Full_View of a private type (if available) while searching for the
2947 -- ultimate derivation ancestor.
2948
2949 function Safe_To_Capture_Value
2950 (N : Node_Id;
2951 Ent : Entity_Id;
2952 Cond : Boolean := False) return Boolean;
2953 -- The caller is interested in capturing a value (either the current
2954 -- value, an indication that the value is [non-]null or an indication that
2955 -- the value is valid) for the given entity Ent. This value can only be
2956 -- captured if sequential execution semantics can be properly guaranteed so
2957 -- that a subsequent reference will indeed be sure that this current value
2958 -- indication is correct. The node N is the construct which resulted in
2959 -- the possible capture of the value (this is used to check if we are in
2960 -- a conditional).
2961 --
2962 -- Cond is used to skip the test for being inside a conditional. It is used
2963 -- in the case of capturing values from if/while tests, which already do a
2964 -- proper job of handling scoping issues without this help.
2965 --
2966 -- The only entities whose values can be captured are OUT and IN OUT formal
2967 -- parameters, and variables unless Cond is True, in which case we also
2968 -- allow IN formals, loop parameters and constants, where we cannot ever
2969 -- capture actual value information, but we can capture conditional tests.
2970
2971 function Same_Name (N1, N2 : Node_Id) return Boolean;
2972 -- Determine if two (possibly expanded) names are the same name. This is
2973 -- a purely syntactic test, and N1 and N2 need not be analyzed.
2974
2975 function Same_Object (Node1, Node2 : Node_Id) return Boolean;
2976 -- Determine if Node1 and Node2 are known to designate the same object.
2977 -- This is a semantic test and both nodes must be fully analyzed. A result
2978 -- of True is decisively correct. A result of False does not necessarily
2979 -- mean that different objects are designated, just that this could not
2980 -- be reliably determined at compile time.
2981
2982 function Same_Or_Aliased_Subprograms
2983 (S : Entity_Id;
2984 E : Entity_Id) return Boolean;
2985 -- Returns True if the subprogram entity S is the same as E or else S is an
2986 -- alias of E.
2987
2988 function Same_Type (T1, T2 : Entity_Id) return Boolean;
2989 -- Determines if T1 and T2 represent exactly the same type. Two types
2990 -- are the same if they are identical, or if one is an unconstrained
2991 -- subtype of the other, or they are both common subtypes of the same
2992 -- type with identical constraints. The result returned is conservative.
2993 -- It is True if the types are known to be the same, but a result of
2994 -- False is indecisive (e.g. the compiler may not be able to tell that
2995 -- two constraints are identical).
2996
2997 function Same_Value (Node1, Node2 : Node_Id) return Boolean;
2998 -- Determines if Node1 and Node2 are known to be the same value, which is
2999 -- true if they are both compile time known values and have the same value,
3000 -- or if they are the same object (in the sense of function Same_Object).
3001 -- A result of False does not necessarily mean they have different values,
3002 -- just that it is not possible to determine they have the same value.
3003
3004 function Scalar_Part_Present (Typ : Entity_Id) return Boolean;
3005 -- Determine whether arbitrary type Typ is a scalar type, or contains at
3006 -- least one scalar subcomponent.
3007
3008 function Scope_Within
3009 (Inner : Entity_Id;
3010 Outer : Entity_Id) return Boolean;
3011 -- Determine whether scope Inner appears within scope Outer. Note that
3012 -- scopes are partially ordered, so Scope_Within (A, B) and Scope_Within
3013 -- (B, A) may both return False.
3014
3015 function Scope_Within_Or_Same
3016 (Inner : Entity_Id;
3017 Outer : Entity_Id) return Boolean;
3018 -- Determine whether scope Inner appears within scope Outer or both denote
3019 -- the same scope. Note that scopes are partially ordered, so Scope_Within
3020 -- (A, B) and Scope_Within (B, A) may both return False.
3021
3022 procedure Set_Current_Entity (E : Entity_Id);
3023 pragma Inline (Set_Current_Entity);
3024 -- Establish the entity E as the currently visible definition of its
3025 -- associated name (i.e. the Node_Id associated with its name).
3026
3027 procedure Set_Debug_Info_Defining_Id (N : Node_Id);
3028 -- Call Set_Debug_Info_Needed on Defining_Identifier (N) if it comes
3029 -- from source.
3030
3031 procedure Set_Debug_Info_Needed (T : Entity_Id);
3032 -- Sets the Debug_Info_Needed flag on entity T , and also on any entities
3033 -- that are needed by T (for an object, the type of the object is needed,
3034 -- and for a type, various subsidiary types are needed -- see body for
3035 -- details). Never has any effect on T if the Debug_Info_Off flag is set.
3036 -- This routine should always be used instead of Set_Needs_Debug_Info to
3037 -- ensure that subsidiary entities are properly handled.
3038
3039 procedure Set_Entity_With_Checks (N : Node_Id; Val : Entity_Id);
3040 -- This procedure has the same calling sequence as Set_Entity, but it
3041 -- performs additional checks as follows:
3042 --
3043 -- If Style_Check is set, then it calls a style checking routine which
3044 -- can check identifier spelling style. This procedure also takes care
3045 -- of checking the restriction No_Implementation_Identifiers.
3046 --
3047 -- If restriction No_Abort_Statements is set, then it checks that the
3048 -- entity is not Ada.Task_Identification.Abort_Task.
3049 --
3050 -- If restriction No_Dynamic_Attachment is set, then it checks that the
3051 -- entity is not one of the restricted names for this restriction.
3052 --
3053 -- If restriction No_Long_Long_Integers is set, then it checks that the
3054 -- entity is not Standard.Long_Long_Integer.
3055 --
3056 -- If restriction No_Implementation_Identifiers is set, then it checks
3057 -- that the entity is not implementation defined.
3058
3059 procedure Set_Invalid_Scalar_Value
3060 (Scal_Typ : Float_Scalar_Id;
3061 Value : Ureal);
3062 -- Associate invalid value Value with scalar type Scal_Typ as specified by
3063 -- pragma Initialize_Scalars.
3064
3065 procedure Set_Invalid_Scalar_Value
3066 (Scal_Typ : Integer_Scalar_Id;
3067 Value : Uint);
3068 -- Associate invalid value Value with scalar type Scal_Typ as specified by
3069 -- pragma Initialize_Scalars.
3070
3071 procedure Set_Name_Entity_Id (Id : Name_Id; Val : Entity_Id);
3072 pragma Inline (Set_Name_Entity_Id);
3073 -- Sets the Entity_Id value associated with the given name, which is the
3074 -- Id of the innermost visible entity with the given name. See the body
3075 -- of package Sem_Ch8 for further details on the handling of visibility.
3076
3077 procedure Set_Next_Actual (Ass1_Id : Node_Id; Ass2_Id : Node_Id);
3078 -- The arguments may be parameter associations, whose descendants
3079 -- are the optional formal name and the actual parameter. Positional
3080 -- parameters are already members of a list, and do not need to be
3081 -- chained separately. See also First_Actual and Next_Actual.
3082
3083 procedure Set_Optimize_Alignment_Flags (E : Entity_Id);
3084 pragma Inline (Set_Optimize_Alignment_Flags);
3085 -- Sets Optimize_Alignment_Space/Time flags in E from current settings
3086
3087 procedure Set_Public_Status (Id : Entity_Id);
3088 -- If an entity (visible or otherwise) is defined in a library
3089 -- package, or a package that is itself public, then this subprogram
3090 -- labels the entity public as well.
3091
3092 procedure Set_Referenced_Modified (N : Node_Id; Out_Param : Boolean);
3093 -- N is the node for either a left hand side (Out_Param set to False),
3094 -- or an Out or In_Out parameter (Out_Param set to True). If there is
3095 -- an assignable entity being referenced, then the appropriate flag
3096 -- (Referenced_As_LHS if Out_Param is False, Referenced_As_Out_Parameter
3097 -- if Out_Param is True) is set True, and the other flag set False.
3098
3099 procedure Set_Rep_Info (T1 : Entity_Id; T2 : Entity_Id);
3100 pragma Inline (Set_Rep_Info);
3101 -- Copies the Is_Atomic, Is_Independent and Is_Volatile_Full_Access flags
3102 -- from sub(type) entity T2 to (sub)type entity T1, as well as Is_Volatile
3103 -- if T1 is a base type.
3104
3105 procedure Set_Scope_Is_Transient (V : Boolean := True);
3106 -- Set the flag Is_Transient of the current scope
3107
3108 procedure Set_Size_Info (T1, T2 : Entity_Id);
3109 pragma Inline (Set_Size_Info);
3110 -- Copies the Esize field and Has_Biased_Representation flag from sub(type)
3111 -- entity T2 to (sub)type entity T1. Also copies the Is_Unsigned_Type flag
3112 -- in the fixed-point and discrete cases, and also copies the alignment
3113 -- value from T2 to T1. It does NOT copy the RM_Size field, which must be
3114 -- separately set if this is required to be copied also.
3115
3116 procedure Set_SPARK_Mode (Context : Entity_Id);
3117 -- Establish the SPARK_Mode and SPARK_Mode_Pragma (if any) of a package or
3118 -- a subprogram denoted by Context. This routine must be used in tandem
3119 -- with Restore_SPARK_Mode.
3120
3121 function Scope_Is_Transient return Boolean;
3122 -- True if the current scope is transient
3123
3124 function Should_Ignore_Pragma_Par (Prag_Name : Name_Id) return Boolean;
3125 function Should_Ignore_Pragma_Sem (N : Node_Id) return Boolean;
3126 -- True if we should ignore pragmas with the specified name. In particular,
3127 -- this returns True if pragma Ignore_Pragma applies, and we are not in a
3128 -- predefined unit. The _Par version should be called only from the parser;
3129 -- the _Sem version should be called only during semantic analysis.
3130
3131 function Static_Boolean (N : Node_Id) return Uint;
3132 -- This function analyzes the given expression node and then resolves it
3133 -- as Standard.Boolean. If the result is static, then Uint_1 or Uint_0 is
3134 -- returned corresponding to the value, otherwise an error message is
3135 -- output and No_Uint is returned.
3136
3137 function Static_Integer (N : Node_Id) return Uint;
3138 -- This function analyzes the given expression node and then resolves it
3139 -- as any integer type. If the result is static, then the value of the
3140 -- universal expression is returned, otherwise an error message is output
3141 -- and a value of No_Uint is returned.
3142
3143 function Statically_Denotes_Entity (N : Node_Id) return Boolean;
3144 -- Return True iff N is a name that "statically denotes" an entity.
3145
3146 function Statically_Denotes_Object (N : Node_Id) return Boolean;
3147 -- Return True iff N is a name that "statically denotes" an object.
3148
3149 function Statically_Different (E1, E2 : Node_Id) return Boolean;
3150 -- Return True if it can be statically determined that the Expressions
3151 -- E1 and E2 refer to different objects
3152
3153 function Statically_Names_Object (N : Node_Id) return Boolean;
3154 -- Return True iff N is a name that "statically names" an object.
3155
3156 function String_From_Numeric_Literal (N : Node_Id) return String_Id;
3157 -- Return the string that corresponds to the numeric literal N as it
3158 -- appears in the source.
3159
3160 function Subject_To_Loop_Entry_Attributes (N : Node_Id) return Boolean;
3161 -- Determine whether node N is a loop statement subject to at least one
3162 -- 'Loop_Entry attribute.
3163
3164 function Subprogram_Access_Level (Subp : Entity_Id) return Uint;
3165 -- Return the accessibility level of the view denoted by Subp
3166
3167 function Support_Atomic_Primitives (Typ : Entity_Id) return Boolean;
3168 -- Return True if Typ supports the GCC built-in atomic operations (i.e. if
3169 -- Typ is properly sized and aligned).
3170
3171 procedure Trace_Scope (N : Node_Id; E : Entity_Id; Msg : String);
3172 -- Print debugging information on entry to each unit being analyzed
3173
3174 procedure Transfer_Entities (From : Entity_Id; To : Entity_Id);
3175 -- Move a list of entities from one scope to another, and recompute
3176 -- Is_Public based upon the new scope.
3177
3178 generic
3179 with function Process (N : Node_Id) return Traverse_Result is <>;
3180 Process_Itypes : Boolean := False;
3181 function Traverse_More_Func (Node : Node_Id) return Traverse_Final_Result;
3182 -- This is a version of Atree.Traverse_Func that not only traverses
3183 -- syntactic children of nodes, but also semantic children which are
3184 -- logically children of the node. This concerns currently lists of
3185 -- action nodes and ranges under Itypes, both inserted by the compiler.
3186 -- Itypes are only traversed when Process_Itypes is True.
3187
3188 generic
3189 with function Process (N : Node_Id) return Traverse_Result is <>;
3190 Process_Itypes : Boolean := False;
3191 procedure Traverse_More_Proc (Node : Node_Id);
3192 pragma Inline (Traverse_More_Proc);
3193 -- This is the same as Traverse_More_Func except that no result is
3194 -- returned, i.e. Traverse_More_Func is called and the result is simply
3195 -- discarded.
3196
3197 function Type_Access_Level (Typ : Entity_Id) return Uint;
3198 -- Return the accessibility level of Typ
3199
3200 function Type_Without_Stream_Operation
3201 (T : Entity_Id;
3202 Op : TSS_Name_Type := TSS_Null) return Entity_Id;
3203 -- AI05-0161: In Ada 2012, if the restriction No_Default_Stream_Attributes
3204 -- is active then we cannot generate stream subprograms for composite types
3205 -- with elementary subcomponents that lack user-defined stream subprograms.
3206 -- This predicate determines whether a type has such an elementary
3207 -- subcomponent. If Op is TSS_Null, a type that lacks either Read or Write
3208 -- prevents the construction of a composite stream operation. If Op is
3209 -- specified we check only for the given stream operation.
3210
3211 function Ultimate_Prefix (N : Node_Id) return Node_Id;
3212 -- Obtain the "outermost" prefix of arbitrary node N. Return N if no such
3213 -- prefix exists.
3214
3215 function Unique_Defining_Entity (N : Node_Id) return Entity_Id;
3216 -- Return the entity that represents declaration N, so that different
3217 -- views of the same entity have the same unique defining entity:
3218 -- * private view and full view of a deferred constant
3219 -- --> full view
3220 -- * entry spec and entry body
3221 -- --> entry spec
3222 -- * formal parameter on spec and body
3223 -- --> formal parameter on spec
3224 -- * package spec, body, and body stub
3225 -- --> package spec
3226 -- * protected type, protected body, and protected body stub
3227 -- --> protected type (full view if private)
3228 -- * subprogram spec, body, and body stub
3229 -- --> subprogram spec
3230 -- * task type, task body, and task body stub
3231 -- --> task type (full view if private)
3232 -- * private or incomplete view and full view of a type
3233 -- --> full view
3234 -- In other cases, return the defining entity for N.
3235
3236 function Unique_Entity (E : Entity_Id) return Entity_Id;
3237 -- Return the unique entity for entity E, which would be returned by
3238 -- Unique_Defining_Entity if applied to the enclosing declaration of E.
3239
3240 function Unique_Name (E : Entity_Id) return String;
3241 -- Return a unique name for entity E, which could be used to identify E
3242 -- across compilation units.
3243
3244 Child_Prefix : constant String := "ada___";
3245 -- Prefix for child packages when building a unique name for an entity. It
3246 -- is included here to share between Unique_Name and gnatprove.
3247
3248 function Unit_Is_Visible (U : Entity_Id) return Boolean;
3249 -- Determine whether a compilation unit is visible in the current context,
3250 -- because there is a with_clause that makes the unit available. Used to
3251 -- provide better messages on common visiblity errors on operators.
3252
3253 function Universal_Interpretation (Opnd : Node_Id) return Entity_Id;
3254 -- Yields Universal_Integer or Universal_Real if this is a candidate
3255
3256 function Unqualify (Expr : Node_Id) return Node_Id;
3257 pragma Inline (Unqualify);
3258 -- Removes any qualifications from Expr. For example, for T1'(T2'(X)), this
3259 -- returns X. If Expr is not a qualified expression, returns Expr.
3260
3261 function Unqual_Conv (Expr : Node_Id) return Node_Id;
3262 pragma Inline (Unqual_Conv);
3263 -- Similar to Unqualify, but removes qualified expressions, type
3264 -- conversions, and unchecked conversions.
3265
3266 function Validated_View (Typ : Entity_Id) return Entity_Id;
3267 -- Obtain the "validated view" of arbitrary type Typ which is suitable for
3268 -- verification by attributes 'Valid_Scalars. This view is the type itself
3269 -- or its full view while stripping away concurrency, derivations, and
3270 -- privacy.
3271
3272 function Visible_Ancestors (Typ : Entity_Id) return Elist_Id;
3273 -- [Ada 2012:AI-0125-1]: Collect all the visible parents and progenitors
3274 -- of a type extension or private extension declaration. If the full-view
3275 -- of private parents and progenitors is available then it is used to
3276 -- generate the list of visible ancestors; otherwise their partial
3277 -- view is added to the resulting list.
3278
3279 function Within_Init_Proc return Boolean;
3280 -- Determines if Current_Scope is within an init proc
3281
3282 function Within_Protected_Type (E : Entity_Id) return Boolean;
3283 -- Returns True if entity E is declared within a protected type
3284
3285 function Within_Scope (E : Entity_Id; S : Entity_Id) return Boolean;
3286 -- Returns True if entity E is declared within scope S
3287
3288 function Within_Subprogram_Call (N : Node_Id) return Boolean;
3289 -- Determine whether arbitrary node N appears in an entry, function, or
3290 -- procedure call.
3291
3292 procedure Wrong_Type (Expr : Node_Id; Expected_Type : Entity_Id);
3293 -- Output error message for incorrectly typed expression. Expr is the node
3294 -- for the incorrectly typed construct (Etype (Expr) is the type found),
3295 -- and Expected_Type is the entity for the expected type. Note that Expr
3296 -- does not have to be a subexpression, anything with an Etype field may
3297 -- be used.
3298
3299 function Yields_Synchronized_Object (Typ : Entity_Id) return Boolean;
3300 -- Determine whether type Typ "yields synchronized object" as specified by
3301 -- SPARK RM 9.1. To qualify as such, a type must be
3302 -- * An array type whose element type yields a synchronized object
3303 -- * A descendant of type Ada.Synchronous_Task_Control.Suspension_Object
3304 -- * A protected type
3305 -- * A record type or type extension without defaulted discriminants
3306 -- whose components are of a type that yields a synchronized object.
3307 -- * A synchronized interface type
3308 -- * A task type
3309
3310 function Yields_Universal_Type (N : Node_Id) return Boolean;
3311 -- Determine whether unanalyzed node N yields a universal type
3312
3313 procedure Preanalyze_Without_Errors (N : Node_Id);
3314 -- Preanalyze N without reporting errors
3315
3316 package Interval_Lists is
3317 type Discrete_Interval is
3318 record
3319 Low, High : Uint;
3320 end record;
3321
3322 type Discrete_Interval_List is
3323 array (Pos range <>) of Discrete_Interval;
3324 -- A sorted (in ascending order) list of non-empty pairwise-disjoint
3325 -- intervals, always with a gap of at least one value between
3326 -- successive intervals (i.e., mergeable intervals are merged).
3327 -- Low bound is one; high bound is nonnegative.
3328
3329 function Aggregate_Intervals (N : Node_Id) return Discrete_Interval_List;
3330 -- Given an array aggregate N, returns the (unique) interval list
3331 -- representing the values of the aggregate choices; if all the array
3332 -- components are covered by the others choice then the length of the
3333 -- result is zero.
3334
3335 function Choice_List_Intervals
3336 (Discrete_Choices : List_Id) return Discrete_Interval_List;
3337 -- Given a discrete choice list, returns the (unique) interval
3338 -- list representing the chosen values.
3339
3340 function Type_Intervals (Typ : Entity_Id) return Discrete_Interval_List;
3341 -- Given a static discrete type or subtype, returns the (unique)
3342 -- interval list representing the values of the type/subtype.
3343 -- If no static predicates are involved, the length of the result
3344 -- will be at most one.
3345
3346 function Is_Subset (Subset, Of_Set : Discrete_Interval_List)
3347 return Boolean;
3348 -- Returns True iff every value belonging to some interval of
3349 -- Subset also belongs to some interval of Of_Set.
3350
3351 -- TBD: When we get around to implementing "is statically compatible"
3352 -- correctly for real types with static predicates, we may need
3353 -- an analogous Real_Interval_List type. Most of the language
3354 -- rules that reference "is statically compatible" pertain to
3355 -- discriminants and therefore do not require support for real types;
3356 -- the exception is 12.5.1(8).
3357
3358 Intervals_Error : exception;
3359 -- Raised when the list of non-empty pair-wise disjoint intervals cannot
3360 -- be built.
3361 end Interval_Lists;
3362
3363 package Old_Attr_Util is
3364 -- Operations related to 'Old attribute evaluation. This
3365 -- includes cases where a level of indirection is needed due to
3366 -- conditional evaluation as well as support for the
3367 -- "known on entry" rules.
3368
3369 package Conditional_Evaluation is
3370 function Eligible_For_Conditional_Evaluation
3371 (Expr : Node_Id) return Boolean;
3372 -- Given a subexpression of a Postcondition expression
3373 -- (typically a 'Old attribute reference), returns True if
3374 -- - the expression is conditionally evaluated; and
3375 -- - its determining expressions are all known on entry; and
3376 -- - Ada_Version >= Ada_2020.
3377 -- See RM 6.1.1 for definitions of these terms.
3378 --
3379 -- Also returns True if Expr is of an anonymous access type;
3380 -- this is just because we want the code that knows how to build
3381 -- 'Old temps in that case to reside in only one place.
3382
3383 function Conditional_Evaluation_Condition
3384 (Expr : Node_Id) return Node_Id;
3385 -- Given an expression which is eligible for conditional evaluation,
3386 -- build a Boolean expression whose value indicates whether the
3387 -- expression should be evaluated.
3388 end Conditional_Evaluation;
3389
3390 package Indirect_Temps is
3391 generic
3392 with procedure Append_Item (N : Node_Id; Is_Eval_Stmt : Boolean);
3393 -- If Is_Eval_Stmt is True, then N is a statement that should
3394 -- only be executed in the case where the 'Old prefix is to be
3395 -- evaluated. If Is_Eval_Stmt is False, then N is a declaration
3396 -- which should be elaborated unconditionally.
3397 -- Client is responsible for ensuring that any appended
3398 -- Eval_Stmt nodes are eventually analyzed.
3399
3400 Append_Decls_In_Reverse_Order : Boolean := False;
3401 -- This parameter is for the convenience of exp_prag.adb, where we
3402 -- want to Prepend rather than Append so it is better to get the
3403 -- Append calls in reverse order.
3404
3405 procedure Declare_Indirect_Temp
3406 (Attr_Prefix : Node_Id; -- prefix of 'Old attribute (or similar?)
3407 Indirect_Temp : out Entity_Id);
3408 -- Indirect_Temp is of an access type; it is unconditionally
3409 -- declared but only conditionally initialized to reference the
3410 -- saved value of Attr_Prefix.
3411
3412 function Indirect_Temp_Needed (Typ : Entity_Id) return Boolean;
3413 -- Returns True for a specific tagged type because the temp must
3414 -- be of the class-wide type in order to preserve the underlying tag.
3415 --
3416 -- Also returns True in the case of an anonymous access type
3417 -- because we want the code that knows how to deal with
3418 -- this case to reside in only one place.
3419 --
3420 -- For an unconstrained-but-definite discriminated subtype, returns
3421 -- True if the potential difference in size between an
3422 -- unconstrained object and a constrained object is large.
3423 -- [This part is not implemented yet.]
3424 --
3425 -- Otherwise, returns False if a declaration of the form
3426 -- Temp : Typ;
3427 -- is legal and side-effect-free (assuming that default
3428 -- initialization is suppressed). For example, returns True if Typ is
3429 -- indefinite, or if Typ has a controlled part.
3430 --
3431
3432 function Indirect_Temp_Value
3433 (Temp : Entity_Id;
3434 Typ : Entity_Id;
3435 Loc : Source_Ptr) return Node_Id;
3436 -- Evaluate a temp declared by Declare_Indirect_Temp.
3437
3438 function Is_Access_Type_For_Indirect_Temp
3439 (T : Entity_Id) return Boolean;
3440 -- True for an access type that was declared via a call
3441 -- to Declare_Indirect_Temp.
3442 -- Indicates that the given access type should be treated
3443 -- the same with respect to finalization as a
3444 -- user-defined "comes from source" access type.
3445
3446 end Indirect_Temps;
3447 end Old_Attr_Util;
3448 end Sem_Util;
This page took 0.187803 seconds and 5 git commands to generate.