Update ChangeLog and version files for release
[official-gcc.git] / gcc / ada / sem_util.ads
blobb37402ac0e2a58ca2cf42b79a39a0be9c7bc2036
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-2015, 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 ------------------------------------------------------------------------------
26 -- Package containing utility procedures used throughout the semantics
28 with Einfo; use Einfo;
29 with Exp_Tss; use Exp_Tss;
30 with Namet; use Namet;
31 with Opt; use Opt;
32 with Snames; use Snames;
33 with Types; use Types;
34 with Uintp; use Uintp;
35 with Urealp; use Urealp;
37 package Sem_Util is
39 function Abstract_Interface_List (Typ : Entity_Id) return List_Id;
40 -- Given a type that implements interfaces look for its associated
41 -- definition node and return its list of interfaces.
43 procedure Add_Access_Type_To_Process (E : Entity_Id; A : Entity_Id);
44 -- Add A to the list of access types to process when expanding the
45 -- freeze node of E.
47 procedure Add_Block_Identifier (N : Node_Id; Id : out Entity_Id);
48 -- Given a block statement N, generate an internal E_Block label and make
49 -- it the identifier of the block. Id denotes the generated entity. If the
50 -- block already has an identifier, Id returns the entity of its label.
52 procedure Add_Global_Declaration (N : Node_Id);
53 -- These procedures adds a declaration N at the library level, to be
54 -- elaborated before any other code in the unit. It is used for example
55 -- for the entity that marks whether a unit has been elaborated. The
56 -- declaration is added to the Declarations list of the Aux_Decls_Node
57 -- for the current unit. The declarations are added in the current scope,
58 -- so the caller should push a new scope as required before the call.
60 function Add_Suffix (E : Entity_Id; Suffix : Character) return Name_Id;
61 -- Returns the name of E adding Suffix
63 function Address_Integer_Convert_OK (T1, T2 : Entity_Id) return Boolean;
64 -- Given two types, returns True if we are in Allow_Integer_Address mode
65 -- and one of the types is (a descendent of) System.Address (and this type
66 -- is private), and the other type is any integer type.
68 function Addressable (V : Uint) return Boolean;
69 function Addressable (V : Int) return Boolean;
70 pragma Inline (Addressable);
71 -- Returns True if the value of V is the word size or an addressable factor
72 -- of the word size (typically 8, 16, 32 or 64).
74 procedure Aggregate_Constraint_Checks
75 (Exp : Node_Id;
76 Check_Typ : Entity_Id);
77 -- Checks expression Exp against subtype Check_Typ. If Exp is an aggregate
78 -- and Check_Typ a constrained record type with discriminants, we generate
79 -- the appropriate discriminant checks. If Exp is an array aggregate then
80 -- emit the appropriate length checks. If Exp is a scalar type, or a string
81 -- literal, Exp is changed into Check_Typ'(Exp) to ensure that range checks
82 -- are performed at run time. Also used for expressions in the argument of
83 -- 'Update, which shares some of the features of an aggregate.
85 function Alignment_In_Bits (E : Entity_Id) return Uint;
86 -- If the alignment of the type or object E is currently known to the
87 -- compiler, then this function returns the alignment value in bits.
88 -- Otherwise Uint_0 is returned, indicating that the alignment of the
89 -- entity is not yet known to the compiler.
91 function All_Composite_Constraints_Static (Constr : Node_Id) return Boolean;
92 -- Used to implement pragma Restrictions (No_Dynamic_Sized_Objects).
93 -- Given a constraint or subtree of a constraint on a composite
94 -- subtype/object, returns True if there are no nonstatic constraints,
95 -- which might cause objects to be created with dynamic size.
96 -- Called for subtype declarations (including implicit ones created for
97 -- subtype indications in object declarations, as well as discriminated
98 -- record aggregate cases). For record aggregates, only records containing
99 -- discriminant-dependent arrays matter, because the discriminants must be
100 -- static when governing a variant part. Access discriminants are
101 -- irrelevant. Also called for array aggregates, but only named notation,
102 -- because those are the only dynamic cases.
104 procedure Append_Inherited_Subprogram (S : Entity_Id);
105 -- If the parent of the operation is declared in the visible part of
106 -- the current scope, the inherited operation is visible even though the
107 -- derived type that inherits the operation may be completed in the private
108 -- part of the current package.
110 procedure Apply_Compile_Time_Constraint_Error
111 (N : Node_Id;
112 Msg : String;
113 Reason : RT_Exception_Code;
114 Ent : Entity_Id := Empty;
115 Typ : Entity_Id := Empty;
116 Loc : Source_Ptr := No_Location;
117 Rep : Boolean := True;
118 Warn : Boolean := False);
119 -- N is a subexpression which will raise constraint error when evaluated
120 -- at runtime. Msg is a message that explains the reason for raising the
121 -- exception. The last character is ? if the message is always a warning,
122 -- even in Ada 95, and is not a ? if the message represents an illegality
123 -- (because of violation of static expression rules) in Ada 95 (but not
124 -- in Ada 83). Typically this routine posts all messages at the Sloc of
125 -- node N. However, if Loc /= No_Location, Loc is the Sloc used to output
126 -- the message. After posting the appropriate message, and if the flag
127 -- Rep is set, this routine replaces the expression with an appropriate
128 -- N_Raise_Constraint_Error node using the given Reason code. This node
129 -- is then marked as being static if the original node is static, but
130 -- sets the flag Raises_Constraint_Error, preventing further evaluation.
131 -- The error message may contain a } or & insertion character. This
132 -- normally references Etype (N), unless the Ent argument is given
133 -- explicitly, in which case it is used instead. The type of the raise
134 -- node that is built is normally Etype (N), but if the Typ parameter
135 -- is present, this is used instead. Warn is normally False. If it is
136 -- True then the message is treated as a warning even though it does
137 -- not end with a ? (this is used when the caller wants to parameterize
138 -- whether an error or warning is given).
140 function Async_Readers_Enabled (Id : Entity_Id) return Boolean;
141 -- Given the entity of an abstract state or a variable, determine whether
142 -- Id is subject to external property Async_Readers and if it is, the
143 -- related expression evaluates to True.
145 function Async_Writers_Enabled (Id : Entity_Id) return Boolean;
146 -- Given the entity of an abstract state or a variable, determine whether
147 -- Id is subject to external property Async_Writers and if it is, the
148 -- related expression evaluates to True.
150 function Available_Full_View_Of_Component (T : Entity_Id) return Boolean;
151 -- If at the point of declaration an array type has a private or limited
152 -- component, several array operations are not avaiable on the type, and
153 -- the array type is flagged accordingly. If in the immediate scope of
154 -- the array type the component becomes non-private or non-limited, these
155 -- operations become avaiable. This can happen if the scopes of both types
156 -- are open, and the scope of the array is not outside the scope of the
157 -- component.
159 procedure Bad_Attribute
160 (N : Node_Id;
161 Nam : Name_Id;
162 Warn : Boolean := False);
163 -- Called when node N is expected to contain a valid attribute name, and
164 -- Nam is found instead. If Warn is set True this is a warning, else this
165 -- is an error.
167 procedure Bad_Predicated_Subtype_Use
168 (Msg : String;
169 N : Node_Id;
170 Typ : Entity_Id;
171 Suggest_Static : Boolean := False);
172 -- This is called when Typ, a predicated subtype, is used in a context
173 -- which does not allow the use of a predicated subtype. Msg is passed to
174 -- Error_Msg_FE to output an appropriate message using N as the location,
175 -- and Typ as the entity. The caller must set up any insertions other than
176 -- the & for the type itself. Note that if Typ is a generic actual type,
177 -- then the message will be output as a warning, and a raise Program_Error
178 -- is inserted using Insert_Action with node N as the insertion point. Node
179 -- N also supplies the source location for construction of the raise node.
180 -- If Typ does not have any predicates, the call has no effect. Set flag
181 -- Suggest_Static when the context warrants an advice on how to avoid the
182 -- use error.
184 function Bad_Unordered_Enumeration_Reference
185 (N : Node_Id;
186 T : Entity_Id) return Boolean;
187 -- Node N contains a potentially dubious reference to type T, either an
188 -- explicit comparison, or an explicit range. This function returns True
189 -- if the type T is an enumeration type for which No pragma Order has been
190 -- given, and the reference N is not in the same extended source unit as
191 -- the declaration of T.
193 function Build_Actual_Subtype
194 (T : Entity_Id;
195 N : Node_Or_Entity_Id) return Node_Id;
196 -- Build an anonymous subtype for an entity or expression, using the
197 -- bounds of the entity or the discriminants of the enclosing record.
198 -- T is the type for which the actual subtype is required, and N is either
199 -- a defining identifier, or any subexpression.
201 function Build_Actual_Subtype_Of_Component
202 (T : Entity_Id;
203 N : Node_Id) return Node_Id;
204 -- Determine whether a selected component has a type that depends on
205 -- discriminants, and build actual subtype for it if so.
207 function Build_Default_Init_Cond_Call
208 (Loc : Source_Ptr;
209 Obj_Id : Entity_Id;
210 Typ : Entity_Id) return Node_Id;
211 -- Build a call to the default initial condition procedure of type Typ with
212 -- Obj_Id as the actual parameter.
214 procedure Build_Default_Init_Cond_Procedure_Bodies (Priv_Decls : List_Id);
215 -- Inspect the contents of private declarations Priv_Decls and build the
216 -- bodies the default initial condition procedures for all types subject
217 -- to pragma Default_Initial_Condition.
219 procedure Build_Default_Init_Cond_Procedure_Declaration (Typ : Entity_Id);
220 -- If private type Typ is subject to pragma Default_Initial_Condition,
221 -- build the declaration of the procedure which verifies the assumption
222 -- of the pragma at runtime. The declaration is inserted after the related
223 -- pragma.
225 function Build_Default_Subtype
226 (T : Entity_Id;
227 N : Node_Id) return Entity_Id;
228 -- If T is an unconstrained type with defaulted discriminants, build a
229 -- subtype constrained by the default values, insert the subtype
230 -- declaration in the tree before N, and return the entity of that
231 -- subtype. Otherwise, simply return T.
233 function Build_Discriminal_Subtype_Of_Component
234 (T : Entity_Id) return Node_Id;
235 -- Determine whether a record component has a type that depends on
236 -- discriminants, and build actual subtype for it if so.
238 procedure Build_Elaboration_Entity (N : Node_Id; Spec_Id : Entity_Id);
239 -- Given a compilation unit node N, allocate an elaboration counter for
240 -- the compilation unit, and install it in the Elaboration_Entity field
241 -- of Spec_Id, the entity for the compilation unit.
243 procedure Build_Explicit_Dereference
244 (Expr : Node_Id;
245 Disc : Entity_Id);
246 -- AI05-139: Names with implicit dereference. If the expression N is a
247 -- reference type and the context imposes the corresponding designated
248 -- type, convert N into N.Disc.all. Such expressions are always over-
249 -- loaded with both interpretations, and the dereference interpretation
250 -- carries the name of the reference discriminant.
252 function Cannot_Raise_Constraint_Error (Expr : Node_Id) return Boolean;
253 -- Returns True if the expression cannot possibly raise Constraint_Error.
254 -- The response is conservative in the sense that a result of False does
255 -- not necessarily mean that CE could be raised, but a response of True
256 -- means that for sure CE cannot be raised.
258 procedure Check_Part_Of_Reference (Var_Id : Entity_Id; Ref : Node_Id);
259 -- Verify the legality of reference Ref to variable Var_Id when the
260 -- variable is a constituent of a single protected/task type.
262 procedure Check_Dynamically_Tagged_Expression
263 (Expr : Node_Id;
264 Typ : Entity_Id;
265 Related_Nod : Node_Id);
266 -- Check wrong use of dynamically tagged expression
268 procedure Check_Fully_Declared (T : Entity_Id; N : Node_Id);
269 -- Verify that the full declaration of type T has been seen. If not, place
270 -- error message on node N. Used in object declarations, type conversions
271 -- and qualified expressions.
273 procedure Check_Function_With_Address_Parameter (Subp_Id : Entity_Id);
274 -- A subprogram that has an Address parameter and is declared in a Pure
275 -- package is not considered Pure, because the parameter may be used as a
276 -- pointer and the referenced data may change even if the address value
277 -- itself does not.
278 -- If the programmer gave an explicit Pure_Function pragma, then we respect
279 -- the pragma and leave the subprogram Pure.
281 procedure Check_Function_Writable_Actuals (N : Node_Id);
282 -- (Ada 2012): If the construct N has two or more direct constituents that
283 -- are names or expressions whose evaluation may occur in an arbitrary
284 -- order, at least one of which contains a function call with an in out or
285 -- out parameter, then the construct is legal only if: for each name that
286 -- is passed as a parameter of mode in out or out to some inner function
287 -- call C2 (not including the construct N itself), there is no other name
288 -- anywhere within a direct constituent of the construct C other than
289 -- the one containing C2, that is known to refer to the same object (RM
290 -- 6.4.1(6.17/3)).
292 procedure Check_Implicit_Dereference (N : Node_Id; Typ : Entity_Id);
293 -- AI05-139-2: Accessors and iterators for containers. This procedure
294 -- checks whether T is a reference type, and if so it adds an interprettion
295 -- to N whose type is the designated type of the reference_discriminant.
296 -- If N is a generalized indexing operation, the interpretation is added
297 -- both to the corresponding function call, and to the indexing node.
299 procedure Check_Internal_Protected_Use (N : Node_Id; Nam : Entity_Id);
300 -- Within a protected function, the current object is a constant, and
301 -- internal calls to a procedure or entry are illegal. Similarly, other
302 -- uses of a protected procedure in a renaming or a generic instantiation
303 -- in the context of a protected function are illegal (AI05-0225).
305 procedure Check_Later_Vs_Basic_Declarations
306 (Decls : List_Id;
307 During_Parsing : Boolean);
308 -- If During_Parsing is True, check for misplacement of later vs basic
309 -- declarations in Ada 83. If During_Parsing is False, and the SPARK
310 -- restriction is set, do the same: although SPARK 95 removes the
311 -- distinction between initial and later declarative items, the distinction
312 -- remains in the Examiner (JB01-005). Note that the Examiner does not
313 -- count package declarations in later declarative items.
315 procedure Check_No_Hidden_State (Id : Entity_Id);
316 -- Determine whether object or state Id introduces a hidden state. If this
317 -- is the case, emit an error.
319 procedure Check_Nonvolatile_Function_Profile (Func_Id : Entity_Id);
320 -- Verify that the profile of nonvolatile function Func_Id does not contain
321 -- effectively volatile parameters or return type.
323 procedure Check_Potentially_Blocking_Operation (N : Node_Id);
324 -- N is one of the statement forms that is a potentially blocking
325 -- operation. If it appears within a protected action, emit warning.
327 procedure Check_Result_And_Post_State (Subp_Id : Entity_Id);
328 -- Determine whether the contract of subprogram Subp_Id mentions attribute
329 -- 'Result and it contains an expression that evaluates differently in pre-
330 -- and post-state.
332 procedure Check_Unused_Body_States (Body_Id : Entity_Id);
333 -- Verify that all abstract states and objects declared in the state space
334 -- of package body Body_Id are used as constituents. Emit an error if this
335 -- is not the case.
337 procedure Check_Unprotected_Access
338 (Context : Node_Id;
339 Expr : Node_Id);
340 -- Check whether the expression is a pointer to a protected component,
341 -- and the context is external to the protected operation, to warn against
342 -- a possible unlocked access to data.
344 function Collect_Body_States (Body_Id : Entity_Id) return Elist_Id;
345 -- Gather the entities of all abstract states and objects declared in the
346 -- body state space of package body Body_Id.
348 procedure Collect_Interfaces
349 (T : Entity_Id;
350 Ifaces_List : out Elist_Id;
351 Exclude_Parents : Boolean := False;
352 Use_Full_View : Boolean := True);
353 -- Ada 2005 (AI-251): Collect whole list of abstract interfaces that are
354 -- directly or indirectly implemented by T. Exclude_Parents is used to
355 -- avoid the addition of inherited interfaces to the generated list.
356 -- Use_Full_View is used to collect the interfaces using the full-view
357 -- (if available).
359 procedure Collect_Interface_Components
360 (Tagged_Type : Entity_Id;
361 Components_List : out Elist_Id);
362 -- Ada 2005 (AI-251): Collect all the tag components associated with the
363 -- secondary dispatch tables of a tagged type.
365 procedure Collect_Interfaces_Info
366 (T : Entity_Id;
367 Ifaces_List : out Elist_Id;
368 Components_List : out Elist_Id;
369 Tags_List : out Elist_Id);
370 -- Ada 2005 (AI-251): Collect all the interfaces associated with T plus
371 -- the record component and tag associated with each of these interfaces.
372 -- On exit Ifaces_List, Components_List and Tags_List have the same number
373 -- of elements, and elements at the same position on these tables provide
374 -- information on the same interface type.
376 procedure Collect_Parents
377 (T : Entity_Id;
378 List : out Elist_Id;
379 Use_Full_View : Boolean := True);
380 -- Collect all the parents of Typ. Use_Full_View is used to collect them
381 -- using the full-view of private parents (if available).
383 function Collect_Primitive_Operations (T : Entity_Id) return Elist_Id;
384 -- Called upon type derivation and extension. We scan the declarative part
385 -- in which the type appears, and collect subprograms that have one
386 -- subsidiary subtype of the type. These subprograms can only appear after
387 -- the type itself.
389 function Compile_Time_Constraint_Error
390 (N : Node_Id;
391 Msg : String;
392 Ent : Entity_Id := Empty;
393 Loc : Source_Ptr := No_Location;
394 Warn : Boolean := False) return Node_Id;
395 -- This is similar to Apply_Compile_Time_Constraint_Error in that it
396 -- generates a warning (or error) message in the same manner, but it does
397 -- not replace any nodes. For convenience, the function always returns its
398 -- first argument. The message is a warning if the message ends with ?, or
399 -- we are operating in Ada 83 mode, or the Warn parameter is set to True.
401 procedure Conditional_Delay (New_Ent, Old_Ent : Entity_Id);
402 -- Sets the Has_Delayed_Freeze flag of New if the Delayed_Freeze flag of
403 -- Old is set and Old has no yet been Frozen (i.e. Is_Frozen is false).
405 function Contains_Refined_State (Prag : Node_Id) return Boolean;
406 -- Determine whether pragma Prag contains a reference to the entity of an
407 -- abstract state with a visible refinement. Prag must denote one of the
408 -- following pragmas:
409 -- Depends
410 -- Global
412 function Copy_Component_List
413 (R_Typ : Entity_Id;
414 Loc : Source_Ptr) return List_Id;
415 -- Copy components from record type R_Typ that come from source. Used to
416 -- create a new compatible record type. Loc is the source location assigned
417 -- to the created nodes.
419 function Copy_Parameter_List (Subp_Id : Entity_Id) return List_Id;
420 -- Utility to create a parameter profile for a new subprogram spec, when
421 -- the subprogram has a body that acts as spec. This is done for some cases
422 -- of inlining, and for private protected ops. Also used to create bodies
423 -- for stubbed subprograms.
425 function Copy_Subprogram_Spec (Spec : Node_Id) return Node_Id;
426 -- Replicate a function or a procedure specification denoted by Spec. The
427 -- resulting tree is an exact duplicate of the original tree. New entities
428 -- are created for the unit name and the formal parameters.
430 function Corresponding_Generic_Type (T : Entity_Id) return Entity_Id;
431 -- If a type is a generic actual type, return the corresponding formal in
432 -- the generic parent unit. There is no direct link in the tree for this
433 -- attribute, except in the case of formal private and derived types.
434 -- Possible optimization???
436 function Current_Entity (N : Node_Id) return Entity_Id;
437 pragma Inline (Current_Entity);
438 -- Find the currently visible definition for a given identifier, that is to
439 -- say the first entry in the visibility chain for the Chars of N.
441 function Current_Entity_In_Scope (N : Node_Id) return Entity_Id;
442 -- Find whether there is a previous definition for identifier N in the
443 -- current scope. Because declarations for a scope are not necessarily
444 -- contiguous (e.g. for packages) the first entry on the visibility chain
445 -- for N is not necessarily in the current scope.
447 function Current_Scope return Entity_Id;
448 -- Get entity representing current scope
450 function Current_Subprogram return Entity_Id;
451 -- Returns current enclosing subprogram. If Current_Scope is a subprogram,
452 -- then that is what is returned, otherwise the Enclosing_Subprogram of the
453 -- Current_Scope is returned. The returned value is Empty if this is called
454 -- from a library package which is not within any subprogram.
456 function Deepest_Type_Access_Level (Typ : Entity_Id) return Uint;
457 -- Same as Type_Access_Level, except that if the type is the type of an Ada
458 -- 2012 stand-alone object of an anonymous access type, then return the
459 -- static accesssibility level of the object. In that case, the dynamic
460 -- accessibility level of the object may take on values in a range. The low
461 -- bound of that range is returned by Type_Access_Level; this function
462 -- yields the high bound of that range. Also differs from Type_Access_Level
463 -- in the case of a descendant of a generic formal type (returns Int'Last
464 -- instead of 0).
466 function Defining_Entity
467 (N : Node_Id;
468 Empty_On_Errors : Boolean := False) return Entity_Id;
469 -- Given a declaration N, returns the associated defining entity. If the
470 -- declaration has a specification, the entity is obtained from the
471 -- specification. If the declaration has a defining unit name, then the
472 -- defining entity is obtained from the defining unit name ignoring any
473 -- child unit prefixes.
475 -- Iterator loops also have a defining entity, which holds the list of
476 -- local entities declared during loop expansion. These entities need
477 -- debugging information, generated through Qualify_Entity_Names, and
478 -- the loop declaration must be placed in the table Name_Qualify_Units.
480 -- Set flag Empty_On_Error to change the behavior of this routine as
481 -- follows:
483 -- * True - A declaration that lacks a defining entity returns Empty.
484 -- A node that does not allow for a defining entity returns Empty.
486 -- * False - A declaration that lacks a defining entity is given a new
487 -- internally generated entity which is subsequently returned. A node
488 -- that does not allow for a defining entity raises Program_Error.
490 -- The former semantics is appropriate for the back end; the latter
491 -- semantics is appropriate for the front end.
493 function Denotes_Discriminant
494 (N : Node_Id;
495 Check_Concurrent : Boolean := False) return Boolean;
496 -- Returns True if node N is an Entity_Name node for a discriminant. If the
497 -- flag Check_Concurrent is true, function also returns true when N denotes
498 -- the discriminal of the discriminant of a concurrent type. This is needed
499 -- to disable some optimizations on private components of protected types,
500 -- and constraint checks on entry families constrained by discriminants.
502 function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean;
503 -- Detect suspicious overlapping between actuals in a call, when both are
504 -- writable (RM 2012 6.4.1(6.4/3))
506 function Denotes_Same_Prefix (A1, A2 : Node_Id) return Boolean;
507 -- Functions to detect suspicious overlapping between actuals in a call,
508 -- when one of them is writable. The predicates are those proposed in
509 -- AI05-0144, to detect dangerous order dependence in complex calls.
510 -- I would add a parameter Warn which enables more extensive testing of
511 -- cases as we find appropriate when we are only warning ??? Or perhaps
512 -- return an indication of (Error, Warn, OK) ???
514 function Denotes_Variable (N : Node_Id) return Boolean;
515 -- Returns True if node N denotes a single variable without parentheses
517 function Depends_On_Discriminant (N : Node_Id) return Boolean;
518 -- Returns True if N denotes a discriminant or if N is a range, a subtype
519 -- indication or a scalar subtype where one of the bounds is a
520 -- discriminant.
522 function Designate_Same_Unit
523 (Name1 : Node_Id;
524 Name2 : Node_Id) return Boolean;
525 -- Returns True if Name1 and Name2 designate the same unit name; each of
526 -- these names is supposed to be a selected component name, an expanded
527 -- name, a defining program unit name or an identifier.
529 function Dynamic_Accessibility_Level (Expr : Node_Id) return Node_Id;
530 -- Expr should be an expression of an access type. Builds an integer
531 -- literal except in cases involving anonymous access types where
532 -- accessibility levels are tracked at runtime (access parameters and Ada
533 -- 2012 stand-alone objects).
535 function Effective_Extra_Accessibility (Id : Entity_Id) return Entity_Id;
536 -- Same as Einfo.Extra_Accessibility except thtat object renames
537 -- are looked through.
539 function Effective_Reads_Enabled (Id : Entity_Id) return Boolean;
540 -- Given the entity of an abstract state or a variable, determine whether
541 -- Id is subject to external property Effective_Reads and if it is, the
542 -- related expression evaluates to True.
544 function Effective_Writes_Enabled (Id : Entity_Id) return Boolean;
545 -- Given the entity of an abstract state or a variable, determine whether
546 -- Id is subject to external property Effective_Writes and if it is, the
547 -- related expression evaluates to True.
549 function Enclosing_Comp_Unit_Node (N : Node_Id) return Node_Id;
550 -- Returns the enclosing N_Compilation_Unit node that is the root of a
551 -- subtree containing N.
553 function Enclosing_CPP_Parent (Typ : Entity_Id) return Entity_Id;
554 -- Returns the closest ancestor of Typ that is a CPP type.
556 function Enclosing_Declaration (N : Node_Id) return Node_Id;
557 -- Returns the declaration node enclosing N (including possibly N itself),
558 -- if any, or Empty otherwise.
560 function Enclosing_Generic_Body
561 (N : Node_Id) return Node_Id;
562 -- Returns the Node_Id associated with the innermost enclosing generic
563 -- body, if any. If none, then returns Empty.
565 function Enclosing_Generic_Unit
566 (N : Node_Id) return Node_Id;
567 -- Returns the Node_Id associated with the innermost enclosing generic
568 -- unit, if any. If none, then returns Empty.
570 function Enclosing_Lib_Unit_Entity
571 (E : Entity_Id := Current_Scope) return Entity_Id;
572 -- Returns the entity of enclosing library unit node which is the root of
573 -- the current scope (which must not be Standard_Standard, and the caller
574 -- is responsible for ensuring this condition) or other specified entity.
576 function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id;
577 -- Returns the N_Compilation_Unit node of the library unit that is directly
578 -- or indirectly (through a subunit) at the root of a subtree containing
579 -- N. This may be either the same as Enclosing_Comp_Unit_Node, or if
580 -- Enclosing_Comp_Unit_Node returns a subunit, then the corresponding
581 -- library unit. If no such item is found, returns Empty.
583 function Enclosing_Package (E : Entity_Id) return Entity_Id;
584 -- Utility function to return the Ada entity of the package enclosing
585 -- the entity E, if any. Returns Empty if no enclosing package.
587 function Enclosing_Package_Or_Subprogram (E : Entity_Id) return Entity_Id;
588 -- Returns the entity of the package or subprogram enclosing E, if any.
589 -- Returns Empty if no enclosing package or subprogram.
591 function Enclosing_Subprogram (E : Entity_Id) return Entity_Id;
592 -- Utility function to return the Ada entity of the subprogram enclosing
593 -- the entity E, if any. Returns Empty if no enclosing subprogram.
595 procedure Ensure_Freeze_Node (E : Entity_Id);
596 -- Make sure a freeze node is allocated for entity E. If necessary, build
597 -- and initialize a new freeze node and set Has_Delayed_Freeze True for E.
599 procedure Enter_Name (Def_Id : Entity_Id);
600 -- Insert new name in symbol table of current scope with check for
601 -- duplications (error message is issued if a conflict is found).
602 -- Note: Enter_Name is not used for overloadable entities, instead these
603 -- are entered using Sem_Ch6.Enter_Overloadable_Entity.
605 function Entity_Of (N : Node_Id) return Entity_Id;
606 -- Return the entity of N or Empty. If N is a renaming, return the entity
607 -- of the root renamed object.
609 procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id);
610 -- This procedure is called after issuing a message complaining about an
611 -- inappropriate use of limited type T. If useful, it adds additional
612 -- continuation lines to the message explaining why type T is limited.
613 -- Messages are placed at node N.
615 type Extensions_Visible_Mode is
616 (Extensions_Visible_None,
617 -- Extensions_Visible does not yield a mode when SPARK_Mode is off. This
618 -- value acts as a default in a non-SPARK compilation.
620 Extensions_Visible_False,
621 -- A value of "False" signifies that Extensions_Visible is either
622 -- missing or the pragma is present and the value of its Boolean
623 -- expression is False.
625 Extensions_Visible_True);
626 -- A value of "True" signifies that Extensions_Visible is present and
627 -- the value of its Boolean expression is True.
629 function Extensions_Visible_Status
630 (Id : Entity_Id) return Extensions_Visible_Mode;
631 -- Given the entity of a subprogram or formal parameter subject to pragma
632 -- Extensions_Visible, return the Boolean value denoted by the expression
633 -- of the pragma.
635 procedure Find_Actual
636 (N : Node_Id;
637 Formal : out Entity_Id;
638 Call : out Node_Id);
639 -- Determines if the node N is an actual parameter of a function or a
640 -- procedure call. If so, then Formal points to the entity for the formal
641 -- (Ekind is E_In_Parameter, E_Out_Parameter, or E_In_Out_Parameter) and
642 -- Call is set to the node for the corresponding call. If the node N is not
643 -- an actual parameter then Formal and Call are set to Empty.
645 function Find_Specific_Type (CW : Entity_Id) return Entity_Id;
646 -- Find specific type of a class-wide type, and handle the case of an
647 -- incomplete type coming either from a limited_with clause or from an
648 -- incomplete type declaration. If resulting type is private return its
649 -- full view.
651 function Find_Body_Discriminal
652 (Spec_Discriminant : Entity_Id) return Entity_Id;
653 -- Given a discriminant of the record type that implements a task or
654 -- protected type, return the discriminal of the corresponding discriminant
655 -- of the actual concurrent type.
657 function Find_Corresponding_Discriminant
658 (Id : Node_Id;
659 Typ : Entity_Id) return Entity_Id;
660 -- Because discriminants may have different names in a generic unit and in
661 -- an instance, they are resolved positionally when possible. A reference
662 -- to a discriminant carries the discriminant that it denotes when it is
663 -- analyzed. Subsequent uses of this id on a different type denotes the
664 -- discriminant at the same position in this new type.
666 function Find_Enclosing_Iterator_Loop (Id : Entity_Id) return Entity_Id;
667 -- Given an arbitrary entity, try to find the nearest enclosing iterator
668 -- loop. If such a loop is found, return the entity of its identifier (the
669 -- E_Loop scope), otherwise return Empty.
671 function Find_Loop_In_Conditional_Block (N : Node_Id) return Node_Id;
672 -- Find the nested loop statement in a conditional block. Loops subject to
673 -- attribute 'Loop_Entry are transformed into blocks. Parts of the original
674 -- loop are nested within the block.
676 procedure Find_Overlaid_Entity
677 (N : Node_Id;
678 Ent : out Entity_Id;
679 Off : out Boolean);
680 -- The node N should be an address representation clause. Determines if
681 -- the target expression is the address of an entity with an optional
682 -- offset. If so, set Ent to the entity and, if there is an offset, set
683 -- Off to True, otherwise to False. If N is not an address representation
684 -- clause, or if it is not possible to determine that the address is of
685 -- this form, then set Ent to Empty.
687 function Find_Parameter_Type (Param : Node_Id) return Entity_Id;
688 -- Return the type of formal parameter Param as determined by its
689 -- specification.
691 -- The following type describes the placement of an arbitrary entity with
692 -- respect to SPARK visible / hidden state space.
694 type State_Space_Kind is
695 (Not_In_Package,
696 -- An entity is not in the visible, private or body state space when
697 -- the immediate enclosing construct is not a package.
699 Visible_State_Space,
700 -- An entity is in the visible state space when it appears immediately
701 -- within the visible declarations of a package or when it appears in
702 -- the visible state space of a nested package which in turn is declared
703 -- in the visible declarations of an enclosing package:
705 -- package Pack is
706 -- Visible_Variable : ...
707 -- package Nested
708 -- with Abstract_State => Visible_State
709 -- is
710 -- Visible_Nested_Variable : ...
711 -- end Nested;
712 -- end Pack;
714 -- Entities associated with a package instantiation inherit the state
715 -- space from the instance placement:
717 -- generic
718 -- package Gen is
719 -- Generic_Variable : ...
720 -- end Gen;
722 -- with Gen;
723 -- package Pack is
724 -- package Inst is new Gen;
725 -- -- Generic_Variable is in the visible state space of Pack
726 -- end Pack;
728 Private_State_Space,
729 -- An entity is in the private state space when it appears immediately
730 -- within the private declarations of a package or when it appears in
731 -- the visible state space of a nested package which in turn is declared
732 -- in the private declarations of an enclosing package:
734 -- package Pack is
735 -- private
736 -- Private_Variable : ...
737 -- package Nested
738 -- with Abstract_State => Private_State
739 -- is
740 -- Private_Nested_Variable : ...
741 -- end Nested;
742 -- end Pack;
744 -- The same placement principle applies to package instantiations
746 Body_State_Space);
747 -- An entity is in the body state space when it appears immediately
748 -- within the declarations of a package body or when it appears in the
749 -- visible state space of a nested package which in turn is declared in
750 -- the declarations of an enclosing package body:
752 -- package body Pack is
753 -- Body_Variable : ...
754 -- package Nested
755 -- with Abstract_State => Body_State
756 -- is
757 -- Body_Nested_Variable : ...
758 -- end Nested;
759 -- end Pack;
761 -- The same placement principle applies to package instantiations
763 procedure Find_Placement_In_State_Space
764 (Item_Id : Entity_Id;
765 Placement : out State_Space_Kind;
766 Pack_Id : out Entity_Id);
767 -- Determine the state space placement of an item. Item_Id denotes the
768 -- entity of an abstract state, object or package instantiation. Placement
769 -- captures the precise placement of the item in the enclosing state space.
770 -- If the state space is that of a package, Pack_Id denotes its entity,
771 -- otherwise Pack_Id is Empty.
773 function Find_Static_Alternative (N : Node_Id) return Node_Id;
774 -- N is a case statement whose expression is a compile-time value.
775 -- Determine the alternative chosen, so that the code of non-selected
776 -- alternatives, and the warnings that may apply to them, are removed.
778 function First_Actual (Node : Node_Id) return Node_Id;
779 -- Node is an N_Function_Call, N_Procedure_Call_Statement or
780 -- N_Entry_Call_Statement node. The result returned is the first actual
781 -- parameter in declaration order (not the order of parameters as they
782 -- appeared in the source, which can be quite different as a result of the
783 -- use of named parameters). Empty is returned for a call with no
784 -- parameters. The procedure for iterating through the actuals in
785 -- declaration order is to use this function to find the first actual, and
786 -- then use Next_Actual to obtain the next actual in declaration order.
787 -- Note that the value returned is always the expression (not the
788 -- N_Parameter_Association nodes, even if named association is used).
790 function Fix_Msg (Id : Entity_Id; Msg : String) return String;
791 -- Replace all occurrences of a particular word in string Msg depending on
792 -- the Ekind of Id as follows:
793 -- * Replace "subprogram" with
794 -- - "entry" when Id is an entry [family]
795 -- - "task type" when Id is a single task object, task type or task
796 -- body.
797 -- * Replace "protected" with
798 -- - "task" when Id is a single task object, task type or task body
799 -- All other non-matching words remain as is
801 procedure Gather_Components
802 (Typ : Entity_Id;
803 Comp_List : Node_Id;
804 Governed_By : List_Id;
805 Into : Elist_Id;
806 Report_Errors : out Boolean);
807 -- The purpose of this procedure is to gather the valid components in a
808 -- record type according to the values of its discriminants, in order to
809 -- validate the components of a record aggregate.
811 -- Typ is the type of the aggregate when its constrained discriminants
812 -- need to be collected, otherwise it is Empty.
814 -- Comp_List is an N_Component_List node.
816 -- Governed_By is a list of N_Component_Association nodes, where each
817 -- choice list contains the name of a discriminant and the expression
818 -- field gives its value. The values of the discriminants governing
819 -- the (possibly nested) variant parts in Comp_List are found in this
820 -- Component_Association List.
822 -- Into is the list where the valid components are appended. Note that
823 -- Into need not be an Empty list. If it's not, components are attached
824 -- to its tail.
826 -- Report_Errors is set to True if the values of the discriminants are
827 -- non-static.
829 -- This procedure is also used when building a record subtype. If the
830 -- discriminant constraint of the subtype is static, the components of the
831 -- subtype are only those of the variants selected by the values of the
832 -- discriminants. Otherwise all components of the parent must be included
833 -- in the subtype for semantic analysis.
835 function Get_Actual_Subtype (N : Node_Id) return Entity_Id;
836 -- Given a node for an expression, obtain the actual subtype of the
837 -- expression. In the case of a parameter where the formal is an
838 -- unconstrained array or discriminated type, this will be the previously
839 -- constructed subtype of the actual. Note that this is not quite the
840 -- "Actual Subtype" of the RM, since it is always a constrained type, i.e.
841 -- it is the subtype of the value of the actual. The actual subtype is also
842 -- returned in other cases where it has already been constructed for an
843 -- object. Otherwise the expression type is returned unchanged, except for
844 -- the case of an unconstrained array type, where an actual subtype is
845 -- created, using Insert_Actions if necessary to insert any associated
846 -- actions.
848 function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id;
849 -- This is like Get_Actual_Subtype, except that it never constructs an
850 -- actual subtype. If an actual subtype is already available, i.e. the
851 -- Actual_Subtype field of the corresponding entity is set, then it is
852 -- returned. Otherwise the Etype of the node is returned.
854 function Get_Body_From_Stub (N : Node_Id) return Node_Id;
855 -- Return the body node for a stub
857 function Get_Cursor_Type
858 (Aspect : Node_Id;
859 Typ : Entity_Id) return Entity_Id;
860 -- Find Cursor type in scope of type Typ with Iterable aspect, by locating
861 -- primitive operation First. For use in resolving the other primitive
862 -- operations of an Iterable type and expanding loops and quantified
863 -- expressions over formal containers.
865 function Get_Cursor_Type (Typ : Entity_Id) return Entity_Id;
866 -- Find Cursor type in scope of type Typ with Iterable aspect, by locating
867 -- primitive operation First. For use after resolving the primitive
868 -- operations of an Iterable type.
870 function Get_Default_External_Name (E : Node_Or_Entity_Id) return Node_Id;
871 -- This is used to construct the string literal node representing a
872 -- default external name, i.e. one that is constructed from the name of an
873 -- entity, or (in the case of extended DEC import/export pragmas, an
874 -- identifier provided as the external name. Letters in the name are
875 -- according to the setting of Opt.External_Name_Default_Casing.
877 function Get_Enclosing_Object (N : Node_Id) return Entity_Id;
878 -- If expression N references a part of an object, return this object.
879 -- Otherwise return Empty. Expression N should have been resolved already.
881 function Get_Generic_Entity (N : Node_Id) return Entity_Id;
882 -- Returns the true generic entity in an instantiation. If the name in the
883 -- instantiation is a renaming, the function returns the renamed generic.
885 function Get_Incomplete_View_Of_Ancestor (E : Entity_Id) return Entity_Id;
886 -- Implements the notion introduced ever-so briefly in RM 7.3.1 (5.2/3):
887 -- in a child unit a derived type is within the derivation class of an
888 -- ancestor declared in a parent unit, even if there is an intermediate
889 -- derivation that does not see the full view of that ancestor.
891 procedure Get_Index_Bounds (N : Node_Id; L, H : out Node_Id);
892 -- This procedure assigns to L and H respectively the values of the low and
893 -- high bounds of node N, which must be a range, subtype indication, or the
894 -- name of a scalar subtype. The result in L, H may be set to Error if
895 -- there was an earlier error in the range.
897 function Get_Enum_Lit_From_Pos
898 (T : Entity_Id;
899 Pos : Uint;
900 Loc : Source_Ptr) return Node_Id;
901 -- This function returns an identifier denoting the E_Enumeration_Literal
902 -- entity for the specified value from the enumeration type or subtype T.
903 -- The second argument is the Pos value, which is assumed to be in range.
904 -- The third argument supplies a source location for constructed nodes
905 -- returned by this function.
907 function Get_Iterable_Type_Primitive
908 (Typ : Entity_Id;
909 Nam : Name_Id) return Entity_Id;
910 -- Retrieve one of the primitives First, Next, Has_Element, Element from
911 -- the value of the Iterable aspect of a formal type.
913 procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id);
914 -- Retrieve the fully expanded name of the library unit declared by
915 -- Decl_Node into the name buffer.
917 function Get_Name_Entity_Id (Id : Name_Id) return Entity_Id;
918 pragma Inline (Get_Name_Entity_Id);
919 -- An entity value is associated with each name in the name table. The
920 -- Get_Name_Entity_Id function fetches the Entity_Id of this entity, which
921 -- is the innermost visible entity with the given name. See the body of
922 -- Sem_Ch8 for further details on handling of entity visibility.
924 function Get_Name_From_CTC_Pragma (N : Node_Id) return String_Id;
925 -- Return the Name component of Test_Case pragma N
926 -- Bad name now that this no longer applies to Contract_Case ???
928 function Get_Parent_Entity (Unit : Node_Id) return Entity_Id;
929 -- Get defining entity of parent unit of a child unit. In most cases this
930 -- is the defining entity of the unit, but for a child instance whose
931 -- parent needs a body for inlining, the instantiation node of the parent
932 -- has not yet been rewritten as a package declaration, and the entity has
933 -- to be retrieved from the Instance_Spec of the unit.
935 function Get_Pragma_Id (N : Node_Id) return Pragma_Id;
936 pragma Inline (Get_Pragma_Id);
937 -- Obtains the Pragma_Id from the Chars field of Pragma_Identifier (N)
939 procedure Get_Reason_String (N : Node_Id);
940 -- Recursive routine to analyze reason argument for pragma Warnings. The
941 -- value of the reason argument is appended to the current string using
942 -- Store_String_Chars. The reason argument is expected to be a string
943 -- literal or concatenation of string literals. An error is given for
944 -- any other form.
946 function Get_Reference_Discriminant (Typ : Entity_Id) return Entity_Id;
947 -- If Typ has Implicit_Dereference, return discriminant specified in the
948 -- corresponding aspect.
950 function Get_Referenced_Object (N : Node_Id) return Node_Id;
951 -- Given a node, return the renamed object if the node represents a renamed
952 -- object, otherwise return the node unchanged. The node may represent an
953 -- arbitrary expression.
955 function Get_Renamed_Entity (E : Entity_Id) return Entity_Id;
956 -- Given an entity for an exception, package, subprogram or generic unit,
957 -- returns the ultimately renamed entity if this is a renaming. If this is
958 -- not a renamed entity, returns its argument. It is an error to call this
959 -- with any other kind of entity.
961 function Get_Return_Object (N : Node_Id) return Entity_Id;
962 -- Given an extended return statement, return the corresponding return
963 -- object, identified as the one for which Is_Return_Object = True.
965 function Get_Subprogram_Entity (Nod : Node_Id) return Entity_Id;
966 -- Nod is either a procedure call statement, or a function call, or an
967 -- accept statement node. This procedure finds the Entity_Id of the related
968 -- subprogram or entry and returns it, or if no subprogram can be found,
969 -- returns Empty.
971 function Get_Task_Body_Procedure (E : Entity_Id) return Node_Id;
972 pragma Inline (Get_Task_Body_Procedure);
973 -- Given an entity for a task type or subtype, retrieves the
974 -- Task_Body_Procedure field from the corresponding task type declaration.
976 function Get_User_Defined_Eq (E : Entity_Id) return Entity_Id;
977 -- For a type entity, return the entity of the primitive equality function
978 -- for the type if it exists, otherwise return Empty.
980 function Has_Access_Values (T : Entity_Id) return Boolean;
981 -- Returns true if type or subtype T is an access type, or has a component
982 -- (at any recursive level) that is an access type. This is a conservative
983 -- predicate, if it is not known whether or not T contains access values
984 -- (happens for generic formals in some cases), then False is returned.
985 -- Note that tagged types return False. Even though the tag is implemented
986 -- as an access type internally, this function tests only for access types
987 -- known to the programmer. See also Has_Tagged_Component.
989 type Alignment_Result is (Known_Compatible, Unknown, Known_Incompatible);
990 -- Result of Has_Compatible_Alignment test, description found below. Note
991 -- that the values are arranged in increasing order of problematicness.
993 function Has_Compatible_Alignment
994 (Obj : Entity_Id;
995 Expr : Node_Id;
996 Layout_Done : Boolean) return Alignment_Result;
997 -- Obj is an object entity, and expr is a node for an object reference. If
998 -- the alignment of the object referenced by Expr is known to be compatible
999 -- with the alignment of Obj (i.e. is larger or the same), then the result
1000 -- is Known_Compatible. If the alignment of the object referenced by Expr
1001 -- is known to be less than the alignment of Obj, then Known_Incompatible
1002 -- is returned. If neither condition can be reliably established at compile
1003 -- time, then Unknown is returned. If Layout_Done is True, the function can
1004 -- assume that the information on size and alignment of types and objects
1005 -- is present in the tree. This is used to determine if alignment checks
1006 -- are required for address clauses (Layout_Done is False in this case) as
1007 -- well as to issue appropriate warnings for them in the post compilation
1008 -- phase (Layout_Done is True in this case).
1010 -- Note: Known_Incompatible does not mean that at run time the alignment
1011 -- of Expr is known to be wrong for Obj, just that it can be determined
1012 -- that alignments have been explicitly or implicitly specified which are
1013 -- incompatible (whereas Unknown means that even this is not known). The
1014 -- appropriate reaction of a caller to Known_Incompatible is to treat it as
1015 -- Unknown, but issue a warning that there may be an alignment error.
1017 function Has_Declarations (N : Node_Id) return Boolean;
1018 -- Determines if the node can have declarations
1020 function Has_Defaulted_Discriminants (Typ : Entity_Id) return Boolean;
1021 -- Simple predicate to test for defaulted discriminants
1023 function Has_Denormals (E : Entity_Id) return Boolean;
1024 -- Determines if the floating-point type E supports denormal numbers.
1025 -- Returns False if E is not a floating-point type.
1027 function Has_Discriminant_Dependent_Constraint
1028 (Comp : Entity_Id) return Boolean;
1029 -- Returns True if and only if Comp has a constrained subtype that depends
1030 -- on a discriminant.
1032 function Has_Effectively_Volatile_Profile
1033 (Subp_Id : Entity_Id) return Boolean;
1034 -- Determine whether subprogram Subp_Id has an effectively volatile formal
1035 -- parameter or returns an effectively volatile value.
1037 function Has_Full_Default_Initialization (Typ : Entity_Id) return Boolean;
1038 -- Determine whether type Typ defines "full default initialization" as
1039 -- specified by SPARK RM 3.1. To qualify as such, the type must be
1040 -- * A scalar type with specified Default_Value
1041 -- * An array-of-scalar type with specified Default_Component_Value
1042 -- * An array type whose element type defines full default initialization
1043 -- * A protected type, record type or type extension whose components
1044 -- either include a default expression or have a type which defines
1045 -- full default initialization. In the case of type extensions, the
1046 -- parent type defines full default initialization.
1047 -- * A task type
1048 -- * A private type whose Default_Initial_Condition is non-null
1050 function Has_Infinities (E : Entity_Id) return Boolean;
1051 -- Determines if the range of the floating-point type E includes
1052 -- infinities. Returns False if E is not a floating-point type.
1054 function Has_Interfaces
1055 (T : Entity_Id;
1056 Use_Full_View : Boolean := True) return Boolean;
1057 -- Where T is a concurrent type or a record type, returns true if T covers
1058 -- any abstract interface types. In case of private types the argument
1059 -- Use_Full_View controls if the check is done using its full view (if
1060 -- available).
1062 function Has_No_Obvious_Side_Effects (N : Node_Id) return Boolean;
1063 -- This is a simple minded function for determining whether an expression
1064 -- has no obvious side effects. It is used only for determining whether
1065 -- warnings are needed in certain situations, and is not guaranteed to
1066 -- be accurate in either direction. Exceptions may mean an expression
1067 -- does in fact have side effects, but this may be ignored and True is
1068 -- returned, or a complex expression may in fact be side effect free
1069 -- but we don't recognize it here and return False. The Side_Effect_Free
1070 -- routine in Remove_Side_Effects is much more extensive and perhaps could
1071 -- be shared, so that this routine would be more accurate.
1073 function Has_Non_Null_Refinement (Id : Entity_Id) return Boolean;
1074 -- Determine whether abstract state Id has at least one nonnull constituent
1075 -- as expressed in pragma Refined_State. This function does not take into
1076 -- account the visible refinement region of abstract state Id.
1078 function Has_Null_Exclusion (N : Node_Id) return Boolean;
1079 -- Determine whether node N has a null exclusion
1081 function Has_Null_Refinement (Id : Entity_Id) return Boolean;
1082 -- Determine whether abstract state Id has a null refinement as expressed
1083 -- in pragma Refined_State. This function does not take into account the
1084 -- visible refinement region of abstract state Id.
1086 function Has_Overriding_Initialize (T : Entity_Id) return Boolean;
1087 -- Predicate to determine whether a controlled type has a user-defined
1088 -- Initialize primitive (and, in Ada 2012, whether that primitive is
1089 -- non-null), which causes the type to not have preelaborable
1090 -- initialization.
1092 function Has_Preelaborable_Initialization (E : Entity_Id) return Boolean;
1093 -- Return True iff type E has preelaborable initialization as defined in
1094 -- Ada 2005 (see AI-161 for details of the definition of this attribute).
1096 function Has_Private_Component (Type_Id : Entity_Id) return Boolean;
1097 -- Check if a type has a (sub)component of a private type that has not
1098 -- yet received a full declaration.
1100 function Has_Signed_Zeros (E : Entity_Id) return Boolean;
1101 -- Determines if the floating-point type E supports signed zeros.
1102 -- Returns False if E is not a floating-point type.
1104 function Has_Significant_Contract (Subp_Id : Entity_Id) return Boolean;
1105 -- Determine whether subprogram [body] Subp_Id has a significant contract.
1106 -- All subprograms have a N_Contract node, but this does not mean that the
1107 -- contract is useful.
1109 function Has_Static_Array_Bounds (Typ : Node_Id) return Boolean;
1110 -- Return whether an array type has static bounds
1112 function Has_Stream (T : Entity_Id) return Boolean;
1113 -- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or in the
1114 -- case of a composite type, has a component for which this predicate is
1115 -- True, and if so returns True. Otherwise a result of False means that
1116 -- there is no Stream type in sight. For a private type, the test is
1117 -- applied to the underlying type (or returns False if there is no
1118 -- underlying type).
1120 function Has_Suffix (E : Entity_Id; Suffix : Character) return Boolean;
1121 -- Returns true if the last character of E is Suffix. Used in Assertions.
1123 function Has_Tagged_Component (Typ : Entity_Id) return Boolean;
1124 -- Returns True if Typ is a composite type (array or record) which is
1125 -- either itself a tagged type, or has a component (recursively) which is
1126 -- a tagged type. Returns False for non-composite type, or if no tagged
1127 -- component is present. This function is used to check if "=" has to be
1128 -- expanded into a bunch component comparisons.
1130 function Has_Undefined_Reference (Expr : Node_Id) return Boolean;
1131 -- Given arbitrary expression Expr, determine whether it contains at
1132 -- least one name whose entity is Any_Id.
1134 function Has_Volatile_Component (Typ : Entity_Id) return Boolean;
1135 -- Given arbitrary type Typ, determine whether it contains at least one
1136 -- volatile component.
1138 function Implementation_Kind (Subp : Entity_Id) return Name_Id;
1139 -- Subp is a subprogram marked with pragma Implemented. Return the specific
1140 -- implementation requirement which the pragma imposes. The return value is
1141 -- either Name_By_Any, Name_By_Entry or Name_By_Protected_Procedure.
1143 function Implements_Interface
1144 (Typ_Ent : Entity_Id;
1145 Iface_Ent : Entity_Id;
1146 Exclude_Parents : Boolean := False) return Boolean;
1147 -- Returns true if the Typ_Ent implements interface Iface_Ent
1149 function In_Assertion_Expression_Pragma (N : Node_Id) return Boolean;
1150 -- Determine whether an arbitrary node appears in a pragma that acts as an
1151 -- assertion expression. See Sem_Prag for the list of qualifying pragmas.
1153 function In_Instance return Boolean;
1154 -- Returns True if the current scope is within a generic instance
1156 function In_Instance_Body return Boolean;
1157 -- Returns True if current scope is within the body of an instance, where
1158 -- several semantic checks (e.g. accessibility checks) are relaxed.
1160 function In_Instance_Not_Visible return Boolean;
1161 -- Returns True if current scope is with the private part or the body of
1162 -- an instance. Other semantic checks are suppressed in this context.
1164 function In_Instance_Visible_Part return Boolean;
1165 -- Returns True if current scope is within the visible part of a package
1166 -- instance, where several additional semantic checks apply.
1168 function In_Package_Body return Boolean;
1169 -- Returns True if current scope is within a package body
1171 function In_Parameter_Specification (N : Node_Id) return Boolean;
1172 -- Returns True if node N belongs to a parameter specification
1174 function In_Pragma_Expression (N : Node_Id; Nam : Name_Id) return Boolean;
1175 -- Returns true if the expression N occurs within a pragma with name Nam
1177 function In_Reverse_Storage_Order_Object (N : Node_Id) return Boolean;
1178 -- Returns True if N denotes a component or subcomponent in a record or
1179 -- array that has Reverse_Storage_Order.
1181 function In_Subprogram_Or_Concurrent_Unit return Boolean;
1182 -- Determines if the current scope is within a subprogram compilation unit
1183 -- (inside a subprogram declaration, subprogram body, or generic subprogram
1184 -- declaration) or within a task or protected body. The test is for
1185 -- appearing anywhere within such a construct (that is it does not need
1186 -- to be directly within).
1188 function In_Visible_Part (Scope_Id : Entity_Id) return Boolean;
1189 -- Determine whether a declaration occurs within the visible part of a
1190 -- package specification. The package must be on the scope stack, and the
1191 -- corresponding private part must not.
1193 function Incomplete_Or_Partial_View (Id : Entity_Id) return Entity_Id;
1194 -- Given the entity of a constant or a type, retrieve the incomplete or
1195 -- partial view of the same entity. Note that Id may not have a partial
1196 -- view in which case the function returns Empty.
1198 procedure Inherit_Default_Init_Cond_Procedure (Typ : Entity_Id);
1199 -- Inherit the default initial condition procedure from the parent type of
1200 -- derived type Typ.
1202 procedure Inherit_Rep_Item_Chain (Typ : Entity_Id; From_Typ : Entity_Id);
1203 -- Inherit the rep item chain of type From_Typ without clobbering any
1204 -- existing rep items on Typ's chain. Typ is the destination type.
1206 procedure Insert_Explicit_Dereference (N : Node_Id);
1207 -- In a context that requires a composite or subprogram type and where a
1208 -- prefix is an access type, rewrite the access type node N (which is the
1209 -- prefix, e.g. of an indexed component) as an explicit dereference.
1211 procedure Inspect_Deferred_Constant_Completion (Decls : List_Id);
1212 -- Examine all deferred constants in the declaration list Decls and check
1213 -- whether they have been completed by a full constant declaration or an
1214 -- Import pragma. Emit the error message if that is not the case.
1216 procedure Install_Generic_Formals (Subp_Id : Entity_Id);
1217 -- Install both the generic formal parameters and the formal parameters of
1218 -- generic subprogram Subp_Id into visibility.
1220 function Is_Actual_Out_Parameter (N : Node_Id) return Boolean;
1221 -- Determines if N is an actual parameter of out mode in a subprogram call
1223 function Is_Actual_Parameter (N : Node_Id) return Boolean;
1224 -- Determines if N is an actual parameter in a subprogram call
1226 function Is_Actual_Tagged_Parameter (N : Node_Id) return Boolean;
1227 -- Determines if N is an actual parameter of a formal of tagged type in a
1228 -- subprogram call.
1230 function Is_Aliased_View (Obj : Node_Id) return Boolean;
1231 -- Determine if Obj is an aliased view, i.e. the name of an object to which
1232 -- 'Access or 'Unchecked_Access can apply. Note that this routine uses the
1233 -- rules of the language, it does not take into account the restriction
1234 -- No_Implicit_Aliasing, so it can return True if the restriction is active
1235 -- and Obj violates the restriction. The caller is responsible for calling
1236 -- Restrict.Check_No_Implicit_Aliasing if True is returned, but there is a
1237 -- requirement for obeying the restriction in the call context.
1239 function Is_Ancestor_Package
1240 (E1 : Entity_Id;
1241 E2 : Entity_Id) return Boolean;
1242 -- Determine whether package E1 is an ancestor of E2
1244 function Is_Atomic_Object (N : Node_Id) return Boolean;
1245 -- Determines if the given node denotes an atomic object in the sense of
1246 -- the legality checks described in RM C.6(12).
1248 function Is_Atomic_Or_VFA_Object (N : Node_Id) return Boolean;
1249 -- Determines if the given node is an atomic object (Is_Atomic_Object true)
1250 -- or else is an object for which VFA is present.
1252 function Is_Attribute_Result (N : Node_Id) return Boolean;
1253 -- Determine whether node N denotes attribute 'Result
1255 function Is_Attribute_Update (N : Node_Id) return Boolean;
1256 -- Determine whether node N denotes attribute 'Update
1258 function Is_Body_Or_Package_Declaration (N : Node_Id) return Boolean;
1259 -- Determine whether node N denotes a body or a package declaration
1261 function Is_Bounded_String (T : Entity_Id) return Boolean;
1262 -- True if T is a bounded string type. Used to make sure "=" composes
1263 -- properly for bounded string types.
1265 function Is_Constant_Bound (Exp : Node_Id) return Boolean;
1266 -- Exp is the expression for an array bound. Determines whether the
1267 -- bound is a compile-time known value, or a constant entity, or an
1268 -- enumeration literal, or an expression composed of constant-bound
1269 -- subexpressions which are evaluated by means of standard operators.
1271 function Is_Container_Element (Exp : Node_Id) return Boolean;
1272 -- This routine recognizes expressions that denote an element of one of
1273 -- the predefined containers, when the source only contains an indexing
1274 -- operation and an implicit dereference is inserted by the compiler.
1275 -- In the absence of this optimization, the indexing creates a temporary
1276 -- controlled cursor that sets the tampering bit of the container, and
1277 -- restricts the use of the convenient notation C (X) to contexts that
1278 -- do not check the tampering bit (e.g. C.Include (X, C (Y)). Exp is an
1279 -- explicit dereference. The transformation applies when it has the form
1280 -- F (X).Discr.all.
1282 function Is_Contract_Annotation (Item : Node_Id) return Boolean;
1283 -- Determine whether aspect specification or pragma Item is a contract
1284 -- annotation.
1286 function Is_Controlling_Limited_Procedure
1287 (Proc_Nam : Entity_Id) return Boolean;
1288 -- Ada 2005 (AI-345): Determine whether Proc_Nam is a primitive procedure
1289 -- of a limited interface with a controlling first parameter.
1291 function Is_CPP_Constructor_Call (N : Node_Id) return Boolean;
1292 -- Returns True if N is a call to a CPP constructor
1294 function Is_Child_Or_Sibling
1295 (Pack_1 : Entity_Id;
1296 Pack_2 : Entity_Id) return Boolean;
1297 -- Determine the following relations between two arbitrary packages:
1298 -- 1) One package is the parent of a child package
1299 -- 2) Both packages are siblings and share a common parent
1301 function Is_Concurrent_Interface (T : Entity_Id) return Boolean;
1302 -- First determine whether type T is an interface and then check whether
1303 -- it is of protected, synchronized or task kind.
1305 function Is_Current_Instance (N : Node_Id) return Boolean;
1306 -- Predicate is true if N legally denotes a type name within its own
1307 -- declaration. Prior to Ada 2012 this covered only synchronized type
1308 -- declarations. In Ada 2012 it also covers type and subtype declarations
1309 -- with aspects: Invariant, Predicate, and Default_Initial_Condition.
1311 function Is_Declaration (N : Node_Id) return Boolean;
1312 -- Determine whether arbitrary node N denotes a declaration
1314 function Is_Declared_Within_Variant (Comp : Entity_Id) return Boolean;
1315 -- Returns True iff component Comp is declared within a variant part
1317 function Is_Dependent_Component_Of_Mutable_Object
1318 (Object : Node_Id) return Boolean;
1319 -- Returns True if Object is the name of a subcomponent that depends on
1320 -- discriminants of a variable whose nominal subtype is unconstrained and
1321 -- not indefinite, and the variable is not aliased. Otherwise returns
1322 -- False. The nodes passed to this function are assumed to denote objects.
1324 function Is_Dereferenced (N : Node_Id) return Boolean;
1325 -- N is a subexpression node of an access type. This function returns true
1326 -- if N appears as the prefix of a node that does a dereference of the
1327 -- access value (selected/indexed component, explicit dereference or a
1328 -- slice), and false otherwise.
1330 function Is_Descendent_Of (T1 : Entity_Id; T2 : Entity_Id) return Boolean;
1331 -- Returns True if type T1 is a descendent of type T2, and false otherwise.
1332 -- This is the RM definition, a type is a descendent of another type if it
1333 -- is the same type or is derived from a descendent of the other type.
1335 function Is_Descendant_Of_Suspension_Object
1336 (Typ : Entity_Id) return Boolean;
1337 -- Determine whether type Typ is a descendant of type Suspension_Object
1338 -- defined in Ada.Synchronous_Task_Control. This version is different from
1339 -- Is_Descendent_Of as the detection of Suspension_Object does not involve
1340 -- an entity and by extension a call to RTSfind.
1342 function Is_Double_Precision_Floating_Point_Type
1343 (E : Entity_Id) return Boolean;
1344 -- Return whether E is a double precision floating point type,
1345 -- characterized by:
1346 -- . machine_radix = 2
1347 -- . machine_mantissa = 53
1348 -- . machine_emax = 2**10
1349 -- . machine_emin = 3 - machine_emax
1351 function Is_Effectively_Volatile (Id : Entity_Id) return Boolean;
1352 -- Determine whether a type or object denoted by entity Id is effectively
1353 -- volatile (SPARK RM 7.1.2). To qualify as such, the entity must be either
1354 -- * Volatile
1355 -- * An array type subject to aspect Volatile_Components
1356 -- * An array type whose component type is effectively volatile
1357 -- * A protected type
1358 -- * Descendant of type Ada.Synchronous_Task_Control.Suspension_Object
1360 function Is_Effectively_Volatile_Object (N : Node_Id) return Boolean;
1361 -- Determine whether an arbitrary node denotes an effectively volatile
1362 -- object (SPARK RM 7.1.2).
1364 function Is_Entry_Body (Id : Entity_Id) return Boolean;
1365 -- Determine whether entity Id is the body entity of an entry [family]
1367 function Is_Entry_Declaration (Id : Entity_Id) return Boolean;
1368 -- Determine whether entity Id is the spec entity of an entry [family]
1370 function Is_Expression_Function (Subp : Entity_Id) return Boolean;
1371 -- Determine whether subprogram [body] Subp denotes an expression function
1373 function Is_Expression_Function_Or_Completion
1374 (Subp : Entity_Id) return Boolean;
1375 -- Determine whether subprogram [body] Subp denotes an expression function
1376 -- or is completed by an expression function body.
1378 function Is_EVF_Expression (N : Node_Id) return Boolean;
1379 -- Determine whether node N denotes a reference to a formal parameter of
1380 -- a specific tagged type whose related subprogram is subject to pragma
1381 -- Extensions_Visible with value "False" (SPARK RM 6.1.7). Several other
1382 -- constructs fall under this category:
1383 -- 1) A qualified expression whose operand is EVF
1384 -- 2) A type conversion whose operand is EVF
1385 -- 3) An if expression with at least one EVF dependent_expression
1386 -- 4) A case expression with at least one EVF dependent_expression
1388 function Is_False (U : Uint) return Boolean;
1389 pragma Inline (Is_False);
1390 -- The argument is a Uint value which is the Boolean'Pos value of a Boolean
1391 -- operand (i.e. is either 0 for False, or 1 for True). This function tests
1392 -- if it is False (i.e. zero).
1394 function Is_Fixed_Model_Number (U : Ureal; T : Entity_Id) return Boolean;
1395 -- Returns True iff the number U is a model number of the fixed-point type
1396 -- T, i.e. if it is an exact multiple of Small.
1398 function Is_Fully_Initialized_Type (Typ : Entity_Id) return Boolean;
1399 -- Typ is a type entity. This function returns true if this type is fully
1400 -- initialized, meaning that an object of the type is fully initialized.
1401 -- Note that initialization resulting from use of pragma Normalize_Scalars
1402 -- does not count. Note that this is only used for the purpose of issuing
1403 -- warnings for objects that are potentially referenced uninitialized. This
1404 -- means that the result returned is not crucial, but should err on the
1405 -- side of thinking things are fully initialized if it does not know.
1407 function Is_Generic_Declaration_Or_Body (Decl : Node_Id) return Boolean;
1408 -- Determine whether arbitrary declaration Decl denotes a generic package,
1409 -- a generic subprogram or a generic body.
1411 function Is_Inherited_Operation (E : Entity_Id) return Boolean;
1412 -- E is a subprogram. Return True is E is an implicit operation inherited
1413 -- by a derived type declaration.
1415 function Is_Inherited_Operation_For_Type
1416 (E : Entity_Id;
1417 Typ : Entity_Id) return Boolean;
1418 -- E is a subprogram. Return True is E is an implicit operation inherited
1419 -- by the derived type declaration for type Typ.
1421 function Is_Iterator (Typ : Entity_Id) return Boolean;
1422 -- AI05-0139-2: Check whether Typ is one of the predefined interfaces in
1423 -- Ada.Iterator_Interfaces, or it is derived from one.
1425 function Is_Iterator_Over_Array (N : Node_Id) return Boolean;
1426 -- N is an iterator specification. Returns True iff N is an iterator over
1427 -- an array, either inside a loop of the form 'for X of A' or a quantified
1428 -- expression of the form 'for all/some X of A' where A is of array type.
1430 type Is_LHS_Result is (Yes, No, Unknown);
1431 function Is_LHS (N : Node_Id) return Is_LHS_Result;
1432 -- Returns Yes if N is definitely used as Name in an assignment statement.
1433 -- Returns No if N is definitely NOT used as a Name in an assignment
1434 -- statement. Returns Unknown if we can't tell at this stage (happens in
1435 -- the case where we don't know the type of N yet, and we have something
1436 -- like N.A := 3, where this counts as N being used on the left side of
1437 -- an assignment only if N is not an access type. If it is an access type
1438 -- then it is N.all.A that is assigned, not N.
1440 function Is_Library_Level_Entity (E : Entity_Id) return Boolean;
1441 -- A library-level declaration is one that is accessible from Standard,
1442 -- i.e. a library unit or an entity declared in a library package.
1444 function Is_Limited_Class_Wide_Type (Typ : Entity_Id) return Boolean;
1445 -- Determine whether a given type is a limited class-wide type, in which
1446 -- case it needs a Master_Id, because extensions of its designated type
1447 -- may include task components. A class-wide type that comes from a
1448 -- limited view must be treated in the same way.
1450 function Is_Local_Variable_Reference (Expr : Node_Id) return Boolean;
1451 -- Determines whether Expr is a reference to a variable or IN OUT mode
1452 -- parameter of the current enclosing subprogram.
1453 -- Why are OUT parameters not considered here ???
1455 function Is_Nontrivial_Default_Init_Cond_Procedure
1456 (Id : Entity_Id) return Boolean;
1457 -- Determine whether entity Id denotes the procedure that verifies the
1458 -- assertion expression of pragma Default_Initial_Condition and if it does,
1459 -- the encapsulated expression is nontrivial.
1461 function Is_Object_Reference (N : Node_Id) return Boolean;
1462 -- Determines if the tree referenced by N represents an object. Both
1463 -- variable and constant objects return True (compare Is_Variable).
1465 function Is_OK_Variable_For_Out_Formal (AV : Node_Id) return Boolean;
1466 -- Used to test if AV is an acceptable formal for an OUT or IN OUT formal.
1467 -- Note that the Is_Variable function is not quite the right test because
1468 -- this is a case in which conversions whose expression is a variable (in
1469 -- the Is_Variable sense) with an untagged type target are considered view
1470 -- conversions and hence variables.
1472 function Is_Package_Contract_Annotation (Item : Node_Id) return Boolean;
1473 -- Determine whether aspect specification or pragma Item is one of the
1474 -- following package contract annotations:
1475 -- Abstract_State
1476 -- Initial_Condition
1477 -- Initializes
1478 -- Refined_State
1480 function Is_Partially_Initialized_Type
1481 (Typ : Entity_Id;
1482 Include_Implicit : Boolean := True) return Boolean;
1483 -- Typ is a type entity. This function returns true if this type is partly
1484 -- initialized, meaning that an object of the type is at least partly
1485 -- initialized (in particular in the record case, that at least one
1486 -- component has an initialization expression). Note that initialization
1487 -- resulting from the use of pragma Normalize_Scalars does not count.
1488 -- Include_Implicit controls whether implicit initialization of access
1489 -- values to null, and of discriminant values, is counted as making the
1490 -- type be partially initialized. For the default setting of True, these
1491 -- implicit cases do count, and discriminated types or types containing
1492 -- access values not explicitly initialized will return True. Otherwise
1493 -- if Include_Implicit is False, these cases do not count as making the
1494 -- type be partially initialized.
1496 function Is_Potentially_Unevaluated (N : Node_Id) return Boolean;
1497 -- Predicate to implement definition given in RM 6.1.1 (20/3)
1499 function Is_Potentially_Persistent_Type (T : Entity_Id) return Boolean;
1500 -- Determines if type T is a potentially persistent type. A potentially
1501 -- persistent type is defined (recursively) as a scalar type, an untagged
1502 -- record whose components are all of a potentially persistent type, or an
1503 -- array with all static constraints whose component type is potentially
1504 -- persistent. A private type is potentially persistent if the full type
1505 -- is potentially persistent.
1507 function Is_Protected_Self_Reference (N : Node_Id) return Boolean;
1508 -- Return True if node N denotes a protected type name which represents
1509 -- the current instance of a protected object according to RM 9.4(21/2).
1511 function Is_RCI_Pkg_Spec_Or_Body (Cunit : Node_Id) return Boolean;
1512 -- Return True if a compilation unit is the specification or the
1513 -- body of a remote call interface package.
1515 function Is_Remote_Access_To_Class_Wide_Type (E : Entity_Id) return Boolean;
1516 -- Return True if E is a remote access-to-class-wide type
1518 function Is_Remote_Access_To_Subprogram_Type (E : Entity_Id) return Boolean;
1519 -- Return True if E is a remote access to subprogram type
1521 function Is_Remote_Call (N : Node_Id) return Boolean;
1522 -- Return True if N denotes a potentially remote call
1524 function Is_Renamed_Entry (Proc_Nam : Entity_Id) return Boolean;
1525 -- Return True if Proc_Nam is a procedure renaming of an entry
1527 function Is_Renaming_Declaration (N : Node_Id) return Boolean;
1528 -- Determine whether arbitrary node N denotes a renaming declaration
1530 function Is_Reversible_Iterator (Typ : Entity_Id) return Boolean;
1531 -- AI05-0139-2: Check whether Typ is derived from the predefined interface
1532 -- Ada.Iterator_Interfaces.Reversible_Iterator.
1534 function Is_Selector_Name (N : Node_Id) return Boolean;
1535 -- Given an N_Identifier node N, determines if it is a Selector_Name.
1536 -- As described in Sinfo, Selector_Names are special because they
1537 -- represent use of the N_Identifier node for a true identifier, when
1538 -- normally such nodes represent a direct name.
1540 function Is_Single_Concurrent_Object (Id : Entity_Id) return Boolean;
1541 -- Determine whether arbitrary entity Id denotes the anonymous object
1542 -- created for a single protected or single task type.
1544 function Is_Single_Concurrent_Type (Id : Entity_Id) return Boolean;
1545 -- Determine whether arbitrary entity Id denotes a single protected or
1546 -- single task type.
1548 function Is_Single_Concurrent_Type_Declaration (N : Node_Id) return Boolean;
1549 -- Determine whether arbitrary node N denotes the declaration of a single
1550 -- protected type or single task type.
1552 function Is_Single_Precision_Floating_Point_Type
1553 (E : Entity_Id) return Boolean;
1554 -- Return whether E is a single precision floating point type,
1555 -- characterized by:
1556 -- . machine_radix = 2
1557 -- . machine_mantissa = 24
1558 -- . machine_emax = 2**7
1559 -- . machine_emin = 3 - machine_emax
1561 function Is_Single_Protected_Object (Id : Entity_Id) return Boolean;
1562 -- Determine whether arbitrary entity Id denotes the anonymous object
1563 -- created for a single protected type.
1565 function Is_Single_Task_Object (Id : Entity_Id) return Boolean;
1566 -- Determine whether arbitrary entity Id denotes the anonymous object
1567 -- created for a single task type.
1569 function Is_SPARK_05_Initialization_Expr (N : Node_Id) return Boolean;
1570 -- Determines if the tree referenced by N represents an initialization
1571 -- expression in SPARK 2005, suitable for initializing an object in an
1572 -- object declaration.
1574 function Is_SPARK_05_Object_Reference (N : Node_Id) return Boolean;
1575 -- Determines if the tree referenced by N represents an object in SPARK
1576 -- 2005. This differs from Is_Object_Reference in that only variables,
1577 -- constants, formal parameters, and selected_components of those are
1578 -- valid objects in SPARK 2005.
1580 function Is_Specific_Tagged_Type (Typ : Entity_Id) return Boolean;
1581 -- Determine whether an arbitrary [private] type is specifically tagged
1583 function Is_Statement (N : Node_Id) return Boolean;
1584 pragma Inline (Is_Statement);
1585 -- Check if the node N is a statement node. Note that this includes
1586 -- the case of procedure call statements (unlike the direct use of
1587 -- the N_Statement_Other_Than_Procedure_Call subtype from Sinfo).
1588 -- Note that a label is *not* a statement, and will return False.
1590 function Is_Subprogram_Contract_Annotation (Item : Node_Id) return Boolean;
1591 -- Determine whether aspect specification or pragma Item is one of the
1592 -- following subprogram contract annotations:
1593 -- Contract_Cases
1594 -- Depends
1595 -- Extensions_Visible
1596 -- Global
1597 -- Post
1598 -- Post_Class
1599 -- Postcondition
1600 -- Pre
1601 -- Pre_Class
1602 -- Precondition
1603 -- Refined_Depends
1604 -- Refined_Global
1605 -- Refined_Post
1606 -- Test_Case
1608 function Is_Subprogram_Stub_Without_Prior_Declaration
1609 (N : Node_Id) return Boolean;
1610 -- Return True if N is a subprogram stub with no prior subprogram
1611 -- declaration.
1613 function Is_Suspension_Object (Id : Entity_Id) return Boolean;
1614 -- Determine whether arbitrary entity Id denotes Suspension_Object defined
1615 -- in Ada.Synchronous_Task_Control.
1617 function Is_Synchronized_Object (Id : Entity_Id) return Boolean;
1618 -- Determine whether entity Id denotes an object and if it does, whether
1619 -- this object is synchronized as specified in SPARK RM 9.1. To qualify as
1620 -- such, the object must be
1621 -- * Of a type that yields a synchronized object
1622 -- * An atomic object with enabled Async_Writers
1623 -- * A constant
1624 -- * A variable subject to pragma Constant_After_Elaboration
1626 function Is_Synchronized_Tagged_Type (E : Entity_Id) return Boolean;
1627 -- Returns True if E is a synchronized tagged type (AARM 3.9.4 (6/2))
1629 function Is_Transfer (N : Node_Id) return Boolean;
1630 -- Returns True if the node N is a statement which is known to cause an
1631 -- unconditional transfer of control at runtime, i.e. the following
1632 -- statement definitely will not be executed.
1634 function Is_True (U : Uint) return Boolean;
1635 pragma Inline (Is_True);
1636 -- The argument is a Uint value which is the Boolean'Pos value of a Boolean
1637 -- operand (i.e. is either 0 for False, or 1 for True). This function tests
1638 -- if it is True (i.e. non-zero).
1640 function Is_Unchecked_Conversion_Instance (Id : Entity_Id) return Boolean;
1641 -- Determine whether an arbitrary entity denotes an instance of function
1642 -- Ada.Unchecked_Conversion.
1644 function Is_Universal_Numeric_Type (T : Entity_Id) return Boolean;
1645 pragma Inline (Is_Universal_Numeric_Type);
1646 -- True if T is Universal_Integer or Universal_Real
1648 function Is_Variable_Size_Array (E : Entity_Id) return Boolean;
1649 -- Returns true if E has variable size components
1651 function Is_Variable_Size_Record (E : Entity_Id) return Boolean;
1652 -- Returns true if E has variable size components
1654 function Is_Variable
1655 (N : Node_Id;
1656 Use_Original_Node : Boolean := True) return Boolean;
1657 -- Determines if the tree referenced by N represents a variable, i.e. can
1658 -- appear on the left side of an assignment. There is one situation (formal
1659 -- parameters) in which untagged type conversions are also considered
1660 -- variables, but Is_Variable returns False for such cases, since it has
1661 -- no knowledge of the context. Note that this is the point at which
1662 -- Assignment_OK is checked, and True is returned for any tree thus marked.
1663 -- Use_Original_Node is used to perform the test on Original_Node (N). By
1664 -- default is True since this routine is commonly invoked as part of the
1665 -- semantic analysis and it must not be disturbed by the rewriten nodes.
1667 function Is_Visibly_Controlled (T : Entity_Id) return Boolean;
1668 -- Check whether T is derived from a visibly controlled type. This is true
1669 -- if the root type is declared in Ada.Finalization. If T is derived
1670 -- instead from a private type whose full view is controlled, an explicit
1671 -- Initialize/Adjust/Finalize subprogram does not override the inherited
1672 -- one.
1674 function Is_Volatile_Function (Func_Id : Entity_Id) return Boolean;
1675 -- Determine whether [generic] function Func_Id is subject to enabled
1676 -- pragma Volatile_Function. Protected functions are treated as volatile
1677 -- (SPARK RM 7.1.2).
1679 function Is_Volatile_Object (N : Node_Id) return Boolean;
1680 -- Determines if the given node denotes an volatile object in the sense of
1681 -- the legality checks described in RM C.6(12). Note that the test here is
1682 -- for something actually declared as volatile, not for an object that gets
1683 -- treated as volatile (see Einfo.Treat_As_Volatile).
1685 function Itype_Has_Declaration (Id : Entity_Id) return Boolean;
1686 -- Applies to Itypes. True if the Itype is attached to a declaration for
1687 -- the type through its Parent field, which may or not be present in the
1688 -- tree.
1690 procedure Kill_Current_Values (Last_Assignment_Only : Boolean := False);
1691 -- This procedure is called to clear all constant indications from all
1692 -- entities in the current scope and in any parent scopes if the current
1693 -- scope is a block or a package (and that recursion continues to the top
1694 -- scope that is not a block or a package). This is used when the
1695 -- sequential flow-of-control assumption is violated (occurrence of a
1696 -- label, head of a loop, or start of an exception handler). The effect of
1697 -- the call is to clear the Current_Value field (but we do not need to
1698 -- clear the Is_True_Constant flag, since that only gets reset if there
1699 -- really is an assignment somewhere in the entity scope). This procedure
1700 -- also calls Kill_All_Checks, since this is a special case of needing to
1701 -- forget saved values. This procedure also clears the Is_Known_Null and
1702 -- Is_Known_Non_Null and Is_Known_Valid flags in variables, constants or
1703 -- parameters since these are also not known to be trustable any more.
1705 -- The Last_Assignment_Only flag is set True to clear only Last_Assignment
1706 -- fields and leave other fields unchanged. This is used when we encounter
1707 -- an unconditional flow of control change (return, goto, raise). In such
1708 -- cases we don't need to clear the current values, since it may be that
1709 -- the flow of control change occurs in a conditional context, and if it
1710 -- is not taken, then it is just fine to keep the current values. But the
1711 -- Last_Assignment field is different, if we have a sequence assign-to-v,
1712 -- conditional-return, assign-to-v, we do not want to complain that the
1713 -- second assignment clobbers the first.
1715 procedure Kill_Current_Values
1716 (Ent : Entity_Id;
1717 Last_Assignment_Only : Boolean := False);
1718 -- This performs the same processing as described above for the form with
1719 -- no argument, but for the specific entity given. The call has no effect
1720 -- if the entity Ent is not for an object. Last_Assignment_Only has the
1721 -- same meaning as for the call with no Ent.
1723 procedure Kill_Size_Check_Code (E : Entity_Id);
1724 -- Called when an address clause or pragma Import is applied to an entity.
1725 -- If the entity is a variable or a constant, and size check code is
1726 -- present, this size check code is killed, since the object will not be
1727 -- allocated by the program.
1729 function Known_To_Be_Assigned (N : Node_Id) return Boolean;
1730 -- The node N is an entity reference. This function determines whether the
1731 -- reference is for sure an assignment of the entity, returning True if
1732 -- so. This differs from May_Be_Lvalue in that it defaults in the other
1733 -- direction. Cases which may possibly be assignments but are not known to
1734 -- be may return True from May_Be_Lvalue, but False from this function.
1736 function Last_Source_Statement (HSS : Node_Id) return Node_Id;
1737 -- HSS is a handled statement sequence. This function returns the last
1738 -- statement in Statements (HSS) that has Comes_From_Source set. If no
1739 -- such statement exists, Empty is returned.
1741 function Matching_Static_Array_Bounds
1742 (L_Typ : Node_Id;
1743 R_Typ : Node_Id) return Boolean;
1744 -- L_Typ and R_Typ are two array types. Returns True when they have the
1745 -- same number of dimensions, and the same static bounds for each index
1746 -- position.
1748 procedure Mark_Coextensions (Context_Nod : Node_Id; Root_Nod : Node_Id);
1749 -- Given a node which designates the context of analysis and an origin in
1750 -- the tree, traverse from Root_Nod and mark all allocators as either
1751 -- dynamic or static depending on Context_Nod. Any incorrect marking is
1752 -- cleaned up during resolution.
1754 function May_Be_Lvalue (N : Node_Id) return Boolean;
1755 -- Determines if N could be an lvalue (e.g. an assignment left hand side).
1756 -- An lvalue is defined as any expression which appears in a context where
1757 -- a name is required by the syntax, and the identity, rather than merely
1758 -- the value of the node is needed (for example, the prefix of an Access
1759 -- attribute is in this category). Note that, as implied by the name, this
1760 -- test is conservative. If it cannot be sure that N is NOT an lvalue, then
1761 -- it returns True. It tries hard to get the answer right, but it is hard
1762 -- to guarantee this in all cases. Note that it is more possible to give
1763 -- correct answer if the tree is fully analyzed.
1765 function Needs_One_Actual (E : Entity_Id) return Boolean;
1766 -- Returns True if a function has defaults for all but its first
1767 -- formal. Used in Ada 2005 mode to solve the syntactic ambiguity that
1768 -- results from an indexing of a function call written in prefix form.
1770 function New_Copy_List_Tree (List : List_Id) return List_Id;
1771 -- Copy recursively an analyzed list of nodes. Uses New_Copy_Tree defined
1772 -- below. As for New_Copy_Tree, it is illegal to attempt to copy extended
1773 -- nodes (entities) either directly or indirectly using this function.
1775 function New_Copy_Tree
1776 (Source : Node_Id;
1777 Map : Elist_Id := No_Elist;
1778 New_Sloc : Source_Ptr := No_Location;
1779 New_Scope : Entity_Id := Empty) return Node_Id;
1780 -- Given a node that is the root of a subtree, Copy_Tree copies the entire
1781 -- syntactic subtree, including recursively any descendents whose parent
1782 -- field references a copied node (descendents not linked to a copied node
1783 -- by the parent field are not copied, instead the copied tree references
1784 -- the same descendent as the original in this case, which is appropriate
1785 -- for non-syntactic fields such as Etype). The parent pointers in the
1786 -- copy are properly set. Copy_Tree (Empty/Error) returns Empty/Error.
1787 -- The one exception to the rule of not copying semantic fields is that
1788 -- any implicit types attached to the subtree are duplicated, so that
1789 -- the copy contains a distinct set of implicit type entities. Thus this
1790 -- function is used when it is necessary to duplicate an analyzed tree,
1791 -- declared in the same or some other compilation unit. This function is
1792 -- declared here rather than in atree because it uses semantic information
1793 -- in particular concerning the structure of itypes and the generation of
1794 -- public symbols.
1796 -- The Map argument, if set to a non-empty Elist, specifies a set of
1797 -- mappings to be applied to entities in the tree. The map has the form:
1799 -- old entity 1
1800 -- new entity to replace references to entity 1
1801 -- old entity 2
1802 -- new entity to replace references to entity 2
1803 -- ...
1805 -- The call destroys the contents of Map in this case
1807 -- The parameter New_Sloc, if set to a value other than No_Location, is
1808 -- used as the Sloc value for all nodes in the new copy. If New_Sloc is
1809 -- set to its default value No_Location, then the Sloc values of the
1810 -- nodes in the copy are simply copied from the corresponding original.
1812 -- The Comes_From_Source indication is unchanged if New_Sloc is set to
1813 -- the default No_Location value, but is reset if New_Sloc is given, since
1814 -- in this case the result clearly is neither a source node or an exact
1815 -- copy of a source node.
1817 -- The parameter New_Scope, if set to a value other than Empty, is the
1818 -- value to use as the Scope for any Itypes that are copied. The most
1819 -- typical value for this parameter, if given, is Current_Scope.
1821 function New_External_Entity
1822 (Kind : Entity_Kind;
1823 Scope_Id : Entity_Id;
1824 Sloc_Value : Source_Ptr;
1825 Related_Id : Entity_Id;
1826 Suffix : Character;
1827 Suffix_Index : Nat := 0;
1828 Prefix : Character := ' ') return Entity_Id;
1829 -- This function creates an N_Defining_Identifier node for an internal
1830 -- created entity, such as an implicit type or subtype, or a record
1831 -- initialization procedure. The entity name is constructed with a call
1832 -- to New_External_Name (Related_Id, Suffix, Suffix_Index, Prefix), so
1833 -- that the generated name may be referenced as a public entry, and the
1834 -- Is_Public flag is set if needed (using Set_Public_Status). If the
1835 -- entity is for a type or subtype, the size/align fields are initialized
1836 -- to unknown (Uint_0).
1838 function New_Internal_Entity
1839 (Kind : Entity_Kind;
1840 Scope_Id : Entity_Id;
1841 Sloc_Value : Source_Ptr;
1842 Id_Char : Character) return Entity_Id;
1843 -- This function is similar to New_External_Entity, except that the
1844 -- name is constructed by New_Internal_Name (Id_Char). This is used
1845 -- when the resulting entity does not have to be referenced as a
1846 -- public entity (and in this case Is_Public is not set).
1848 procedure Next_Actual (Actual_Id : in out Node_Id);
1849 pragma Inline (Next_Actual);
1850 -- Next_Actual (N) is equivalent to N := Next_Actual (N). Note that we
1851 -- inline this procedural form, but not the functional form that follows.
1853 function Next_Actual (Actual_Id : Node_Id) return Node_Id;
1854 -- Find next actual parameter in declaration order. As described for
1855 -- First_Actual, this is the next actual in the declaration order, not
1856 -- the call order, so this does not correspond to simply taking the
1857 -- next entry of the Parameter_Associations list. The argument is an
1858 -- actual previously returned by a call to First_Actual or Next_Actual.
1859 -- Note that the result produced is always an expression, not a parameter
1860 -- association node, even if named notation was used.
1862 procedure Normalize_Actuals
1863 (N : Node_Id;
1864 S : Entity_Id;
1865 Report : Boolean;
1866 Success : out Boolean);
1867 -- Reorders lists of actuals according to names of formals, value returned
1868 -- in Success indicates success of reordering. For more details, see body.
1869 -- Errors are reported only if Report is set to True.
1871 procedure Note_Possible_Modification (N : Node_Id; Sure : Boolean);
1872 -- This routine is called if the sub-expression N maybe the target of
1873 -- an assignment (e.g. it is the left side of an assignment, used as
1874 -- an out parameters, or used as prefixes of access attributes). It
1875 -- sets May_Be_Modified in the associated entity if there is one,
1876 -- taking into account the rule that in the case of renamed objects,
1877 -- it is the flag in the renamed object that must be set.
1879 -- The parameter Sure is set True if the modification is sure to occur
1880 -- (e.g. target of assignment, or out parameter), and to False if the
1881 -- modification is only potential (e.g. address of entity taken).
1883 function Object_Access_Level (Obj : Node_Id) return Uint;
1884 -- Return the accessibility level of the view of the object Obj. For
1885 -- convenience, qualified expressions applied to object names are also
1886 -- allowed as actuals for this function.
1888 function Original_Aspect_Pragma_Name (N : Node_Id) return Name_Id;
1889 -- Retrieve the name of aspect or pragma N taking into account a possible
1890 -- rewrite and whether the pragma is generated from an aspect as the names
1891 -- may be different. The routine also deals with 'Class in which case it
1892 -- returns the following values:
1894 -- Invariant -> Name_uInvariant
1895 -- Post'Class -> Name_uPost
1896 -- Pre'Class -> Name_uPre
1897 -- Type_Invariant -> Name_uType_Invariant
1898 -- Type_Invariant'Class -> Name_uType_Invariant
1900 function Original_Corresponding_Operation (S : Entity_Id) return Entity_Id;
1901 -- [Ada 2012: AI05-0125-1]: If S is an inherited dispatching primitive S2,
1902 -- or overrides an inherited dispatching primitive S2, the original
1903 -- corresponding operation of S is the original corresponding operation of
1904 -- S2. Otherwise, it is S itself.
1906 function Policy_In_Effect (Policy : Name_Id) return Name_Id;
1907 -- Given a policy, return the policy identifier associated with it. If no
1908 -- such policy is in effect, the value returned is No_Name.
1910 function Predicate_Tests_On_Arguments (Subp : Entity_Id) return Boolean;
1911 -- Subp is the entity for a subprogram call. This function returns True if
1912 -- predicate tests are required for the arguments in this call (this is the
1913 -- normal case). It returns False for special cases where these predicate
1914 -- tests should be skipped (see body for details).
1916 function Primitive_Names_Match (E1, E2 : Entity_Id) return Boolean;
1917 -- Returns True if the names of both entities correspond with matching
1918 -- primitives. This routine includes support for the case in which one
1919 -- or both entities correspond with entities built by Derive_Subprogram
1920 -- with a special name to avoid being overridden (i.e. return true in case
1921 -- of entities with names "nameP" and "name" or vice versa).
1923 function Private_Component (Type_Id : Entity_Id) return Entity_Id;
1924 -- Returns some private component (if any) of the given Type_Id.
1925 -- Used to enforce the rules on visibility of operations on composite
1926 -- types, that depend on the full view of the component type. For a
1927 -- record type there may be several such components, we just return
1928 -- the first one.
1930 procedure Process_End_Label
1931 (N : Node_Id;
1932 Typ : Character;
1933 Ent : Entity_Id);
1934 -- N is a node whose End_Label is to be processed, generating all
1935 -- appropriate cross-reference entries, and performing style checks
1936 -- for any identifier references in the end label. Typ is either
1937 -- 'e' or 't indicating the type of the cross-reference entity
1938 -- (e for spec, t for body, see Lib.Xref spec for details). The
1939 -- parameter Ent gives the entity to which the End_Label refers,
1940 -- and to which cross-references are to be generated.
1942 procedure Record_Possible_Part_Of_Reference
1943 (Var_Id : Entity_Id;
1944 Ref : Node_Id);
1945 -- Save reference Ref to variable Var_Id when the variable is subject to
1946 -- pragma Part_Of. If the variable is known to be a constituent of a single
1947 -- protected/task type, the legality of the reference is verified and the
1948 -- save does not take place.
1950 function Referenced (Id : Entity_Id; Expr : Node_Id) return Boolean;
1951 -- Determine whether entity Id is referenced within expression Expr
1953 function References_Generic_Formal_Type (N : Node_Id) return Boolean;
1954 -- Returns True if the expression Expr contains any references to a
1955 -- generic type. This can only happen within a generic template.
1957 procedure Remove_Homonym (E : Entity_Id);
1958 -- Removes E from the homonym chain
1960 procedure Remove_Overloaded_Entity (Id : Entity_Id);
1961 -- Remove arbitrary entity Id from the homonym chain, the scope chain and
1962 -- the primitive operations list of the associated controlling type. NOTE:
1963 -- the removal performed by this routine does not affect the visibility of
1964 -- existing homonyms.
1966 function Remove_Suffix (E : Entity_Id; Suffix : Character) return Name_Id;
1967 -- Returns the name of E without Suffix
1969 function Rep_To_Pos_Flag (E : Entity_Id; Loc : Source_Ptr) return Node_Id;
1970 -- This is used to construct the second argument in a call to Rep_To_Pos
1971 -- which is Standard_True if range checks are enabled (E is an entity to
1972 -- which the Range_Checks_Suppressed test is applied), and Standard_False
1973 -- if range checks are suppressed. Loc is the location for the node that
1974 -- is returned (which is a New_Occurrence of the appropriate entity).
1976 -- Note: one might think that it would be fine to always use True and
1977 -- to ignore the suppress in this case, but it is generally better to
1978 -- believe a request to suppress exceptions if possible, and further
1979 -- more there is at least one case in the generated code (the code for
1980 -- array assignment in a loop) that depends on this suppression.
1982 procedure Require_Entity (N : Node_Id);
1983 -- N is a node which should have an entity value if it is an entity name.
1984 -- If not, then check if there were previous errors. If so, just fill
1985 -- in with Any_Id and ignore. Otherwise signal a program error exception.
1986 -- This is used as a defense mechanism against ill-formed trees caused by
1987 -- previous errors (particularly in -gnatq mode).
1989 function Requires_State_Refinement
1990 (Spec_Id : Entity_Id;
1991 Body_Id : Entity_Id) return Boolean;
1992 -- Determine whether a package denoted by its spec and body entities
1993 -- requires refinement of abstract states.
1995 function Requires_Transient_Scope (Id : Entity_Id) return Boolean;
1996 -- Id is a type entity. The result is True when temporaries of this type
1997 -- need to be wrapped in a transient scope to be reclaimed properly when a
1998 -- secondary stack is in use. Examples of types requiring such wrapping are
1999 -- controlled types and variable-sized types including unconstrained
2000 -- arrays.
2002 procedure Reset_Analyzed_Flags (N : Node_Id);
2003 -- Reset the Analyzed flags in all nodes of the tree whose root is N
2005 procedure Restore_SPARK_Mode (Mode : SPARK_Mode_Type);
2006 -- Set the current SPARK_Mode to whatever Mode denotes. This routime must
2007 -- be used in tandem with Save_SPARK_Mode_And_Set.
2009 function Returns_Unconstrained_Type (Subp : Entity_Id) return Boolean;
2010 -- Return true if Subp is a function that returns an unconstrained type
2012 function Root_Type_Of_Full_View (T : Entity_Id) return Entity_Id;
2013 -- Similar to attribute Root_Type, but this version always follows the
2014 -- Full_View of a private type (if available) while searching for the
2015 -- ultimate derivation ancestor.
2017 function Safe_To_Capture_Value
2018 (N : Node_Id;
2019 Ent : Entity_Id;
2020 Cond : Boolean := False) return Boolean;
2021 -- The caller is interested in capturing a value (either the current value,
2022 -- or an indication that the value is non-null) for the given entity Ent.
2023 -- This value can only be captured if sequential execution semantics can be
2024 -- properly guaranteed so that a subsequent reference will indeed be sure
2025 -- that this current value indication is correct. The node N is the
2026 -- construct which resulted in the possible capture of the value (this
2027 -- is used to check if we are in a conditional).
2029 -- Cond is used to skip the test for being inside a conditional. It is used
2030 -- in the case of capturing values from if/while tests, which already do a
2031 -- proper job of handling scoping issues without this help.
2033 -- The only entities whose values can be captured are OUT and IN OUT formal
2034 -- parameters, and variables unless Cond is True, in which case we also
2035 -- allow IN formals, loop parameters and constants, where we cannot ever
2036 -- capture actual value information, but we can capture conditional tests.
2038 function Same_Name (N1, N2 : Node_Id) return Boolean;
2039 -- Determine if two (possibly expanded) names are the same name. This is
2040 -- a purely syntactic test, and N1 and N2 need not be analyzed.
2042 function Same_Object (Node1, Node2 : Node_Id) return Boolean;
2043 -- Determine if Node1 and Node2 are known to designate the same object.
2044 -- This is a semantic test and both nodes must be fully analyzed. A result
2045 -- of True is decisively correct. A result of False does not necessarily
2046 -- mean that different objects are designated, just that this could not
2047 -- be reliably determined at compile time.
2049 function Same_Type (T1, T2 : Entity_Id) return Boolean;
2050 -- Determines if T1 and T2 represent exactly the same type. Two types
2051 -- are the same if they are identical, or if one is an unconstrained
2052 -- subtype of the other, or they are both common subtypes of the same
2053 -- type with identical constraints. The result returned is conservative.
2054 -- It is True if the types are known to be the same, but a result of
2055 -- False is indecisive (e.g. the compiler may not be able to tell that
2056 -- two constraints are identical).
2058 function Same_Value (Node1, Node2 : Node_Id) return Boolean;
2059 -- Determines if Node1 and Node2 are known to be the same value, which is
2060 -- true if they are both compile time known values and have the same value,
2061 -- or if they are the same object (in the sense of function Same_Object).
2062 -- A result of False does not necessarily mean they have different values,
2063 -- just that it is not possible to determine they have the same value.
2065 procedure Save_SPARK_Mode_And_Set
2066 (Context : Entity_Id;
2067 Mode : out SPARK_Mode_Type);
2068 -- Save the current SPARK_Mode in effect in Mode. Establish the SPARK_Mode
2069 -- (if any) of a package or a subprogram denoted by Context. This routine
2070 -- must be used in tandem with Restore_SPARK_Mode.
2072 function Scalar_Part_Present (T : Entity_Id) return Boolean;
2073 -- Tests if type T can be determined at compile time to have at least one
2074 -- scalar part in the sense of the Valid_Scalars attribute. Returns True if
2075 -- this is the case, and False if no scalar parts are present (meaning that
2076 -- the result of Valid_Scalars applied to T is always vacuously True).
2078 function Scope_Within_Or_Same (Scope1, Scope2 : Entity_Id) return Boolean;
2079 -- Determines if the entity Scope1 is the same as Scope2, or if it is
2080 -- inside it, where both entities represent scopes. Note that scopes
2081 -- are only partially ordered, so Scope_Within_Or_Same (A,B) and
2082 -- Scope_Within_Or_Same (B,A) can both be False for a given pair A,B.
2084 function Scope_Within (Scope1, Scope2 : Entity_Id) return Boolean;
2085 -- Like Scope_Within_Or_Same, except that this function returns
2086 -- False in the case where Scope1 and Scope2 are the same scope.
2088 procedure Set_Convention (E : Entity_Id; Val : Convention_Id);
2089 -- Same as Basic_Set_Convention, but with an extra check for access types.
2090 -- In particular, if E is an access-to-subprogram type, and Val is a
2091 -- foreign convention, then we set Can_Use_Internal_Rep to False on E.
2092 -- Also, if the Etype of E is set and is an anonymous access type with
2093 -- no convention set, this anonymous type inherits the convention of E.
2095 procedure Set_Current_Entity (E : Entity_Id);
2096 pragma Inline (Set_Current_Entity);
2097 -- Establish the entity E as the currently visible definition of its
2098 -- associated name (i.e. the Node_Id associated with its name).
2100 procedure Set_Debug_Info_Needed (T : Entity_Id);
2101 -- Sets the Debug_Info_Needed flag on entity T , and also on any entities
2102 -- that are needed by T (for an object, the type of the object is needed,
2103 -- and for a type, various subsidiary types are needed -- see body for
2104 -- details). Never has any effect on T if the Debug_Info_Off flag is set.
2105 -- This routine should always be used instead of Set_Needs_Debug_Info to
2106 -- ensure that subsidiary entities are properly handled.
2108 procedure Set_Entity_With_Checks (N : Node_Id; Val : Entity_Id);
2109 -- This procedure has the same calling sequence as Set_Entity, but it
2110 -- performs additional checks as follows:
2112 -- If Style_Check is set, then it calls a style checking routine which
2113 -- can check identifier spelling style. This procedure also takes care
2114 -- of checking the restriction No_Implementation_Identifiers.
2116 -- If restriction No_Abort_Statements is set, then it checks that the
2117 -- entity is not Ada.Task_Identification.Abort_Task.
2119 -- If restriction No_Dynamic_Attachment is set, then it checks that the
2120 -- entity is not one of the restricted names for this restriction.
2122 -- If restriction No_Long_Long_Integers is set, then it checks that the
2123 -- entity is not Standard.Long_Long_Integer.
2125 -- If restriction No_Implementation_Identifiers is set, then it checks
2126 -- that the entity is not implementation defined.
2128 procedure Set_Name_Entity_Id (Id : Name_Id; Val : Entity_Id);
2129 pragma Inline (Set_Name_Entity_Id);
2130 -- Sets the Entity_Id value associated with the given name, which is the
2131 -- Id of the innermost visible entity with the given name. See the body
2132 -- of package Sem_Ch8 for further details on the handling of visibility.
2134 procedure Set_Next_Actual (Ass1_Id : Node_Id; Ass2_Id : Node_Id);
2135 -- The arguments may be parameter associations, whose descendants
2136 -- are the optional formal name and the actual parameter. Positional
2137 -- parameters are already members of a list, and do not need to be
2138 -- chained separately. See also First_Actual and Next_Actual.
2140 procedure Set_Optimize_Alignment_Flags (E : Entity_Id);
2141 pragma Inline (Set_Optimize_Alignment_Flags);
2142 -- Sets Optimize_Alignment_Space/Time flags in E from current settings
2144 procedure Set_Public_Status (Id : Entity_Id);
2145 -- If an entity (visible or otherwise) is defined in a library
2146 -- package, or a package that is itself public, then this subprogram
2147 -- labels the entity public as well.
2149 procedure Set_Referenced_Modified (N : Node_Id; Out_Param : Boolean);
2150 -- N is the node for either a left hand side (Out_Param set to False),
2151 -- or an Out or In_Out parameter (Out_Param set to True). If there is
2152 -- an assignable entity being referenced, then the appropriate flag
2153 -- (Referenced_As_LHS if Out_Param is False, Referenced_As_Out_Parameter
2154 -- if Out_Param is True) is set True, and the other flag set False.
2156 procedure Set_Scope_Is_Transient (V : Boolean := True);
2157 -- Set the flag Is_Transient of the current scope
2159 procedure Set_Size_Info (T1, T2 : Entity_Id);
2160 pragma Inline (Set_Size_Info);
2161 -- Copies the Esize field and Has_Biased_Representation flag from sub(type)
2162 -- entity T2 to (sub)type entity T1. Also copies the Is_Unsigned_Type flag
2163 -- in the fixed-point and discrete cases, and also copies the alignment
2164 -- value from T2 to T1. It does NOT copy the RM_Size field, which must be
2165 -- separately set if this is required to be copied also.
2167 function Scope_Is_Transient return Boolean;
2168 -- True if the current scope is transient
2170 function Static_Boolean (N : Node_Id) return Uint;
2171 -- This function analyzes the given expression node and then resolves it
2172 -- as Standard.Boolean. If the result is static, then Uint_1 or Uint_0 is
2173 -- returned corresponding to the value, otherwise an error message is
2174 -- output and No_Uint is returned.
2176 function Static_Integer (N : Node_Id) return Uint;
2177 -- This function analyzes the given expression node and then resolves it
2178 -- as any integer type. If the result is static, then the value of the
2179 -- universal expression is returned, otherwise an error message is output
2180 -- and a value of No_Uint is returned.
2182 function Statically_Different (E1, E2 : Node_Id) return Boolean;
2183 -- Return True if it can be statically determined that the Expressions
2184 -- E1 and E2 refer to different objects
2186 function Subject_To_Loop_Entry_Attributes (N : Node_Id) return Boolean;
2187 -- Determine whether node N is a loop statement subject to at least one
2188 -- 'Loop_Entry attribute.
2190 function Subprogram_Access_Level (Subp : Entity_Id) return Uint;
2191 -- Return the accessibility level of the view denoted by Subp
2193 function Support_Atomic_Primitives (Typ : Entity_Id) return Boolean;
2194 -- Return True if Typ supports the GCC built-in atomic operations (i.e. if
2195 -- Typ is properly sized and aligned).
2197 procedure Trace_Scope (N : Node_Id; E : Entity_Id; Msg : String);
2198 -- Print debugging information on entry to each unit being analyzed
2200 procedure Transfer_Entities (From : Entity_Id; To : Entity_Id);
2201 -- Move a list of entities from one scope to another, and recompute
2202 -- Is_Public based upon the new scope.
2204 function Type_Access_Level (Typ : Entity_Id) return Uint;
2205 -- Return the accessibility level of Typ
2207 function Type_Without_Stream_Operation
2208 (T : Entity_Id;
2209 Op : TSS_Name_Type := TSS_Null) return Entity_Id;
2210 -- AI05-0161: In Ada 2012, if the restriction No_Default_Stream_Attributes
2211 -- is active then we cannot generate stream subprograms for composite types
2212 -- with elementary subcomponents that lack user-defined stream subprograms.
2213 -- This predicate determines whether a type has such an elementary
2214 -- subcomponent. If Op is TSS_Null, a type that lacks either Read or Write
2215 -- prevents the construction of a composite stream operation. If Op is
2216 -- specified we check only for the given stream operation.
2218 function Unique_Defining_Entity (N : Node_Id) return Entity_Id;
2219 -- Return the entity which represents declaration N, so that different
2220 -- views of the same entity have the same unique defining entity:
2221 -- * entry declaration and entry body
2222 -- * package spec and body
2223 -- * protected type declaration, protected body stub and protected body
2224 -- * private view and full view of a deferred constant
2225 -- * private view and full view of a type
2226 -- * subprogram declaration, subprogram stub and subprogram body
2227 -- * task type declaration, task body stub and task body
2228 -- In other cases, return the defining entity for N.
2230 function Unique_Entity (E : Entity_Id) return Entity_Id;
2231 -- Return the unique entity for entity E, which would be returned by
2232 -- Unique_Defining_Entity if applied to the enclosing declaration of E.
2234 function Unique_Name (E : Entity_Id) return String;
2235 -- Return a unique name for entity E, which could be used to identify E
2236 -- across compilation units.
2238 function Unit_Is_Visible (U : Entity_Id) return Boolean;
2239 -- Determine whether a compilation unit is visible in the current context,
2240 -- because there is a with_clause that makes the unit available. Used to
2241 -- provide better messages on common visiblity errors on operators.
2243 function Universal_Interpretation (Opnd : Node_Id) return Entity_Id;
2244 -- Yields Universal_Integer or Universal_Real if this is a candidate
2246 function Unqualify (Expr : Node_Id) return Node_Id;
2247 pragma Inline (Unqualify);
2248 -- Removes any qualifications from Expr. For example, for T1'(T2'(X)), this
2249 -- returns X. If Expr is not a qualified expression, returns Expr.
2251 function Visible_Ancestors (Typ : Entity_Id) return Elist_Id;
2252 -- [Ada 2012:AI-0125-1]: Collect all the visible parents and progenitors
2253 -- of a type extension or private extension declaration. If the full-view
2254 -- of private parents and progenitors is available then it is used to
2255 -- generate the list of visible ancestors; otherwise their partial
2256 -- view is added to the resulting list.
2258 function Within_Init_Proc return Boolean;
2259 -- Determines if Current_Scope is within an init proc
2261 function Within_Scope (E : Entity_Id; S : Entity_Id) return Boolean;
2262 -- Returns True if entity E is declared within scope S
2264 procedure Wrong_Type (Expr : Node_Id; Expected_Type : Entity_Id);
2265 -- Output error message for incorrectly typed expression. Expr is the node
2266 -- for the incorrectly typed construct (Etype (Expr) is the type found),
2267 -- and Expected_Type is the entity for the expected type. Note that Expr
2268 -- does not have to be a subexpression, anything with an Etype field may
2269 -- be used.
2271 function Yields_Synchronized_Object (Typ : Entity_Id) return Boolean;
2272 -- Determine whether type Typ "yields synchronized object" as specified by
2273 -- SPARK RM 9.1. To qualify as such, a type must be
2274 -- * An array type whose element type yields a synchronized object
2275 -- * A descendant of type Ada.Synchronous_Task_Control.Suspension_Object
2276 -- * A protected type
2277 -- * A record type or type extension without defaulted discriminants
2278 -- whose components are of a type that yields a synchronized object.
2279 -- * A synchronized interface type
2280 -- * A task type
2282 end Sem_Util;