[Ada] Optimize away certain elaboration checks
[official-gcc.git] / gcc / ada / sinfo.ads
blob71da7fc583e1aa028ea41cd961172be3f024b5c7
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S I N F O --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2021, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 -- This package documents the structure of the abstract syntax tree. The Atree
27 -- package provides a basic tree structure. Sinfo describes how this structure
28 -- is used to represent the syntax of an Ada program.
30 -- The grammar in the RM is followed very closely in the tree design, and is
31 -- repeated as part of this source file.
33 -- The tree contains not only the full syntactic representation of the
34 -- program, but also the results of semantic analysis. In particular, the
35 -- nodes for defining identifiers, defining character literals, and defining
36 -- operator symbols, collectively referred to as entities, represent what
37 -- would normally be regarded as the symbol table information. In addition a
38 -- number of the tree nodes contain semantic information.
40 -- See the spec of Gen_IL.Gen for instructions on making changes to this file.
41 -- Note that the official definition of what nodes have what fields is in
42 -- Gen_IL.Gen.Gen_Nodes; if there is a discrepancy between that and the
43 -- comments here, Gen_IL.Gen.Gen_Nodes wins.
45 pragma Warnings (Off); -- with/use clauses for children
46 with Namet; use Namet;
47 with Types; use Types;
48 with Uintp; use Uintp;
49 with Urealp; use Urealp;
50 pragma Warnings (On);
52 package Sinfo is
54 ----------------------------------------
55 -- Definitions of fields in tree node --
56 ----------------------------------------
58 -- The following fields are common to all nodes:
60 -- Nkind Indicates the kind of the node. This field is present
61 -- in all nodes.
63 -- Sloc Location (Source_Ptr) of the corresponding token
64 -- in the Source buffer. The individual node definitions
65 -- show which token is referenced by this pointer.
67 -- In_List A flag used to indicate if the node is a member
68 -- of a node list (see package Nlists).
70 -- Rewrite_Ins A flag set if a node is marked as a rewrite inserted
71 -- node as a result of a call to Mark_Rewrite_Insertion.
73 -- Small_Paren_Count
74 -- A 2-bit count used in subexpression nodes to indicate
75 -- the level of parentheses. The settings are 0,1,2 and
76 -- 3 for many. If the value is 3, then an auxiliary table
77 -- is used to indicate the real value, which is computed by
78 -- Paren_Count. Set to zero for nonsubexpression nodes.
80 -- Note: the required parentheses surrounding conditional
81 -- and quantified expressions count as a level of parens
82 -- for this purpose, so e.g. in X := (if A then B else C);
83 -- Paren_Count for the right side will be 1.
85 -- Comes_From_Source
86 -- This flag is present in all nodes. It is set if the
87 -- node is built by the scanner or parser, and clear if
88 -- the node is built by the analyzer or expander. It
89 -- indicates that the node corresponds to a construct
90 -- that appears in the original source program.
92 -- Analyzed This flag is present in all nodes. It is set when
93 -- a node is analyzed, and is used to avoid analyzing
94 -- the same node twice. Analysis includes expansion if
95 -- expansion is active, so in this case if the flag is
96 -- set it means the node has been analyzed and expanded.
98 -- Error_Posted This flag is present in all nodes. It is set when
99 -- an error message is posted which is associated with
100 -- the flagged node. This is used to avoid posting more
101 -- than one message on the same node.
103 -- Link For a node, points to the Parent. For a list, points
104 -- to the list header. Note that in the latter case, a
105 -- client cannot modify the link field. This field is
106 -- private to the Atree package (but is also modified
107 -- by the Nlists package).
109 -- The following additional fields are common to all entities (that is,
110 -- nodes whose Nkind is in N_Entity):
112 -- Ekind Entity type.
114 -- Convention Entity convention (Convention_Id value)
116 --------------------------------
117 -- Implicit Nodes in the Tree --
118 --------------------------------
120 -- Generally the structure of the tree very closely follows the grammar as
121 -- defined in the RM. However, certain nodes are omitted to save space and
122 -- simplify semantic processing. Two general classes of such omitted nodes
123 -- are as follows:
125 -- If the only possibilities for a non-terminal are one or more other
126 -- non-terminals (i.e. the rule is a "skinny" rule), then usually the
127 -- corresponding node is omitted from the tree, and the target construct
128 -- appears directly. For example, a real type definition is either
129 -- floating point definition or a fixed point definition. No explicit node
130 -- appears for real type definition. Instead either the floating point
131 -- definition or fixed point definition appears directly.
133 -- If a non-terminal corresponds to a list of some other non-terminal
134 -- (possibly with separating punctuation), then usually it is omitted from
135 -- the tree, and a list of components appears instead. For example,
136 -- sequence of statements does not appear explicitly in the tree. Instead
137 -- a list of statements appears directly.
139 -- Some additional cases of omitted nodes occur and are documented
140 -- individually. In particular, many nodes are omitted in the tree
141 -- generated for an expression.
143 -------------------------------------------
144 -- Handling of Defining Identifier Lists --
145 -------------------------------------------
147 -- In several declarative forms in the syntax, lists of defining
148 -- identifiers appear (object declarations, component declarations, number
149 -- declarations etc.)
151 -- The semantics of such statements are equivalent to a series of identical
152 -- declarations of single defining identifiers (except that conformance
153 -- checks require the same grouping of identifiers in the parameter case).
155 -- To simplify semantic processing, the parser breaks down such multiple
156 -- declaration cases into sequences of single declarations, duplicating
157 -- type and initialization information as required. The flags More_Ids and
158 -- Prev_Ids are used to record the original form of the source in the case
159 -- where the original source used a list of names, More_Ids being set on
160 -- all but the last name and Prev_Ids being set on all but the first name.
161 -- These flags are used to reconstruct the original source (e.g. in the
162 -- Sprint package), and also are included in the conformance checks, but
163 -- otherwise have no semantic significance.
165 -- Note: the reason that we use More_Ids and Prev_Ids rather than
166 -- First_Name and Last_Name flags is so that the flags are off in the
167 -- normal one identifier case, which minimizes tree print output.
169 -----------------------
170 -- Use of Node Lists --
171 -----------------------
173 -- With a few exceptions, if a construction of the form {non-terminal}
174 -- appears in the tree, lists are used in the corresponding tree node (see
175 -- package Nlists for handling of node lists). In this case a field of the
176 -- parent node points to a list of nodes for the non-terminal. The field
177 -- name for such fields has a plural name which always ends in "s". For
178 -- example, a case statement has a field Alternatives pointing to list of
179 -- case statement alternative nodes.
181 -- Only fields pointing to lists have names ending in "s", so generally the
182 -- structure is strongly typed, fields not ending in s point to single
183 -- nodes, and fields ending in s point to lists.
185 -- The following example shows how a traversal of a list is written. We
186 -- suppose here that Stmt points to a N_Case_Statement node which has a
187 -- list field called Alternatives:
189 -- Alt := First (Alternatives (Stmt));
190 -- while Present (Alt) loop
191 -- ..
192 -- -- processing for case statement alternative Alt
193 -- ..
194 -- Alt := Next (Alt);
195 -- end loop;
197 -- The Present function tests for Empty, which in this case signals the end
198 -- of the list. First returns Empty immediately if the list is empty.
199 -- Present is defined in Atree; First and Next are defined in Nlists.
201 -- The exceptions to this rule occur with {DEFINING_IDENTIFIERS} in all
202 -- contexts, which is handled as described in the previous section, and
203 -- with {,library_unit_NAME} in the N_With_Clause mode, which is handled
204 -- using the First_Name and Last_Name flags, as further detailed in the
205 -- description of the N_With_Clause node.
207 -------------
208 -- Pragmas --
209 -------------
211 -- Pragmas can appear in many different context, but are not included in
212 -- the grammar. Still they must appear in the tree, so they can be properly
213 -- processed.
215 -- Two approaches are used. In some cases, an extra field is defined in an
216 -- appropriate node that contains a list of pragmas appearing in the
217 -- expected context. For example pragmas can appear before an
218 -- Accept_Alternative in a Selective_Accept_Statement, and these pragmas
219 -- appear in the Pragmas_Before field of the N_Accept_Alternative node.
221 -- The other approach is to simply allow pragmas to appear in syntactic
222 -- lists where the grammar (of course) does not include the possibility.
223 -- For example, the Variants field of an N_Variant_Part node points to a
224 -- list that can contain both N_Pragma and N_Variant nodes.
226 -- To make processing easier in the latter case, the Nlists package
227 -- provides a set of routines (First_Non_Pragma, Last_Non_Pragma,
228 -- Next_Non_Pragma, Prev_Non_Pragma) that allow such lists to be handled
229 -- ignoring all pragmas.
231 -- In the case of the variants list, we can either write:
233 -- Variant := First (Variants (N));
234 -- while Present (Variant) loop
235 -- ...
236 -- Variant := Next (Variant);
237 -- end loop;
239 -- or
241 -- Variant := First_Non_Pragma (Variants (N));
242 -- while Present (Variant) loop
243 -- ...
244 -- Variant := Next_Non_Pragma (Variant);
245 -- end loop;
247 -- In the first form of the loop, Variant can either be an N_Pragma or an
248 -- N_Variant node. In the second form, Variant can only be N_Variant since
249 -- all pragmas are skipped.
251 ---------------------
252 -- Optional Fields --
253 ---------------------
255 -- Fields which correspond to a section of the syntax enclosed in square
256 -- brackets are generally omitted (and the corresponding field set to Empty
257 -- for a node, or No_List for a list). The documentation of such fields
258 -- notes these cases. One exception to this rule occurs in the case of
259 -- possibly empty statement sequences (such as the sequence of statements
260 -- in an entry call alternative). Such cases appear in the syntax rules as
261 -- [SEQUENCE_OF_STATEMENTS] and the fields corresponding to such optional
262 -- statement sequences always contain an empty list (not No_List) if no
263 -- statements are present.
265 -- Note: the utility program that constructs the body and spec of the Nmake
266 -- package relies on the format of the comments to determine if a field
267 -- should have a default value in the corresponding make routine. The rule
268 -- is that if the first line of the description of the field contains the
269 -- string "(set to xxx if", then a default value of xxx is provided for
270 -- this field in the corresponding Make_yyy routine.
272 -----------------------------------
273 -- Note on Body/Spec Terminology --
274 -----------------------------------
276 -- In informal discussions about Ada, it is customary to refer to package
277 -- and subprogram specs and bodies. However, this is not technically
278 -- correct, what is normally referred to as a spec or specification is in
279 -- fact a package declaration or subprogram declaration. We are careful in
280 -- GNAT to use the correct terminology and in particular, the full word
281 -- specification is never used as an incorrect substitute for declaration.
282 -- The structure and terminology used in the tree also reflects the grammar
283 -- and thus uses declaration and specification in the technically correct
284 -- manner.
286 -- However, there are contexts in which the informal terminology is useful.
287 -- We have the word "body" to refer to the Interp_Etype declared by the
288 -- declaration of a unit body, and in some contexts we need similar term to
289 -- refer to the entity declared by the package or subprogram declaration,
290 -- and simply using declaration can be confusing since the body also has a
291 -- declaration.
293 -- An example of such a context is the link between the package body and
294 -- its declaration. With_Declaration is confusing, since the package body
295 -- itself is a declaration.
297 -- To deal with this problem, we reserve the informal term Spec, i.e. the
298 -- popular abbreviation used in this context, to refer to the entity
299 -- declared by the package or subprogram declaration. So in the above
300 -- example case, the field in the body is called With_Spec.
302 -- Another important context for the use of the word Spec is in error
303 -- messages, where a hyper-correct use of declaration would be confusing to
304 -- a typical Ada programmer, and even for an expert programmer can cause
305 -- confusion since the body has a declaration as well.
307 -- So, to summarize:
309 -- Declaration always refers to the syntactic entity that is called
310 -- a declaration. In particular, subprogram declaration
311 -- and package declaration are used to describe the
312 -- syntactic entity that includes the semicolon.
314 -- Specification always refers to the syntactic entity that is called
315 -- a specification. In particular, the terms procedure
316 -- specification, function specification, package
317 -- specification, subprogram specification always refer
318 -- to the syntactic entity that has no semicolon.
320 -- Spec is an informal term, used to refer to the entity
321 -- that is declared by a task declaration, protected
322 -- declaration, generic declaration, subprogram
323 -- declaration or package declaration.
325 -- This convention is followed throughout the GNAT documentation
326 -- both internal and external, and in all error message text.
328 ------------------------
329 -- Internal Use Nodes --
330 ------------------------
332 -- These are Node_Kind settings used in the internal implementation which
333 -- are not logically part of the specification.
335 -- N_Unused_At_Start
336 -- Completely unused entry at the start of the enumeration type. This
337 -- is inserted so that no legitimate value is zero, which helps to get
338 -- better debugging behavior, since zero is a likely uninitialized value).
340 -- N_Unused_At_End
341 -- Completely unused entry at the end of the enumeration type. This is
342 -- handy so that arrays with Node_Kind as the index type have an extra
343 -- entry at the end (see for example the use of the Pchar_Pos_Array in
344 -- Treepr, where the extra entry provides the limit value when dealing with
345 -- the last used entry in the array).
347 -----------------------------------------
348 -- Note on the settings of Sloc fields --
349 -----------------------------------------
351 -- The Sloc field of nodes that come from the source is set by the parser.
352 -- For internal nodes, and nodes generated during expansion the Sloc is
353 -- usually set in the call to the constructor for the node. In general the
354 -- Sloc value chosen for an internal node is the Sloc of the source node
355 -- whose processing is responsible for the expansion. For example, the Sloc
356 -- of an inherited primitive operation is the Sloc of the corresponding
357 -- derived type declaration.
359 -- For the nodes of a generic instantiation, the Sloc value is encoded to
360 -- represent both the original Sloc in the generic unit, and the Sloc of
361 -- the instantiation itself. See Sinput.ads for details.
363 -- Subprogram instances create two callable entities: one is the visible
364 -- subprogram instance, and the other is an anonymous subprogram nested
365 -- within a wrapper package that contains the renamings for the actuals.
366 -- Both of these entities have the Sloc of the defining entity in the
367 -- instantiation node. This simplified for instance in the past some ASIS
368 -- queries.
370 -----------------------
371 -- Field Definitions --
372 -----------------------
374 -- In the following node definitions, all fields, both syntactic and
375 -- semantic, are documented. The one exception is in the case of entities
376 -- (defining identifiers, character literals, and operator symbols), where
377 -- the usage of the fields depends on the entity kind. Entity fields are
378 -- fully documented in the separate package Einfo.
380 -- In the node definitions, three common sets of fields are abbreviated to
381 -- save both space in the documentation, and also space in the string
382 -- (defined in Tree_Print_Strings) used to print trees. The following
383 -- abbreviations are used:
385 -- "plus fields for binary operator"
386 -- Chars Name_Id for the operator
387 -- Left_Opnd left operand expression
388 -- Right_Opnd right operand expression
389 -- Entity defining entity for operator
390 -- Associated_Node for generic processing
391 -- Do_Overflow_Check set if overflow check needed
392 -- Has_Private_View set in generic units.
394 -- "plus fields for unary operator"
395 -- Chars Name_Id for the operator
396 -- Right_Opnd right operand expression
397 -- Entity defining entity for operator
398 -- Associated_Node for generic processing
399 -- Do_Overflow_Check set if overflow check needed
400 -- Has_Private_View set in generic units.
402 -- "plus fields for expression"
403 -- Paren_Count number of parentheses levels
404 -- Etype type of the expression
405 -- Is_Overloaded >1 type interpretation exists
406 -- Is_Static_Expression set for static expression
407 -- Raises_Constraint_Error evaluation raises CE
408 -- Must_Not_Freeze set if must not freeze
409 -- Do_Range_Check set if a range check needed
410 -- Has_Dynamic_Length_Check set if length check inserted
411 -- Assignment_OK set if modification is OK
412 -- Is_Controlling_Actual set for controlling argument
414 -- Note: the utility program that creates the Treeprs spec (in the file
415 -- xtreeprs.adb) knows about the special fields here, so it must be
416 -- modified if any change is made to these fields.
418 -- Note: see under (EXPRESSION) for further details on the use of
419 -- the Paren_Count field to record the number of parentheses levels.
421 -- Node_Kind is the type used in the Nkind field to indicate the node kind.
422 -- The actual definition of this type is given later (the reason for this
423 -- is that we want the descriptions ordered by logical chapter in the RM,
424 -- but the type definition is reordered to facilitate the definition of
425 -- some subtype ranges. The individual descriptions of the nodes show how
426 -- the various fields are used in each node kind, as well as providing
427 -- logical names for the fields. Functions and procedures are provided for
428 -- accessing and setting these fields using these logical names.
430 -----------------------
431 -- Gigi Restrictions --
432 -----------------------
434 -- The tree passed to Gigi is more restricted than the general tree form.
435 -- For example, as a result of expansion, most of the tasking nodes can
436 -- never appear. For each node to which either a complete or partial
437 -- restriction applies, a note entitled "Gigi restriction" appears which
438 -- documents the restriction.
440 -- Note that most of these restrictions apply only to trees generated when
441 -- code is being generated, since they involved expander actions that
442 -- destroy the tree.
444 ----------------
445 -- Ghost Mode --
446 ----------------
448 -- The SPARK RM 6.9 defines two classes of constructs - Ghost entities and
449 -- Ghost statements. The intent of the feature is to treat Ghost constructs
450 -- as non-existent when Ghost assertion policy Ignore is in effect.
452 -- The corresponding nodes which map to Ghost constructs are:
454 -- Ghost entities
455 -- Declaration nodes
456 -- N_Package_Body
457 -- N_Subprogram_Body
459 -- Ghost statements
460 -- N_Assignment_Statement
461 -- N_Procedure_Call_Statement
462 -- N_Pragma
464 -- In addition, the compiler treats instantiations as Ghost entities
466 -- To achieve the removal of ignored Ghost constructs, the compiler relies
467 -- on global variables Ghost_Mode and Ignored_Ghost_Region, which comprise
468 -- a mechanism called "Ghost regions".
470 -- The values of Ghost_Mode are as follows:
472 -- 1. Check - All static semantics as defined in SPARK RM 6.9 are in
473 -- effect. The Ghost region has mode Check.
475 -- 2. Ignore - Same as Check, ignored Ghost code is not present in ALI
476 -- files, object files, and the final executable. The Ghost region
477 -- has mode Ignore.
479 -- 3. None - No Ghost region is in effect
481 -- The value of Ignored_Ghost_Region captures the node which initiates an
482 -- ignored Ghost region.
484 -- A Ghost region is a compiler operating mode, similar to Check_Syntax,
485 -- however a region is much more finely grained and depends on the policy
486 -- in effect. The region starts prior to the analysis of a Ghost construct
487 -- and ends immediately after its expansion. The region is established as
488 -- follows:
490 -- 1. Declarations - Prior to analysis, if the declaration is subject to
491 -- pragma Ghost.
493 -- 2. Renaming declarations - Same as 1) or when the renamed entity is
494 -- Ghost.
496 -- 3. Completing declarations - Same as 1) or when the declaration is
497 -- partially analyzed and the declaration completes a Ghost entity.
499 -- 4. N_Package_Body, N_Subprogram_Body - Same as 1) or when the body is
500 -- partially analyzed and completes a Ghost entity.
502 -- 5. N_Assignment_Statement - After the left hand side is analyzed and
503 -- references a Ghost entity.
505 -- 6. N_Procedure_Call_Statement - After the name is analyzed and denotes
506 -- a Ghost procedure.
508 -- 7. N_Pragma - During analysis, when the related entity is Ghost or the
509 -- pragma encloses a Ghost entity.
511 -- 8. Instantiations - Save as 1) or when the instantiation is partially
512 -- analyzed and the generic template is Ghost.
514 -- The following routines install a new Ghost region:
516 -- Install_Ghost_Region
517 -- Mark_And_Set_Ghost_xxx
518 -- Set_Ghost_Mode
520 -- The following routine ends a Ghost region:
522 -- Restore_Ghost_Region
524 -- A region may be reinstalled similarly to scopes for decoupled expansion
525 -- such as the generation of dispatch tables or the creation of a predicate
526 -- function.
528 -- If the mode of a Ghost region is Ignore, any newly created nodes as well
529 -- as source entities are marked as ignored Ghost. In additon, the marking
530 -- process signals all enclosing scopes that an ignored Ghost node resides
531 -- within. The compilation unit where the node resides is also added to an
532 -- auxiliary table for post processing.
534 -- After the analysis and expansion of all compilation units takes place
535 -- as well as the instantiation of all inlined [generic] bodies, the GNAT
536 -- driver initiates a separate pass which removes all ignored Ghost nodes
537 -- from all units stored in the auxiliary table.
539 --------------------
540 -- GNATprove Mode --
541 --------------------
543 -- When a file is compiled in GNATprove mode (-gnatd.F), a very light
544 -- expansion is performed and the analysis must generate a tree in a
545 -- form that meets additional requirements.
547 -- This light expansion does two transformations of the tree that cannot
548 -- be postponed till after semantic analysis:
550 -- 1. Replace object renamings by renamed object. This requires the
551 -- introduction of temporaries at the point of the renaming, which
552 -- must be properly analyzed.
554 -- 2. Fully qualify entity names. This is needed to generate suitable
555 -- local effects and call-graphs in ALI files, with the completely
556 -- qualified names (in particular the suffix to distinguish homonyms).
558 -- The tree after this light expansion should be fully analyzed
559 -- semantically, which sometimes requires the insertion of semantic
560 -- preanalysis, for example for subprogram contracts and pragma
561 -- check/assert. In particular, all expression must have their proper type,
562 -- and semantic links should be set between tree nodes (partial to full
563 -- view, etc.) Some kinds of nodes should be either absent, or can be
564 -- ignored by the formal verification backend:
566 -- N_Object_Renaming_Declaration: can be ignored safely
567 -- N_Expression_Function: absent (rewritten)
568 -- N_Expression_With_Actions: absent (not generated)
570 -- SPARK cross-references are generated from the regular cross-references
571 -- (used for browsing and code understanding) and additional references
572 -- collected during semantic analysis, in particular on all dereferences.
573 -- These SPARK cross-references are output in a separate section of ALI
574 -- files, as described in spark_xrefs.adb. They are the basis for the
575 -- computation of data dependences in GNATprove. This implies that all
576 -- cross-references should be generated in this mode, even those that would
577 -- not make sense from a user point-of-view, and that cross-references that
578 -- do not lead to data dependences for subprograms can be safely ignored.
580 -- GNATprove relies on the following front end behaviors:
582 -- 1. The first declarations in the list of visible declarations of
583 -- a package declaration for a generic instance, up to the first
584 -- declaration which comes from source, should correspond to
585 -- the "mappings nodes" between formal and actual generic parameters.
587 -- 2. In addition pragma Debug statements are removed from the tree
588 -- (rewritten to NULL stmt), since they should be ignored in formal
589 -- verification.
591 -- 3. An error is also issued for missing subunits, similar to the
592 -- warning issued when generating code, to avoid formal verification
593 -- of a partial unit.
595 -- 4. Unconstrained types are not replaced by constrained types whose
596 -- bounds are generated from an expression: Expand_Subtype_From_Expr
597 -- should be a no-op.
599 -- 5. Errors (instead of warnings) are issued on compile-time-known
600 -- constraint errors even though such cases do not correspond to
601 -- illegalities in the Ada RM (this is simply another case where
602 -- GNATprove implements a subset of the full language).
604 -- However, there are a few exceptions to this rule for cases where
605 -- we want to allow the GNATprove analysis to proceed (e.g. range
606 -- checks on empty ranges, which typically appear in deactivated
607 -- code in a particular configuration).
609 -- 6. Subtypes should match in the AST, even after a generic is
610 -- instantiated. In particular, GNATprove relies on the fact that,
611 -- on a selected component, the type of the selected component is
612 -- the type of the corresponding component in the prefix of the
613 -- selected component.
615 -- Note that, in some cases, we know that this rule is broken by the
616 -- frontend. In particular, if the selected component is a packed
617 -- array depending on a discriminant of a unconstrained formal object
618 -- parameter of a generic.
620 ----------------
621 -- SPARK Mode --
622 ----------------
624 -- The SPARK RM 1.6.5 defines a mode of operation called "SPARK mode" which
625 -- starts a scope where the SPARK language semantics are either On, Off, or
626 -- Auto, where Auto leaves the choice to the tools. A SPARK mode may be
627 -- specified by means of an aspect or a pragma.
629 -- The following entities may be subject to a SPARK mode. Entities marked
630 -- with * may possess two differente SPARK modes.
632 -- E_Entry
633 -- E_Entry_Family
634 -- E_Function
635 -- E_Generic_Function
636 -- E_Generic_Package *
637 -- E_Generic_Procedure
638 -- E_Operator
639 -- E_Package *
640 -- E_Package_Body *
641 -- E_Procedure
642 -- E_Protected_Body
643 -- E_Protected_Subtype
644 -- E_Protected_Type *
645 -- E_Subprogram_Body
646 -- E_Task_Body
647 -- E_Task_Subtype
648 -- E_Task_Type *
649 -- E_Variable
651 -- In order to manage SPARK scopes, the compiler relies on global variables
652 -- SPARK_Mode and SPARK_Mode_Pragma and a mechanism called "SPARK regions."
653 -- Routines Install_SPARK_Mode and Set_SPARK_Mode create a new SPARK region
654 -- and routine Restore_SPARK_Mode ends a SPARK region. A region may be
655 -- reinstalled similarly to scopes.
657 -----------------------
658 -- Check Flag Fields --
659 -----------------------
661 -- The following flag fields appear in expression nodes:
663 -- Do_Division_Check
664 -- Do_Overflow_Check
665 -- Do_Range_Check
667 -- These three flags are always set by the front end during semantic
668 -- analysis, on expression nodes that may trigger the corresponding
669 -- check. The front end then inserts or not the check during expansion. In
670 -- particular, these flags should also be correctly set in GNATprove mode.
671 -- As a special case, the front end does not insert a Do_Division_Check
672 -- flag on float exponentiation expressions, for the case where the value
673 -- is 0.0 and the exponent is negative, although this case does lead to a
674 -- division check failure. As another special case, the front end does not
675 -- insert a Do_Range_Check on an allocator where the designated type is
676 -- scalar, and the designated type is more constrained than the type of the
677 -- initialized allocator value or the type of the default value for an
678 -- uninitialized allocator.
680 -- Note that the expander always takes care of the Do_Range_Check case, so
681 -- this flag will never be set in the expanded tree passed to the back end.
682 -- For the other two flags, the check can be generated either by the back
683 -- end or by the front end, depending on the setting of a target parameter.
685 -- Note that this accounts for all nodes that trigger the corresponding
686 -- checks, except for range checks on subtype_indications, which may be
687 -- required to check that a range_constraint is compatible with the given
688 -- subtype (RM 3.2.2(11)).
690 -- The following flag fields appear in various nodes:
692 -- Do_Discriminant_Check
693 -- Do_Length_Check
694 -- Do_Storage_Check
696 -- These flags are used in some specific cases by the front end, either
697 -- during semantic analysis or during expansion, and cannot be expected
698 -- to be set on all nodes that trigger the corresponding check.
700 ------------------------
701 -- Common Flag Fields --
702 ------------------------
704 -- The following flag fields appear in all nodes:
706 -- Analyzed
707 -- This flag is used to indicate that a node (and all its children) have
708 -- been analyzed. It is used to avoid reanalysis of a node that has
709 -- already been analyzed, both for efficiency and functional correctness
710 -- reasons.
712 -- Comes_From_Source
713 -- This flag is set if the node comes directly from an explicit construct
714 -- in the source. It is normally on for any nodes built by the scanner or
715 -- parser from the source program, with the exception that in a few cases
716 -- the parser adds nodes to normalize the representation (in particular
717 -- a null statement is added to a package body if there is no begin/end
718 -- initialization section.
720 -- Most nodes inserted by the analyzer or expander are not considered
721 -- as coming from source, so the flag is off for such nodes. In a few
722 -- cases, the expander constructs nodes closely equivalent to nodes
723 -- from the source program (e.g. the allocator built for build-in-place
724 -- case), and the Comes_From_Source flag is deliberately set.
726 -- Error_Posted
727 -- This flag is used to avoid multiple error messages being posted on or
728 -- referring to the same node. This flag is set if an error message
729 -- refers to a node or is posted on its source location, and has the
730 -- effect of inhibiting further messages involving this same node.
732 -----------------------
733 -- Modify_Tree_For_C --
734 -----------------------
736 -- If the flag Opt.Modify_Tree_For_C is set True, then the tree is modified
737 -- in ways that help match the semantics better with C, easing the task of
738 -- interfacing to C code generators (other than GCC, where the work is done
739 -- in gigi, and there is no point in changing that), and also making life
740 -- easier for Cprint in generating C source code.
742 -- The current modifications implemented are as follows:
744 -- N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic nodes
745 -- are eliminated from the tree (since these operations do not exist in
746 -- C), and the operations are rewritten in terms of logical shifts and
747 -- other logical operations that do exist in C. See Exp_Ch4 expansion
748 -- routines for these operators for details of the transformations made.
750 -- The right operand of N_Op_Shift_Right and N_Op_Shift_Left is always
751 -- less than the word size (since other values are not well-defined in
752 -- C). This is done using an explicit test if necessary.
754 -- Min and Max attributes are expanded into equivalent if expressions,
755 -- dealing properly with side effect issues.
757 -- Mod for signed integer types is expanded into equivalent expressions
758 -- using Rem (which is % in C) and other C-available operators.
760 -- Functions returning bounded arrays are transformed into procedures
761 -- with an extra out parameter, and the calls updated accordingly.
763 -- Aggregates are only kept unexpanded for object declarations, otherwise
764 -- they are systematically expanded into loops (for arrays) and
765 -- individual assignments (for records).
767 -- Unconstrained array types are handled by means of fat pointers.
769 -- Postconditions are inlined by the frontend since their body may have
770 -- references to itypes defined in the enclosing subprogram.
772 ------------------------------------
773 -- Description of Semantic Fields --
774 ------------------------------------
776 -- The meaning of the syntactic fields is generally clear from their names
777 -- without any further description, since the names are chosen to
778 -- correspond very closely to the syntax in the reference manual. This
779 -- section describes the usage of the semantic fields, which are used to
780 -- contain additional information determined during semantic analysis.
782 -- Accept_Handler_Records
783 -- This field is present only in an N_Accept_Alternative node. It is used
784 -- to temporarily hold the exception handler records from an accept
785 -- statement in a selective accept. These exception handlers will
786 -- eventually be placed in the Handler_Records list of the procedure
787 -- built for this accept (see Expand_N_Selective_Accept procedure in
788 -- Exp_Ch9 for further details).
790 -- Access_Types_To_Process
791 -- Present in N_Freeze_Entity nodes for Incomplete or private types.
792 -- Contains the list of access types which may require specific treatment
793 -- when the nature of the type completion is completely known. An example
794 -- of such treatment is the generation of the associated_final_chain.
796 -- Actions
797 -- This field contains a sequence of actions that are associated with the
798 -- node holding the field. See the individual node types for details of
799 -- how this field is used, as well as the description of the specific use
800 -- for a particular node type.
802 -- Activation_Chain_Entity
803 -- This is used in tree nodes representing task activators (blocks,
804 -- subprogram bodies, package declarations, and task bodies). It is
805 -- initially Empty, and then gets set to point to the entity for the
806 -- declared Activation_Chain variable when the first task is declared.
807 -- When tasks are declared in the corresponding declarative region this
808 -- entity is located by name (its name is always _Chain) and the declared
809 -- tasks are added to the chain. Note that N_Extended_Return_Statement
810 -- does not have this attribute, although it does have an activation
811 -- chain. This chain is used to store the tasks temporarily, and is not
812 -- used for activating them. On successful completion of the return
813 -- statement, the tasks are moved to the caller's chain, and the caller
814 -- activates them.
816 -- Acts_As_Spec
817 -- A flag set in the N_Subprogram_Body node for a subprogram body which
818 -- is acting as its own spec. In the case of a library-level subprogram
819 -- the flag is set as well on the parent compilation unit node.
821 -- Actual_Designated_Subtype
822 -- Present in N_Free_Statement and N_Explicit_Dereference nodes. If gigi
823 -- needs to known the dynamic constrained subtype of the designated
824 -- object, this attribute is set to that type. This is done for
825 -- N_Free_Statements for access-to-classwide types and access to
826 -- unconstrained packed array types, and for N_Explicit_Dereference when
827 -- the designated type is an unconstrained packed array and the
828 -- dereference is the prefix of a 'Size attribute reference.
830 -- Address_Warning_Posted
831 -- Present in N_Attribute_Definition nodes. Set to indicate that we have
832 -- posted a warning for the address clause regarding size or alignment
833 -- issues. Used to inhibit multiple redundant messages.
835 -- Aggregate_Bounds
836 -- Present in array N_Aggregate nodes. If the bounds of the aggregate are
837 -- known at compile time, this field points to an N_Range node with those
838 -- bounds. Otherwise Empty.
840 -- Alloc_For_BIP_Return
841 -- Present in N_Allocator nodes. True if the allocator is one of those
842 -- generated for a build-in-place return statement.
844 -- All_Others
845 -- Present in an N_Others_Choice node. This flag is set for an others
846 -- exception where all exceptions are to be caught, even those that are
847 -- not normally handled (in particular the tasking abort signal). This
848 -- is used for translation of the at end handler into a normal exception
849 -- handler.
851 -- Aspect_On_Partial_View
852 -- Present on an N_Aspect_Specification node. For an aspect that applies
853 -- to a type entity, indicates whether the specification appears on the
854 -- partial view of a private type or extension. Undefined for aspects
855 -- that apply to other entities.
857 -- Aspect_Rep_Item
858 -- Present in N_Aspect_Specification nodes. Points to the corresponding
859 -- pragma/attribute definition node used to process the aspect.
861 -- Assignment_OK
862 -- This flag is set in a subexpression node for an object, indicating
863 -- that the associated object can be modified, even if this would not
864 -- normally be permissible (either by direct assignment, or by being
865 -- passed as an out or in-out parameter). This is used by the expander
866 -- for a number of purposes, including initialization of constants and
867 -- limited type objects (such as tasks), setting discriminant fields,
868 -- setting tag values, etc. N_Object_Declaration nodes also have this
869 -- flag defined. Here it is used to indicate that an initialization
870 -- expression is valid, even where it would normally not be allowed
871 -- (e.g. where the type involved is limited). It is also used to stop
872 -- a Force_Evaluation call for an unchecked conversion, but this usage
873 -- is unclear and not documented ???
875 -- Associated_Node
876 -- Present in nodes that can denote an entity: identifiers, character
877 -- literals, operator symbols, expanded names, operator nodes, and
878 -- attribute reference nodes (all these nodes have an Entity field).
879 -- This field is also present in N_Aggregate, N_Selected_Component, and
880 -- N_Extension_Aggregate nodes. This field is used in generic processing
881 -- to create links between the generic template and the generic copy.
882 -- See Sem_Ch12.Get_Associated_Node for full details. Note that this
883 -- field overlaps Entity, which is fine, since, as explained in Sem_Ch12,
884 -- the normal function of Entity is not required at the point where the
885 -- Associated_Node is set. Note also, that in generic templates, this
886 -- means that the Entity field does not necessarily point to an Entity.
887 -- Since the back end is expected to ignore generic templates, this is
888 -- harmless.
890 -- Atomic_Sync_Required
891 -- This flag is set on a node for which atomic synchronization is
892 -- required for the corresponding reference or modification.
894 -- At_End_Proc
895 -- This field is present in an N_Handled_Sequence_Of_Statements node.
896 -- It contains an identifier reference for the cleanup procedure to be
897 -- called. See description of this node for further details.
899 -- Backwards_OK
900 -- A flag present in the N_Assignment_Statement node. It is used only
901 -- if the type being assigned is an array type, and is set if analysis
902 -- determines that it is definitely safe to do the copy backwards, i.e.
903 -- starting at the highest addressed element. This is the case if either
904 -- the operands do not overlap, or they may overlap, but if they do,
905 -- then the left operand is at a higher address than the right operand.
907 -- Note: If neither of the flags Forwards_OK or Backwards_OK is set, it
908 -- means that the front end could not determine that either direction is
909 -- definitely safe, and a runtime check may be required if the backend
910 -- cannot figure it out. If both flags Forwards_OK and Backwards_OK are
911 -- set, it means that the front end can assure no overlap of operands.
913 -- Body_To_Inline
914 -- Present in subprogram declarations. Denotes analyzed but unexpanded
915 -- body of subprogram, to be used when inlining calls. Present when the
916 -- subprogram has an Inline pragma and inlining is enabled. If the
917 -- declaration is completed by a renaming_as_body, and the renamed entity
918 -- is a subprogram, the Body_To_Inline is the name of that entity, which
919 -- is used directly in later calls to the original subprogram.
921 -- Body_Required
922 -- A flag that appears in the N_Compilation_Unit node indicating that
923 -- the corresponding unit requires a body. For the package case, this
924 -- indicates that a completion is required. In Ada 95, if the flag is not
925 -- set for the package case, then a body may not be present. In Ada 83,
926 -- if the flag is not set for the package case, then body is optional.
927 -- For a subprogram declaration, the flag is set except in the case where
928 -- a pragma Import or Interface applies, in which case no body is
929 -- permitted (in Ada 83 or Ada 95).
931 -- By_Ref
932 -- Present in N_Simple_Return_Statement and N_Extended_Return_Statement,
933 -- this flag is set when the returned expression is already allocated on
934 -- the secondary stack and thus the result is passed by reference rather
935 -- than copied another time.
937 -- Cleanup_Actions
938 -- Present in block statements created for transient blocks, contains
939 -- additional cleanup actions carried over from the transient scope.
941 -- Check_Address_Alignment
942 -- A flag present in N_Attribute_Definition clause for a 'Address
943 -- attribute definition. This flag is set if a dynamic check should be
944 -- generated at the freeze point for the entity to which this address
945 -- clause applies. The reason that we need this flag is that we want to
946 -- check for range checks being suppressed at the point where the
947 -- attribute definition clause is given, rather than testing this at the
948 -- freeze point.
950 -- Comes_From_Extended_Return_Statement
951 -- Present in N_Simple_Return_Statement nodes. True if this node was
952 -- constructed as part of the N_Extended_Return_Statement expansion.
954 -- Compile_Time_Known_Aggregate
955 -- Present in N_Aggregate nodes. Set for aggregates which can be fully
956 -- evaluated at compile time without raising constraint error. Such
957 -- aggregates can be passed as is to the back end without any expansion.
958 -- See Exp_Aggr for specific conditions under which this flag gets set.
960 -- Componentwise_Assignment
961 -- Present in N_Assignment_Statement nodes. Set for a record assignment
962 -- where all that needs doing is to expand it into component-by-component
963 -- assignments. This is used internally for the case of tagged types with
964 -- rep clauses, where we need to avoid recursion (we don't want to try to
965 -- generate a call to the primitive operation, because this is the case
966 -- where we are compiling the primitive operation). Note that when we are
967 -- expanding component assignments in this case, we never assign the _tag
968 -- field, but we recursively assign components of the parent type.
970 -- Condition_Actions
971 -- This field appears in else-if nodes and in the iteration scheme node
972 -- for while loops. This field is only used during semantic processing to
973 -- temporarily hold actions inserted into the tree. In the tree passed
974 -- to gigi, the condition actions field is always set to No_List. For
975 -- details on how this field is used, see the routine Insert_Actions in
976 -- package Exp_Util, and also the expansion routines for the relevant
977 -- nodes.
979 -- Context_Pending
980 -- This field appears in Compilation_Unit nodes, to indicate that the
981 -- context of the unit is being compiled. Used to detect circularities
982 -- that are not otherwise detected by the loading mechanism. Such
983 -- circularities can occur in the presence of limited and non-limited
984 -- with_clauses that mention the same units.
986 -- Controlling_Argument
987 -- This field is set in procedure and function call nodes if the call
988 -- is a dispatching call (it is Empty for a non-dispatching call). It
989 -- indicates the source of the call's controlling tag. For procedure
990 -- calls, the Controlling_Argument is one of the actuals. For function
991 -- that has a dispatching result, it is an entity in the context of the
992 -- call that can provide a tag, or else it is the tag of the root type
993 -- of the class. It can also specify a tag directly rather than being a
994 -- tagged object. The latter is needed by the implementations of AI-239
995 -- and AI-260.
997 -- Conversion_OK
998 -- A flag set on type conversion nodes to indicate that the conversion
999 -- is to be considered as being valid, even though it is the case that
1000 -- the conversion is not valid Ada. This is used for attributes Enum_Rep,
1001 -- Pos, Val, Fixed_Value and Integer_Value, for internal conversions done
1002 -- for fixed-point operations, and for certain conversions for calls to
1003 -- initialization procedures. If Conversion_OK is set, then Etype must be
1004 -- set (the analyzer assumes that Etype has been set). For the case of
1005 -- fixed-point operands, it also indicates that the conversion is to be
1006 -- direct conversion of the underlying integer result, with no regard to
1007 -- the small operand.
1009 -- Convert_To_Return_False
1010 -- Present in N_Raise_Expression nodes that appear in the body of the
1011 -- special predicateM function used to test a predicate in the context
1012 -- of a membership test, where raise expression results in returning a
1013 -- value of False rather than raising an exception.
1015 -- Corresponding_Aspect
1016 -- Present in N_Pragma node. Used to point back to the source aspect from
1017 -- the corresponding pragma. This field is Empty for source pragmas.
1019 -- Corresponding_Body
1020 -- This field is set in subprogram declarations, package declarations,
1021 -- entry declarations of protected types, and in generic units. It points
1022 -- to the defining entity for the corresponding body (NOT the node for
1023 -- the body itself).
1025 -- Corresponding_Entry_Body
1026 -- Defined in N_Subprogram_Body. Set for subprogram bodies that implement
1027 -- a protected type entry; points to the body for the entry.
1029 -- Corresponding_Formal_Spec
1030 -- This field is set in subprogram renaming declarations, where it points
1031 -- to the defining entity for a formal subprogram in the case where the
1032 -- renaming corresponds to a generic formal subprogram association in an
1033 -- instantiation. The field is Empty if the renaming does not correspond
1034 -- to such a formal association.
1036 -- Corresponding_Generic_Association
1037 -- This field is defined for object declarations and object renaming
1038 -- declarations. It is set for the declarations within an instance that
1039 -- map generic formals to their actuals. If set, the field points either
1040 -- to a copy of a default expression for an actual of mode IN or to a
1041 -- generic_association which is the original parent of the expression or
1042 -- name appearing in the declaration. This simplifies GNATprove queries.
1044 -- Corresponding_Integer_Value
1045 -- This field is set in real literals of fixed-point types (it is not
1046 -- used for floating-point types). It contains the integer value used
1047 -- to represent the fixed-point value. It is also set on the universal
1048 -- real literals used to represent bounds of fixed-point base types
1049 -- and their first named subtypes.
1051 -- Corresponding_Spec
1052 -- This field is set in subprogram, package, task, and protected body
1053 -- nodes, where it points to the defining entity in the corresponding
1054 -- spec. The attribute is also set in N_With_Clause nodes where it points
1055 -- to the defining entity for the with'ed spec, and in a subprogram
1056 -- renaming declaration when it is a Renaming_As_Body. The field is Empty
1057 -- if there is no corresponding spec, as in the case of a subprogram body
1058 -- that serves as its own spec.
1060 -- In Ada 2012, Corresponding_Spec is set on expression functions that
1061 -- complete a subprogram declaration.
1063 -- Corresponding_Spec_Of_Stub
1064 -- This field is present in subprogram, package, task, and protected body
1065 -- stubs where it points to the corresponding spec of the stub. Due to
1066 -- clashes in the structure of nodes, we cannot use Corresponding_Spec.
1068 -- Corresponding_Stub
1069 -- This field is present in an N_Subunit node. It holds the node in
1070 -- the parent unit that is the stub declaration for the subunit. It is
1071 -- set when analysis of the stub forces loading of the proper body. If
1072 -- expansion of the proper body creates new declarative nodes, they are
1073 -- inserted at the point of the corresponding_stub.
1075 -- Dcheck_Function
1076 -- This field is present in an N_Variant node, It references the entity
1077 -- for the discriminant checking function for the variant.
1079 -- Default_Expression
1080 -- This field is Empty if there is no default expression. If there is a
1081 -- simple default expression (one with no side effects), then this field
1082 -- simply contains a copy of the Expression field (both point to the tree
1083 -- for the default expression). Default_Expression is used for
1084 -- conformance checking.
1086 -- Default_Storage_Pool
1087 -- This field is present in N_Compilation_Unit_Aux nodes. It is set to a
1088 -- copy of Opt.Default_Pool at the end of the compilation unit. See
1089 -- package Opt for details. This is used for inheriting the
1090 -- Default_Storage_Pool in child units.
1092 -- Discr_Check_Funcs_Built
1093 -- This flag is present in N_Full_Type_Declaration nodes. It is set when
1094 -- discriminant checking functions are constructed. The purpose is to
1095 -- avoid attempting to set these functions more than once.
1097 -- Do_Discriminant_Check
1098 -- This flag is set on N_Selected_Component nodes to indicate that a
1099 -- discriminant check is required using the discriminant check routine
1100 -- associated with the selector. The actual check is generated by the
1101 -- expander when processing selected components. In the case of
1102 -- Unchecked_Union, the flag is also set, but no discriminant check
1103 -- routine is associated with the selector, and the expander does not
1104 -- generate a check. This flag is also present in assignment statements
1105 -- (and set if the assignment requires a discriminant check), and in type
1106 -- conversion nodes (and set if the conversion requires a check).
1108 -- Do_Division_Check
1109 -- This flag is set on a division operator (/ mod rem) to indicate that
1110 -- a zero divide check is required. The actual check is either dealt with
1111 -- by the back end if Backend_Divide_Checks is set to true, or by the
1112 -- front end itself if it is set to false.
1114 -- Do_Length_Check
1115 -- This flag is set in an N_Assignment_Statement, N_Op_And, N_Op_Or,
1116 -- N_Op_Xor, or N_Type_Conversion node to indicate that a length check
1117 -- is required. It is not determined who deals with this flag (???).
1119 -- Do_Overflow_Check
1120 -- This flag is set on an operator where an overflow check is required on
1121 -- the operation. The actual check is either dealt with by the back end
1122 -- if Backend_Overflow_Checks is set to true, or by the front end itself
1123 -- if it is set to false. The other cases where this flag is used is on a
1124 -- Type_Conversion node as well on if and case expression nodes.
1125 -- For a type conversion, it means that the conversion is from one base
1126 -- type to another, and the value may not fit in the target base type.
1127 -- See also the description of Do_Range_Check for this case. This flag is
1128 -- also set on if and case expression nodes if we are operating in either
1129 -- MINIMIZED or ELIMINATED overflow checking mode (to make sure that we
1130 -- properly process overflow checking for dependent expressions).
1132 -- Do_Range_Check
1133 -- This flag is set on an expression which appears in a context where a
1134 -- range check is required. The target type is clear from the context.
1135 -- The contexts in which this flag can appear are the following:
1137 -- Right side of an assignment. In this case the target type is taken
1138 -- from the left side of the assignment, which is referenced by the
1139 -- Name of the N_Assignment_Statement node.
1141 -- Subscript expressions in an indexed component. In this case the
1142 -- target type is determined from the type of the array, which is
1143 -- referenced by the Prefix of the N_Indexed_Component node.
1145 -- Argument expression for a parameter, appearing either directly in
1146 -- the Parameter_Associations list of a call or as the Expression of an
1147 -- N_Parameter_Association node that appears in this list. In either
1148 -- case, the check is against the type of the formal. Note that the
1149 -- flag is relevant only in IN and IN OUT parameters, and will be
1150 -- ignored for OUT parameters, where no check is required in the call,
1151 -- and if a check is required on the return, it is generated explicitly
1152 -- with a type conversion.
1154 -- Initialization expression for the initial value in an object
1155 -- declaration. In this case the Do_Range_Check flag is set on
1156 -- the initialization expression, and the check is against the
1157 -- range of the type of the object being declared. This includes the
1158 -- cases of expressions providing default discriminant values, and
1159 -- expressions used to initialize record components.
1161 -- The expression of a type conversion. In this case the range check is
1162 -- against the target type of the conversion. See also the use of
1163 -- Do_Overflow_Check on a type conversion. The distinction is that the
1164 -- overflow check protects against a value that is outside the range of
1165 -- the target base type, whereas a range check checks that the
1166 -- resulting value (which is a value of the base type of the target
1167 -- type), satisfies the range constraint of the target type.
1169 -- Note: when a range check is required in contexts other than those
1170 -- listed above (e.g. in a return statement), an additional type
1171 -- conversion node is introduced to represent the required check.
1173 -- Do_Storage_Check
1174 -- This flag is set in an N_Allocator node to indicate that a storage
1175 -- check is required for the allocation, or in an N_Subprogram_Body node
1176 -- to indicate that a stack check is required in the subprogram prologue.
1177 -- The N_Allocator case is handled by the routine that expands the call
1178 -- to the runtime routine. The N_Subprogram_Body case is handled by the
1179 -- backend, and all the semantics does is set the flag.
1181 -- Elaborate_Present
1182 -- This flag is set in the N_With_Clause node to indicate that pragma
1183 -- Elaborate pragma appears for the with'ed units.
1185 -- Elaborate_All_Desirable
1186 -- This flag is set in the N_With_Clause mode to indicate that the static
1187 -- elaboration processing has determined that an Elaborate_All pragma is
1188 -- desirable for correct elaboration for this unit.
1190 -- Elaborate_All_Present
1191 -- This flag is set in the N_With_Clause node to indicate that a
1192 -- pragma Elaborate_All pragma appears for the with'ed units.
1194 -- Elaborate_Desirable
1195 -- This flag is set in the N_With_Clause mode to indicate that the static
1196 -- elaboration processing has determined that an Elaborate pragma is
1197 -- desirable for correct elaboration for this unit.
1199 -- Else_Actions
1200 -- This field is present in if expression nodes. During code
1201 -- expansion we use the Insert_Actions procedure (in Exp_Util) to insert
1202 -- actions at an appropriate place in the tree to get elaborated at the
1203 -- right time. For if expressions, we have to be sure that the actions
1204 -- for the Else branch are only elaborated if the condition is False.
1205 -- The Else_Actions field is used as a temporary parking place for
1206 -- these actions. The final tree is always rewritten to eliminate the
1207 -- need for this field, so in the tree passed to Gigi, this field is
1208 -- always set to No_List.
1210 -- Enclosing_Variant
1211 -- This field is present in the N_Variant node and identifies the Node_Id
1212 -- corresponding to the immediately enclosing variant when the variant is
1213 -- nested, and N_Empty otherwise. Set during semantic processing of the
1214 -- variant part of a record type.
1216 -- Entity
1217 -- Appears in all direct names (identifiers, character literals, and
1218 -- operator symbols), as well as expanded names, and attributes that
1219 -- denote entities, such as 'Class. Points to entity for corresponding
1220 -- defining occurrence. Set after name resolution. For identifiers in a
1221 -- WITH list, the corresponding defining occurrence is in a separately
1222 -- compiled file, and Entity must be set by the library Load procedure.
1224 -- Note: During name resolution, the value in Entity may be temporarily
1225 -- incorrect (e.g. during overload resolution, Entity is initially set to
1226 -- the first possible correct interpretation, and then later modified if
1227 -- necessary to contain the correct value after resolution).
1229 -- Note: This field overlaps Associated_Node, which is used during
1230 -- generic processing (see Sem_Ch12 for details). Note also that in
1231 -- generic templates, this means that the Entity field does not always
1232 -- point to an Entity. Since the back end is expected to ignore generic
1233 -- templates, this is harmless.
1235 -- Note: This field also appears in N_Attribute_Definition_Clause nodes.
1236 -- It is used only for stream attributes definition clauses. In this
1237 -- case, it denotes a (possibly dummy) subprogram entity that is declared
1238 -- conceptually at the point of the clause. Thus the visibility of the
1239 -- attribute definition clause (in the sense of 8.3(23) as amended by
1240 -- AI-195) can be checked by testing the visibility of that subprogram.
1242 -- Note: Normally the Entity field of an identifier points to the entity
1243 -- for the corresponding defining identifier, and hence the Chars field
1244 -- of an identifier will match the Chars field of the entity. However,
1245 -- there is no requirement that these match, and there are obscure cases
1246 -- of generated code where they do not match.
1248 -- Note: Ada 2012 aspect specifications require additional links between
1249 -- identifiers and various attributes. These attributes can be of
1250 -- arbitrary types, and the entity field of identifiers that denote
1251 -- aspects must be used to store arbitrary expressions for later semantic
1252 -- checks. See section on aspect specifications for details.
1254 -- Entity_Or_Associated_Node
1255 -- A synonym for both Entity and Associated_Node. Used by convention in
1256 -- the code when referencing this field in cases where it is not known
1257 -- whether the field contains an Entity or an Associated_Node.
1259 -- Etype
1260 -- Appears in all expression nodes, all direct names, and all entities.
1261 -- Points to the entity for the related type. Set after type resolution.
1262 -- Normally this is the actual subtype of the expression. However, in
1263 -- certain contexts such as the right side of an assignment, subscripts,
1264 -- arguments to calls, returned value in a function, initial value etc.
1265 -- it is the desired target type. In the event that this is different
1266 -- from the actual type, the Do_Range_Check flag will be set if a range
1267 -- check is required. Note: if the Is_Overloaded flag is set, then Etype
1268 -- points to an essentially arbitrary choice from the possible set of
1269 -- types.
1271 -- Exception_Junk
1272 -- This flag is set in a various nodes appearing in a statement sequence
1273 -- to indicate that the corresponding node is an artifact of the
1274 -- generated code for exception handling, and should be ignored when
1275 -- analyzing the control flow of the relevant sequence of statements
1276 -- (e.g. to check that it does not end with a bad return statement).
1278 -- Exception_Label
1279 -- Appears in N_Push_xxx_Label nodes. Points to the entity of the label
1280 -- to be used for transforming the corresponding exception into a goto,
1281 -- or contains Empty, if this exception is not to be transformed. Also
1282 -- appears in N_Exception_Handler nodes, where, if set, it indicates
1283 -- that there may be a local raise for the handler, so that expansion
1284 -- to allow a goto is required (and this field contains the label for
1285 -- this goto). See Exp_Ch11.Expand_Local_Exception_Handlers for details.
1287 -- Expansion_Delayed
1288 -- Set on aggregates and extension aggregates that need a top-down rather
1289 -- than bottom-up expansion. Typically aggregate expansion happens bottom
1290 -- up. For nested aggregates the expansion is delayed until the enclosing
1291 -- aggregate itself is expanded, e.g. in the context of a declaration. To
1292 -- delay it we set this flag. This is done to avoid creating a temporary
1293 -- for each level of a nested aggregate, and also to prevent the
1294 -- premature generation of constraint checks. This is also a requirement
1295 -- if we want to generate the proper attachment to the internal
1296 -- finalization lists (for record with controlled components). Top down
1297 -- expansion of aggregates is also used for in-place array aggregate
1298 -- assignment or initialization. When the full context is known, the
1299 -- target of the assignment or initialization is used to generate the
1300 -- left-hand side of individual assignment to each subcomponent.
1302 -- Expression_Copy
1303 -- Present in N_Pragma_Argument_Association nodes. Contains a copy of the
1304 -- original expression. This field is best used to store pragma-dependent
1305 -- modifications performed on the original expression such as replacement
1306 -- of the current type instance or substitutions of primitives.
1308 -- First_Inlined_Subprogram
1309 -- Present in the N_Compilation_Unit node for the main program. Points
1310 -- to a chain of entities for subprograms that are to be inlined. The
1311 -- Next_Inlined_Subprogram field of these entities is used as a link
1312 -- pointer with Empty marking the end of the list. This field is Empty
1313 -- if there are no inlined subprograms or inlining is not active.
1315 -- First_Named_Actual
1316 -- Present in procedure call statement and function call nodes, and also
1317 -- in Intrinsic nodes. Set during semantic analysis to point to the first
1318 -- named parameter where parameters are ordered by declaration order (as
1319 -- opposed to the actual order in the call which may be different due to
1320 -- named associations). Note: this field points to the explicit actual
1321 -- parameter itself, not the N_Parameter_Association node (its parent).
1323 -- First_Real_Statement
1324 -- Present in N_Handled_Sequence_Of_Statements node. Normally set to
1325 -- Empty. Used only when declarations are moved into the statement part
1326 -- of a construct as a result of wrapping an AT END handler that is
1327 -- required to cover the declarations. In this case, this field is used
1328 -- to remember the location in the statements list of the first real
1329 -- statement, i.e. the statement that used to be first in the statement
1330 -- list before the declarations were prepended.
1332 -- First_Subtype_Link
1333 -- Present in N_Freeze_Entity node for an anonymous base type that is
1334 -- implicitly created by the declaration of a first subtype. It points
1335 -- to the entity for the first subtype.
1337 -- Float_Truncate
1338 -- A flag present in type conversion nodes. This is used for float to
1339 -- integer conversions where truncation is required rather than rounding.
1341 -- Forwards_OK
1342 -- A flag present in the N_Assignment_Statement node. It is used only
1343 -- if the type being assigned is an array type, and is set if analysis
1344 -- determines that it is definitely safe to do the copy forwards, i.e.
1345 -- starting at the lowest addressed element. This is the case if either
1346 -- the operands do not overlap, or they may overlap, but if they do,
1347 -- then the left operand is at a lower address than the right operand.
1349 -- Note: If neither of the flags Forwards_OK or Backwards_OK is set, it
1350 -- means that the front end could not determine that either direction is
1351 -- definitely safe, and a runtime check may be required if the backend
1352 -- cannot figure it out. If both flags Forwards_OK and Backwards_OK are
1353 -- set, it means that the front end can assure no overlap of operands.
1355 -- From_Aspect_Specification
1356 -- Processing of aspect specifications typically results in insertion in
1357 -- the tree of corresponding pragma or attribute definition clause nodes.
1358 -- These generated nodes have the From_Aspect_Specification flag set to
1359 -- indicate that they came from aspect specifications originally.
1361 -- From_At_End
1362 -- This flag is set on an N_Raise_Statement node if it corresponds to
1363 -- the reraise statement generated as the last statement of an AT END
1364 -- handler when SJLJ exception handling is active. It is used to stop
1365 -- a bogus violation of restriction (No_Exception_Propagation), bogus
1366 -- because if the restriction is set, the reraise is not generated.
1368 -- From_At_Mod
1369 -- This flag is set on the attribute definition clause node that is
1370 -- generated by a transformation of an at mod phrase in a record
1371 -- representation clause. This is used to give slightly different (Ada 83
1372 -- compatible) semantics to such a clause, namely it is used to specify a
1373 -- minimum acceptable alignment for the base type and all subtypes. In
1374 -- Ada 95 terms, the actual alignment of the base type and all subtypes
1375 -- must be a multiple of the given value, and the representation clause
1376 -- is considered to be type specific instead of subtype specific.
1378 -- From_Conditional_Expression
1379 -- This flag is set on if and case statements generated by the expansion
1380 -- of if and case expressions respectively. The flag is used to suppress
1381 -- any finalization of controlled objects found within these statements.
1383 -- From_Default
1384 -- This flag is set on the subprogram renaming declaration created in an
1385 -- instance for a formal subprogram, when the formal is declared with a
1386 -- box, and there is no explicit actual. If the flag is present, the
1387 -- declaration is treated as an implicit reference to the formal in the
1388 -- ali file.
1390 -- Generalized_Indexing
1391 -- Present in N_Indexed_Component nodes. Set for Indexed_Component nodes
1392 -- that are Ada 2012 container indexing operations. The value of the
1393 -- attribute is a function call (possibly dereferenced) that corresponds
1394 -- to the proper expansion of the source indexing operation. Before
1395 -- expansion, the source node is rewritten as the resolved generalized
1396 -- indexing.
1398 -- Generic_Parent
1399 -- Generic_Parent is defined on declaration nodes that are instances. The
1400 -- value of Generic_Parent is the generic entity from which the instance
1401 -- is obtained.
1403 -- Generic_Parent_Type
1404 -- Generic_Parent_Type is defined on Subtype_Declaration nodes for the
1405 -- actuals of formal private and derived types. Within the instance, the
1406 -- operations on the actual are those inherited from the parent. For a
1407 -- formal private type, the parent type is the generic type itself. The
1408 -- Generic_Parent_Type is also used in an instance to determine whether a
1409 -- private operation overrides an inherited one.
1411 -- Handler_List_Entry
1412 -- This field is present in N_Object_Declaration nodes. It is set only
1413 -- for the Handler_Record entry generated for an exception in zero cost
1414 -- exception handling mode. It references the corresponding item in the
1415 -- handler list, and is used to delete this entry if the corresponding
1416 -- handler is deleted during optimization. For further details on why
1417 -- this is required, see Exp_Ch11.Remove_Handler_Entries.
1419 -- Has_Dereference_Action
1420 -- This flag is present in N_Explicit_Dereference nodes. It is set to
1421 -- indicate that the expansion has aready produced a call to primitive
1422 -- Dereference of a System.Checked_Pools.Checked_Pool implementation.
1423 -- Such dereference actions are produced for debugging purposes.
1425 -- Has_Dynamic_Length_Check
1426 -- This flag is present in all expression nodes. It is set to indicate
1427 -- that one of the routines in unit Checks has generated a length check
1428 -- action which has been inserted at the flagged node. This is used to
1429 -- avoid the generation of duplicate checks.
1431 -- Has_Local_Raise
1432 -- Present in exception handler nodes. Set if the handler can be entered
1433 -- via a local raise that gets transformed to a goto statement. This will
1434 -- always be set if Local_Raise_Statements is non-empty, but can also be
1435 -- set as a result of generation of N_Raise_xxx nodes, or flags set in
1436 -- nodes requiring generation of back end checks.
1438 -- Has_No_Elaboration_Code
1439 -- A flag that appears in the N_Compilation_Unit node to indicate whether
1440 -- or not elaboration code is present for this unit. It is initially set
1441 -- true for subprogram specs and bodies and for all generic units and
1442 -- false for non-generic package specs and bodies. Gigi may set the flag
1443 -- in the non-generic package case if it determines that no elaboration
1444 -- code is generated. Note that this flag is not related to the
1445 -- Is_Preelaborated status, there can be preelaborated packages that
1446 -- generate elaboration code, and non-preelaborated packages which do
1447 -- not generate elaboration code.
1449 -- Has_Pragma_Suppress_All
1450 -- This flag is set in an N_Compilation_Unit node if the Suppress_All
1451 -- pragma appears anywhere in the unit. This accommodates the rather
1452 -- strange placement rules of other compilers (DEC permits it at the
1453 -- end of a unit, and Rational allows it as a program unit pragma). We
1454 -- allow it anywhere at all, and consider it equivalent to a pragma
1455 -- Suppress (All_Checks) appearing at the start of the configuration
1456 -- pragmas for the unit.
1458 -- Has_Private_View
1459 -- A flag present in generic nodes that have an entity, to indicate that
1460 -- the node has a private type. Used to exchange private and full
1461 -- declarations if the visibility at instantiation is different from the
1462 -- visibility at generic definition.
1464 -- Has_Relative_Deadline_Pragma
1465 -- A flag present in N_Subprogram_Body and N_Task_Definition nodes to
1466 -- flag the presence of a pragma Relative_Deadline.
1468 -- Has_Self_Reference
1469 -- Present in N_Aggregate and N_Extension_Aggregate. Indicates that one
1470 -- of the expressions contains an access attribute reference to the
1471 -- enclosing type. Such a self-reference can only appear in default-
1472 -- initialized aggregate for a record type.
1474 -- Has_SP_Choice
1475 -- Present in all nodes containing a Discrete_Choices field (N_Variant,
1476 -- N_Case_Expression_Alternative, N_Case_Statement_Alternative). Set to
1477 -- True if the Discrete_Choices list has at least one occurrence of a
1478 -- statically predicated subtype.
1480 -- Has_Storage_Size_Pragma
1481 -- A flag present in an N_Task_Definition node to flag the presence of a
1482 -- Storage_Size pragma.
1484 -- Has_Target_Names
1485 -- Present in assignment statements. Indicates that the RHS contains
1486 -- target names (see AI12-0125-3) and must be expanded accordingly.
1488 -- Has_Wide_Character
1489 -- Present in string literals, set if any wide character (i.e. character
1490 -- code outside the Character range but within Wide_Character range)
1491 -- appears in the string. Used to implement pragma preference rules.
1493 -- Has_Wide_Wide_Character
1494 -- Present in string literals, set if any wide character (i.e. character
1495 -- code outside the Wide_Character range) appears in the string. Used to
1496 -- implement pragma preference rules.
1498 -- Header_Size_Added
1499 -- Present in N_Attribute_Reference nodes, set only for attribute
1500 -- Max_Size_In_Storage_Elements. The flag indicates that the size of the
1501 -- hidden list header used by the runtime finalization support has been
1502 -- added to the size of the prefix. The flag also prevents the infinite
1503 -- expansion of the same attribute in the said context.
1505 -- Hidden_By_Use_Clause
1506 -- An entity list present in use clauses that appear within
1507 -- instantiations. For the resolution of local entities, entities
1508 -- introduced by these use clauses have priority over global ones,
1509 -- and outer entities must be explicitly hidden/restored on exit.
1511 -- Implicit_With
1512 -- Present in N_With_Clause nodes. The flag indicates that the clause
1513 -- does not comes from source and introduces an implicit dependency on
1514 -- a particular unit. Such implicit with clauses are generated by:
1516 -- * ABE mechanism - The static elaboration model of both the default
1517 -- and the legacy ABE mechanism use with clauses to encode implicit
1518 -- Elaborate[_All] pragmas.
1520 -- * Analysis - A with clause for child unit A.B.C is equivalent to
1521 -- a series of clauses that with A, A.B, and A.B.C. Manipulation of
1522 -- contexts utilizes implicit with clauses to emulate the visibility
1523 -- of a particular unit.
1525 -- * RTSfind - The compiler generates code which references entities
1526 -- from the runtime.
1528 -- Import_Interface_Present
1529 -- This flag is set in an Interface or Import pragma if a matching
1530 -- pragma of the other kind is also present. This is used to avoid
1531 -- generating some unwanted error messages.
1533 -- Includes_Infinities
1534 -- This flag is present in N_Range nodes. It is set for the range of
1535 -- unconstrained float types defined in Standard, which include not only
1536 -- the given range of values, but also legitimately can include infinite
1537 -- values. This flag is false for any float type for which an explicit
1538 -- range is given by the programmer, even if that range is identical to
1539 -- the range for Float.
1541 -- Incomplete_View
1542 -- Present in full type declarations that are completions of incomplete
1543 -- type declarations. Denotes the corresponding incomplete type
1544 -- declaration. Used to simplify the retrieval of primitive operations
1545 -- that may be declared between the partial and the full view of an
1546 -- untagged type.
1548 -- Inherited_Discriminant
1549 -- This flag is present in N_Component_Association nodes. It indicates
1550 -- that a given component association in an extension aggregate is the
1551 -- value obtained from a constraint on an ancestor. Used to prevent
1552 -- double expansion when the aggregate has expansion delayed.
1554 -- Instance_Spec
1555 -- This field is present in generic instantiation nodes, and also in
1556 -- formal package declaration nodes (formal package declarations are
1557 -- treated in a manner very similar to package instantiations). It points
1558 -- to the node for the spec of the instance, inserted as part of the
1559 -- semantic processing for instantiations in Sem_Ch12.
1561 -- Is_Abort_Block
1562 -- Present in N_Block_Statement nodes. True if the block protects a list
1563 -- of statements with an Abort_Defer / Abort_Undefer_Direct pair.
1565 -- Is_Accessibility_Actual
1566 -- Present in N_Parameter_Association nodes. True if the parameter is
1567 -- an extra actual that carries the accessibility level of the actual
1568 -- for an access parameter, in a function that dispatches on result and
1569 -- is called in a dispatching context. Used to prevent a formal/actual
1570 -- mismatch when the call is rewritten as a dispatching call.
1572 -- Is_Analyzed_Pragma
1573 -- Present in N_Pragma nodes. Set for delayed pragmas that require a two
1574 -- step analysis. The initial step is peformed by routine Analyze_Pragma
1575 -- and verifies the overall legality of the pragma. The second step takes
1576 -- place in the various Analyze_xxx_In_Decl_Part routines which perform
1577 -- full analysis. The flag prevents the reanalysis of a delayed pragma.
1579 -- Is_Asynchronous_Call_Block
1580 -- A flag set in a Block_Statement node to indicate that it is the
1581 -- expansion of an asynchronous entry call. Such a block needs cleanup
1582 -- handler to assure that the call is cancelled.
1584 -- Is_Boolean_Aspect
1585 -- Present in N_Aspect_Specification node. Set if the aspect is for a
1586 -- boolean aspect (i.e. Aspect_Id is in Boolean_Aspect subtype).
1588 -- Is_Checked
1589 -- Present in N_Aspect_Specification and N_Pragma nodes. Set for an
1590 -- assertion aspect or pragma, or check pragma for an assertion, that
1591 -- is to be checked at run time. If either Is_Checked or Is_Ignored
1592 -- is set (they cannot both be set), then this means that the status of
1593 -- the pragma has been checked at the appropriate point and should not
1594 -- be further modified (in some cases these flags are copied when a
1595 -- pragma is rewritten).
1597 -- Is_Checked_Ghost_Pragma
1598 -- This flag is present in N_Pragma nodes. It is set when the pragma is
1599 -- related to a checked Ghost entity or encloses a checked Ghost entity.
1600 -- This flag has no relation to Is_Checked.
1602 -- Is_Component_Left_Opnd
1603 -- Is_Component_Right_Opnd
1604 -- Present in concatenation nodes, to indicate that the corresponding
1605 -- operand is of the component type of the result. Used in resolving
1606 -- concatenation nodes in instances.
1608 -- Is_Controlling_Actual
1609 -- This flag is set on an expression that is a controlling argument in
1610 -- a dispatching call. It is off in all other cases. See Sem_Disp for
1611 -- details of its use.
1613 -- Is_Declaration_Level_Node
1614 -- Present in call marker and instantiation nodes. Set when the constuct
1615 -- appears within the declarations of a block statement, an entry body,
1616 -- a subprogram body, or a task body. The flag aids the ABE Processing
1617 -- phase to catch certain forms of guaranteed ABEs.
1619 -- Is_Delayed_Aspect
1620 -- Present in N_Pragma and N_Attribute_Definition_Clause nodes which
1621 -- come from aspect specifications, where the evaluation of the aspect
1622 -- must be delayed to the freeze point. This flag is also set True in
1623 -- the corresponding N_Aspect_Specification node.
1625 -- Is_Disabled
1626 -- A flag set in an N_Aspect_Specification or N_Pragma node if there was
1627 -- a Check_Policy or Assertion_Policy (or in the case of a Debug_Pragma)
1628 -- a Debug_Policy pragma that resulted in totally disabling the flagged
1629 -- aspect or policy as a result of using the GNAT-defined policy DISABLE.
1630 -- If this flag is set, the aspect or policy is not analyzed for semantic
1631 -- correctness, so any expressions etc will not be marked as analyzed.
1633 -- Is_Dispatching_Call
1634 -- Present in call marker nodes. Set when the related call which prompted
1635 -- the creation of the marker is dispatching.
1637 -- Is_Dynamic_Coextension
1638 -- Present in allocator nodes, to indicate that this is an allocator
1639 -- for an access discriminant of a dynamically allocated object. The
1640 -- coextension must be deallocated and finalized at the same time as
1641 -- the enclosing object. The partner flag Is_Static_Coextension must
1642 -- be cleared before setting this flag to True.
1644 -- Is_Effective_Use_Clause
1645 -- Present in both N_Use_Type_Clause and N_Use_Package_Clause to indicate
1646 -- a use clause is "used" in the current source.
1648 -- Is_Elaboration_Checks_OK_Node
1649 -- Present in the following nodes:
1651 -- assignment statement
1652 -- attribute reference
1653 -- call marker
1654 -- entry call statement
1655 -- expanded name
1656 -- function call
1657 -- function instantiation
1658 -- identifier
1659 -- package instantiation
1660 -- procedure call statement
1661 -- procedure instantiation
1662 -- requeue statement
1663 -- variable reference marker
1665 -- Set when the node appears within a context which allows the generation
1666 -- of run-time ABE checks. This flag detemines whether the ABE Processing
1667 -- phase generates conditional ABE checks and guaranteed ABE failures.
1669 -- Is_Elaboration_Code
1670 -- Present in assignment statements. Set for an assignment which updates
1671 -- the elaboration flag of a package or subprogram when the corresponding
1672 -- body is successfully elaborated.
1674 -- Is_Elaboration_Warnings_OK_Node
1675 -- Present in the following nodes:
1677 -- attribute reference
1678 -- call marker
1679 -- entry call statement
1680 -- expanded name
1681 -- function call
1682 -- function instantiation
1683 -- identifier
1684 -- package instantiation
1685 -- procedure call statement
1686 -- procedure instantiation
1687 -- requeue statement
1688 -- variable reference marker
1690 -- Set when the node appears within a context where elaboration warnings
1691 -- are enabled. This flag determines whether the ABE processing phase
1692 -- generates diagnostics on various elaboration issues.
1694 -- Is_Entry_Barrier_Function
1695 -- This flag is set on N_Subprogram_Declaration and N_Subprogram_Body
1696 -- nodes which emulate the barrier function of a protected entry body.
1697 -- The flag is used when checking for incorrect use of Current_Task.
1699 -- Is_Expanded_Build_In_Place_Call
1700 -- This flag is set in an N_Function_Call node to indicate that the extra
1701 -- actuals to support a build-in-place style of call have been added to
1702 -- the call.
1704 -- Is_Expanded_Contract
1705 -- Present in N_Contract nodes. Set if the contract has already undergone
1706 -- expansion activities.
1708 -- Is_Finalization_Wrapper
1709 -- This flag is present in N_Block_Statement nodes. It is set when the
1710 -- block acts as a wrapper of a handled construct which has controlled
1711 -- objects. The wrapper prevents interference between exception handlers
1712 -- and At_End handlers.
1714 -- Is_Generic_Contract_Pragma
1715 -- This flag is present in N_Pragma nodes. It is set when the pragma is
1716 -- a source construct, applies to a generic unit or its body, and denotes
1717 -- one of the following contract-related annotations:
1718 -- Abstract_State
1719 -- Contract_Cases
1720 -- Depends
1721 -- Extensions_Visible
1722 -- Global
1723 -- Initial_Condition
1724 -- Initializes
1725 -- Post
1726 -- Post_Class
1727 -- Postcondition
1728 -- Pre
1729 -- Pre_Class
1730 -- Precondition
1731 -- Refined_Depends
1732 -- Refined_Global
1733 -- Refined_Post
1734 -- Refined_State
1735 -- Test_Case
1737 -- Is_Homogeneous_Aggregate
1738 -- A flag set on an Ada 2022 aggregate that uses square brackets as
1739 -- delimiters, and thus denotes an array or container aggregate, or
1740 -- the prefix of a reduction attribute.
1742 -- Is_Ignored
1743 -- A flag set in an N_Aspect_Specification or N_Pragma node if there was
1744 -- a Check_Policy or Assertion_Policy (or in the case of a Debug_Pragma)
1745 -- a Debug_Policy pragma that specified a policy of IGNORE, DISABLE, or
1746 -- OFF, for the pragma/aspect. If there was a Policy pragma specifying
1747 -- a Policy of ON or CHECK, then this flag is reset. If no Policy pragma
1748 -- gives a policy for the aspect or pragma, then there are two cases. For
1749 -- an assertion aspect or pragma (one of the assertion kinds allowed in
1750 -- an Assertion_Policy pragma), then Is_Ignored is set if assertions are
1751 -- ignored because of the absence of a -gnata switch. For any other
1752 -- aspects or pragmas, the flag is off. If this flag is set, the
1753 -- aspect/pragma is fully analyzed and checked for other syntactic
1754 -- and semantic errors, but it does not have any semantic effect.
1756 -- Is_Ignored_Ghost_Pragma
1757 -- This flag is present in N_Pragma nodes. It is set when the pragma is
1758 -- related to an ignored Ghost entity or encloses ignored Ghost entity.
1759 -- This flag has no relation to Is_Ignored.
1761 -- Is_In_Discriminant_Check
1762 -- This flag is present in a selected component, and is used to indicate
1763 -- that the reference occurs within a discriminant check. The
1764 -- significance is that optimizations based on assuming that the
1765 -- discriminant check has a correct value cannot be performed in this
1766 -- case (or the discriminant check may be optimized away).
1768 -- Is_Inherited_Pragma
1769 -- This flag is set in an N_Pragma node that appears in a N_Contract node
1770 -- to indicate that the pragma has been inherited from a parent context.
1772 -- Is_Initialization_Block
1773 -- Defined in block nodes. Set when the block statement was created by
1774 -- the finalization machinery to wrap initialization statements. This
1775 -- flag aids the ABE Processing phase to suppress the diagnostics of
1776 -- finalization actions in initialization contexts.
1778 -- Is_Known_Guaranteed_ABE
1779 -- NOTE: this flag is shared between the legacy ABE mechanism and the
1780 -- default ABE mechanism.
1782 -- Present in the following nodes:
1784 -- call marker
1785 -- formal package declaration
1786 -- function call
1787 -- function instantiation
1788 -- package instantiation
1789 -- procedure call statement
1790 -- procedure instantiation
1792 -- Set when the elaboration or evaluation of the scenario results in
1793 -- a guaranteed ABE. The flag is used to suppress the instantiation of
1794 -- generic bodies because gigi cannot handle certain forms of premature
1795 -- instantiation, as well as to prevent the reexamination of the node by
1796 -- the ABE Processing phase.
1798 -- Is_Machine_Number
1799 -- This flag is set in an N_Real_Literal node to indicate that the value
1800 -- is a machine number. This avoids some unnecessary cases of converting
1801 -- real literals to machine numbers.
1803 -- Is_Null_Loop
1804 -- This flag is set in an N_Loop_Statement node if the corresponding loop
1805 -- can be determined to be null at compile time. This is used to remove
1806 -- the loop entirely at expansion time.
1808 -- Is_Overloaded
1809 -- A flag present in all expression nodes. Used temporarily during
1810 -- overloading determination. The setting of this flag is not relevant
1811 -- once overloading analysis is complete.
1813 -- Is_Power_Of_2_For_Shift
1814 -- A flag present only in N_Op_Expon nodes. It is set when the
1815 -- exponentiation is of the form 2 ** N, where the type of N is an
1816 -- unsigned integral subtype whose size does not exceed the size of
1817 -- Standard_Integer (i.e. a type that can be safely converted to
1818 -- Natural), and the exponentiation appears as the right operand of an
1819 -- integer multiplication or an integer division where the dividend is
1820 -- unsigned. It is also required that overflow checking is off for both
1821 -- the exponentiation and the multiply/divide node. If this set of
1822 -- conditions holds, and the flag is set, then the division or
1823 -- multiplication can be (and is) converted to a shift.
1825 -- Is_Preelaborable_Call
1826 -- Present in call marker nodes. Set when the related call is non-static
1827 -- but preelaborable.
1829 -- Is_Prefixed_Call
1830 -- This flag is set in a selected component within a generic unit, if
1831 -- it resolves to a prefixed call to a primitive operation. The flag
1832 -- is used to prevent accidental overloadings in an instance, when a
1833 -- primitive operation and a private record component may be homographs.
1835 -- Is_Protected_Subprogram_Body
1836 -- A flag set in a Subprogram_Body block to indicate that it is the
1837 -- implementation of a protected subprogram. Such a body needs cleanup
1838 -- handler to make sure that the associated protected object is unlocked
1839 -- when the subprogram completes.
1841 -- Is_Qualified_Universal_Literal
1842 -- Present in N_Qualified_Expression nodes. Set when the qualification is
1843 -- converting a universal literal to a specific type. Such qualifiers aid
1844 -- the resolution of accidental overloading of binary or unary operators
1845 -- which may occur in instances.
1847 -- Is_Read
1848 -- Present in variable reference markers. Set when the original variable
1849 -- reference constitues a read of the variable.
1851 -- Is_Source_Call
1852 -- Present in call marker nodes. Set when the related call came from
1853 -- source.
1855 -- Is_SPARK_Mode_On_Node
1856 -- Present in the following nodes:
1858 -- assignment statement
1859 -- attribute reference
1860 -- call marker
1861 -- entry call statement
1862 -- expanded name
1863 -- function call
1864 -- function instantiation
1865 -- identifier
1866 -- package instantiation
1867 -- procedure call statement
1868 -- procedure instantiation
1869 -- requeue statement
1870 -- variable reference marker
1872 -- Set when the node appears within a context subject to SPARK_Mode On.
1873 -- This flag determines when the SPARK model of elaboration be activated
1874 -- by the ABE Processing phase.
1876 -- Is_Static_Coextension
1877 -- Present in N_Allocator nodes. Set if the allocator is a coextension
1878 -- of an object allocated on the stack rather than the heap. The partner
1879 -- flag Is_Dynamic_Coextension must be cleared before setting this flag
1880 -- to True.
1882 -- Is_Static_Expression
1883 -- Indicates that an expression is a static expression according to the
1884 -- rules in RM-4.9. See Sem_Eval for details.
1886 -- Is_Subprogram_Descriptor
1887 -- Present in N_Object_Declaration, and set only for the object
1888 -- declaration generated for a subprogram descriptor in fast exception
1889 -- mode. See Exp_Ch11 for details of use.
1891 -- Is_Task_Allocation_Block
1892 -- A flag set in a Block_Statement node to indicate that it is the
1893 -- expansion of a task allocator, or the allocator of an object
1894 -- containing tasks. Such a block requires a cleanup handler to call
1895 -- Expunge_Unactivated_Tasks to complete any tasks that have been
1896 -- allocated but not activated when the allocator completes abnormally.
1898 -- Is_Task_Body_Procedure
1899 -- This flag is set on N_Subprogram_Declaration and N_Subprogram_Body
1900 -- nodes which emulate the body of a task unit.
1902 -- Is_Task_Master
1903 -- A flag set in a Subprogram_Body, Block_Statement, or Task_Body node to
1904 -- indicate that the construct is a task master (i.e. has declared tasks
1905 -- or declares an access to a task type).
1907 -- Is_Write
1908 -- Present in variable reference markers. Set when the original variable
1909 -- reference constitues a write of the variable.
1911 -- Itype
1912 -- Used in N_Itype_Reference node to reference an itype for which it is
1913 -- important to ensure that it is defined. See description of this node
1914 -- for further details.
1916 -- Kill_Range_Check
1917 -- Used in an N_Unchecked_Type_Conversion node to indicate that the
1918 -- result should not be subjected to range checks. This is used for the
1919 -- implementation of Normalize_Scalars.
1921 -- Label_Construct
1922 -- Used in an N_Implicit_Label_Declaration node. Refers to an N_Label,
1923 -- N_Block_Statement or N_Loop_Statement node to which the label
1924 -- declaration applies. The field is left empty for the special labels
1925 -- generated as part of expanding raise statements with a local exception
1926 -- handler.
1928 -- Library_Unit
1929 -- In a stub node, Library_Unit points to the compilation unit node of
1930 -- the corresponding subunit.
1932 -- In a with clause node, Library_Unit points to the spec of the with'ed
1933 -- unit.
1935 -- In a compilation unit node, the usage depends on the unit type:
1937 -- For a library unit body, Library_Unit points to the compilation unit
1938 -- node of the corresponding spec, unless it's a subprogram body with
1939 -- Acts_As_Spec set, in which case it points to itself.
1941 -- For a spec, Library_Unit points to the compilation unit node of the
1942 -- corresponding body, if present. The body will be present if the spec
1943 -- is or contains generics that we needed to instantiate. Similarly, the
1944 -- body will be present if we needed it for inlining purposes. Thus, if
1945 -- we have a spec/body pair, both of which are present, they point to
1946 -- each other via Library_Unit.
1948 -- For a subunit, Library_Unit points to the compilation unit node of
1949 -- the parent body.
1950 -- ??? not (always) true, in (at least some, maybe all?) cases it points
1951 -- to the corresponding spec for the parent body.
1953 -- Note that this field is not used to hold the parent pointer for child
1954 -- unit (which might in any case need to use it for some other purpose as
1955 -- described above). Instead for a child unit, implicit with's are
1956 -- generated for all parents.
1958 -- Local_Raise_Statements
1959 -- This field is present in exception handler nodes. It is set to
1960 -- No_Elist in the normal case. If there is at least one raise statement
1961 -- which can potentially be handled as a local raise, then this field
1962 -- points to a list of raise nodes, which are calls to a routine to raise
1963 -- an exception. These are raise nodes which can be optimized into gotos
1964 -- if the handler turns out to meet the conditions which permit this
1965 -- transformation. Note that this does NOT include instances of the
1966 -- N_Raise_xxx_Error nodes since the transformation of these nodes is
1967 -- handled by the back end (using the N_Push/N_Pop mechanism).
1969 -- Loop_Actions
1970 -- A list present in Component_Association nodes in array aggregates.
1971 -- Used to collect actions that must be executed within the loop because
1972 -- they may need to be evaluated anew each time through.
1974 -- Limited_View_Installed
1975 -- Present in With_Clauses and in package specifications. If set on
1976 -- with_clause, it indicates that this clause has created the current
1977 -- limited view of the designated package. On a package specification, it
1978 -- indicates that the limited view has already been created because the
1979 -- package is mentioned in a limited_with_clause in the closure of the
1980 -- unit being compiled.
1982 -- Local_Raise_Not_OK
1983 -- Present in N_Exception_Handler nodes. Set if the handler contains
1984 -- a construct (reraise statement, or call to subprogram in package
1985 -- GNAT.Current_Exception) that makes the handler unsuitable as a target
1986 -- for a local raise (one that could otherwise be converted to a goto).
1988 -- Must_Be_Byte_Aligned
1989 -- This flag is present in N_Attribute_Reference nodes. It can be set
1990 -- only for the Address and Unrestricted_Access attributes. If set it
1991 -- means that the object for which the address/access is given must be on
1992 -- a byte (more accurately a storage unit) boundary. If necessary, a copy
1993 -- of the object is to be made before taking the address (this copy is in
1994 -- the current scope on the stack frame). This is used for certain cases
1995 -- of code generated by the expander that passes parameters by address.
1997 -- The reason the copy is not made by the front end is that the back end
1998 -- has more information about type layout and may be able to (but is not
1999 -- guaranteed to) prevent making unnecessary copies.
2001 -- Must_Not_Freeze
2002 -- A flag present in all expression nodes. Normally expressions cause
2003 -- freezing as described in the RM. If this flag is set, then this is
2004 -- inhibited. This is used by the analyzer and expander to label nodes
2005 -- that are created by semantic analysis or expansion and which must not
2006 -- cause freezing even though they normally would. This flag is also
2007 -- present in an N_Subtype_Indication node, since we also use these in
2008 -- calls to Freeze_Expression.
2010 -- Next_Entity
2011 -- Present in defining identifiers, defining character literals, and
2012 -- defining operator symbols (i.e. in all entities). The entities of a
2013 -- scope are chained, and this field is used as the forward pointer for
2014 -- this list. See Einfo for further details.
2016 -- Next_Exit_Statement
2017 -- Present in N_Exit_Statement nodes. The exit statements for a loop are
2018 -- chained (in reverse order of appearance) from the First_Exit_Statement
2019 -- field of the E_Loop entity for the loop. Next_Exit_Statement points to
2020 -- the next entry on this chain (Empty = end of list).
2022 -- Next_Implicit_With
2023 -- Present in N_With_Clause. Part of a chain of with_clauses generated
2024 -- in rtsfind to indicate implicit dependencies on predefined units. Used
2025 -- to prevent multiple with_clauses for the same unit in a given context.
2026 -- A postorder traversal of the tree whose nodes are units and whose
2027 -- links are with_clauses defines the order in which CodePeer must
2028 -- examine a compiled unit and its full context. This ordering ensures
2029 -- that any subprogram call is examined after the subprogram declaration
2030 -- has been seen.
2032 -- Next_Named_Actual
2033 -- Present in parameter association nodes. Set during semantic analysis
2034 -- to point to the next named parameter, where parameters are ordered by
2035 -- declaration order (as opposed to the actual order in the call, which
2036 -- may be different due to named associations). Not that this field
2037 -- points to the explicit actual parameter itself, not to the
2038 -- N_Parameter_Association node (its parent).
2040 -- Next_Pragma
2041 -- Present in N_Pragma nodes. Used to create a linked list of pragma
2042 -- nodes. Currently used for two purposes:
2044 -- Create a list of linked Check_Policy pragmas. The head of this list
2045 -- is stored in Opt.Check_Policy_List (which has further details).
2047 -- Used by processing for Pre/Postcondition pragmas to store a list of
2048 -- pragmas associated with the spec of a subprogram (see Sem_Prag for
2049 -- details).
2051 -- Used by processing for pragma SPARK_Mode to store multiple pragmas
2052 -- the apply to the same construct. These are visible/private mode for
2053 -- a package spec and declarative/statement mode for package body.
2055 -- Next_Rep_Item
2056 -- Present in pragma nodes, attribute definition nodes, enumeration rep
2057 -- clauses, record rep clauses, aspect specification and null statement
2058 -- nodes. Used to link representation items that apply to an entity. See
2059 -- full description of First_Rep_Item field in Einfo for further details.
2061 -- Next_Use_Clause
2062 -- While use clauses are active during semantic processing, they are
2063 -- chained from the scope stack entry, using Next_Use_Clause as a link
2064 -- pointer, with Empty marking the end of the list. The head pointer is
2065 -- in the scope stack entry (First_Use_Clause). At the end of semantic
2066 -- processing (i.e. when Gigi sees the tree, the contents of this field
2067 -- is undefined and should not be read).
2069 -- No_Ctrl_Actions
2070 -- Present in N_Assignment_Statement to indicate that no Finalize nor
2071 -- Adjust should take place on this assignment even though the RHS is
2072 -- controlled. Also indicates that the primitive _assign should not be
2073 -- used for a tagged assignment. This is used in init procs and aggregate
2074 -- expansions where the generated assignments are initializations, not
2075 -- real assignments.
2077 -- No_Elaboration_Check
2078 -- NOTE: this flag is relevant only for the legacy ABE mechanism and
2079 -- should not be used outside of that context.
2081 -- Present in N_Function_Call and N_Procedure_Call_Statement. Indicates
2082 -- that no elaboration check is needed on the call, because it appears in
2083 -- the context of a local Suppress pragma. This is used on calls within
2084 -- task bodies, where the actual elaboration checks are applied after
2085 -- analysis, when the local scope stack is not present.
2087 -- No_Entities_Ref_In_Spec
2088 -- Present in N_With_Clause nodes. Set if the with clause is on the
2089 -- package or subprogram spec where the main unit is the corresponding
2090 -- body, and no entities of the with'ed unit are referenced by the spec
2091 -- (an entity may still be referenced in the body, so this flag is used
2092 -- to generate the proper message (see Sem_Util.Check_Unused_Withs for
2093 -- full details).
2095 -- No_Initialization
2096 -- Present in N_Object_Declaration and N_Allocator to indicate that the
2097 -- object must not be initialized (by Initialize or call to an init
2098 -- proc). This is needed for controlled aggregates. When the Object
2099 -- declaration has an expression, this flag means that this expression
2100 -- should not be taken into account (needed for in place initialization
2101 -- with aggregates, and for object with an address clause, which are
2102 -- initialized with an assignment at freeze time).
2104 -- No_Minimize_Eliminate
2105 -- This flag is present in membership operator nodes (N_In/N_Not_In).
2106 -- It is used to indicate that processing for extended overflow checking
2107 -- modes is not required (this is used to prevent infinite recursion).
2109 -- No_Side_Effect_Removal
2110 -- Present in N_Function_Call nodes. Set when a function call does not
2111 -- require side effect removal. This attribute suppresses the generation
2112 -- of a temporary to capture the result of the function which eventually
2113 -- replaces the function call.
2115 -- No_Truncation
2116 -- Present in N_Unchecked_Type_Conversion node. This flag has an effect
2117 -- only if the RM_Size of the source is greater than the RM_Size of the
2118 -- target for scalar operands. Normally in such a case we truncate some
2119 -- higher order bits of the source, and then sign/zero extend the result
2120 -- to form the output value. But if this flag is set, then we do not do
2121 -- any truncation, so for example, if an 8 bit input is converted to 5
2122 -- bit result which is in fact stored in 8 bits, then the high order
2123 -- three bits of the target result will be copied from the source. This
2124 -- is used for properly setting out of range values for use by pragmas
2125 -- Initialize_Scalars and Normalize_Scalars.
2127 -- Null_Excluding_Subtype
2128 -- Present in N_Access_To_Object_Definition. Indicates that the subtype
2129 -- indication carries a null-exclusion indicator, which is distinct from
2130 -- the null-exclusion indicator that may precede the access keyword.
2132 -- Original_Discriminant
2133 -- Present in identifiers. Used in references to discriminants that
2134 -- appear in generic units. Because the names of the discriminants may be
2135 -- different in an instance, we use this field to recover the position of
2136 -- the discriminant in the original type, and replace it with the
2137 -- discriminant at the same position in the instantiated type.
2139 -- Original_Entity
2140 -- Present in numeric literals. Used to denote the named number that has
2141 -- been constant-folded into the given literal. If literal is from
2142 -- source, or the result of some other constant-folding operation, then
2143 -- Original_Entity is empty. This field is needed to handle properly
2144 -- named numbers in generic units, where the Associated_Node field
2145 -- interferes with the Entity field, making it impossible to preserve the
2146 -- original entity at the point of instantiation.
2148 -- Others_Discrete_Choices
2149 -- When a case statement or variant is analyzed, the semantic checks
2150 -- determine the actual list of choices that correspond to an others
2151 -- choice. This list is materialized for later use by the expander and
2152 -- the Others_Discrete_Choices field of an N_Others_Choice node points to
2153 -- this materialized list of choices, which is in standard format for a
2154 -- list of discrete choices, except that of course it cannot contain an
2155 -- N_Others_Choice entry.
2157 -- Parent_Spec
2158 -- For a library unit that is a child unit spec (package or subprogram
2159 -- declaration, generic declaration or instantiation, or library level
2160 -- rename) this field points to the compilation unit node for the parent
2161 -- package specification. This field is Empty for library bodies (the
2162 -- parent spec in this case can be found from the corresponding spec).
2164 -- Parent_With
2165 -- Present in N_With_Clause nodes. The flag indicates that the clause
2166 -- was generated for an ancestor unit to provide proper visibility. A
2167 -- with clause for child unit A.B.C produces two implicit parent with
2168 -- clauses for A and A.B.
2170 -- Premature_Use
2171 -- Present in N_Incomplete_Type_Declaration node. Used for improved
2172 -- error diagnostics: if there is a premature usage of an incomplete
2173 -- type, a subsequently generated error message indicates the position
2174 -- of its full declaration.
2176 -- Present_Expr
2177 -- Present in an N_Variant node. This has a meaningful value only after
2178 -- Gigi has back annotated the tree with representation information. At
2179 -- this point, it contains a reference to a gcc expression that depends
2180 -- on the values of one or more discriminants. Give a set of discriminant
2181 -- values, this expression evaluates to False (zero) if variant is not
2182 -- present, and True (non-zero) if it is present. See unit Repinfo for
2183 -- further details on gigi back annotation. This field is used during
2184 -- back-annotation processing (for -gnatR -gnatc) to determine if a field
2185 -- is present or not.
2187 -- Prev_Use_Clause
2188 -- Present in both N_Use_Package_Clause and N_Use_Type_Clause. Used in
2189 -- detection of ineffective use clauses by allowing a chain of related
2190 -- clauses together to avoid traversing the current scope stack.
2192 -- Print_In_Hex
2193 -- Set on an N_Integer_Literal node to indicate that the value should be
2194 -- printed in hexadecimal in the sprint listing. Has no effect on
2195 -- legality or semantics of program, only on the displayed output. This
2196 -- is used to clarify output from the packed array cases.
2198 -- Procedure_To_Call
2199 -- Present in N_Allocator, N_Free_Statement, N_Simple_Return_Statement,
2200 -- and N_Extended_Return_Statement nodes. References the entity for the
2201 -- declaration of the procedure to be called to accomplish the required
2202 -- operation (i.e. for the Allocate procedure in the case of N_Allocator
2203 -- and N_Simple_Return_Statement and N_Extended_Return_Statement (for
2204 -- allocating the return value), and for the Deallocate procedure in the
2205 -- case of N_Free_Statement.
2207 -- Raises_Constraint_Error
2208 -- Set on an expression whose evaluation will definitely fail constraint
2209 -- error check. See Sem_Eval for details.
2211 -- Redundant_Use
2212 -- Present in nodes that can appear as an operand in a use clause or use
2213 -- type clause (identifiers, expanded names, attribute references). Set
2214 -- to indicate that a use is redundant (and therefore need not be undone
2215 -- on scope exit).
2217 -- Renaming_Exception
2218 -- Present in N_Exception_Declaration node. Used to point back to the
2219 -- exception renaming for an exception declared within a subprogram.
2220 -- What happens is that an exception declared in a subprogram is moved
2221 -- to the library level with a unique name, and the original exception
2222 -- becomes a renaming. This link from the library level exception to the
2223 -- renaming declaration allows registering of the proper exception name.
2225 -- Return_Statement_Entity
2226 -- Present in N_Simple_Return_Statement and N_Extended_Return_Statement.
2227 -- Points to an E_Return_Statement representing the return statement.
2229 -- Return_Object_Declarations
2230 -- Present in N_Extended_Return_Statement. Points to a list initially
2231 -- containing a single N_Object_Declaration representing the return
2232 -- object. We use a list (instead of just a pointer to the object decl)
2233 -- because Analyze wants to insert extra actions on this list, before the
2234 -- N_Object_Declaration, which always remains last on the list.
2236 -- Rounded_Result
2237 -- Present in N_Type_Conversion, N_Op_Divide, and N_Op_Multiply nodes.
2238 -- Used in the fixed-point cases to indicate that the result must be
2239 -- rounded as a result of the use of the 'Round attribute. Also used for
2240 -- integer N_Op_Divide nodes to indicate that the result should be
2241 -- rounded to the nearest integer (breaking ties away from zero), rather
2242 -- than truncated towards zero as usual. These rounded integer operations
2243 -- are the result of expansion of rounded fixed-point divide, conversion
2244 -- and multiplication operations.
2246 -- Save_Invocation_Graph_Of_Body
2247 -- Present in compilation unit nodes. Set when the elaboration mechanism
2248 -- must record all invocation constructs and invocation relations within
2249 -- the body of the compilation unit.
2251 -- SCIL_Entity
2252 -- Present in SCIL nodes. References the specific tagged type associated
2253 -- with the SCIL node (for an N_SCIL_Dispatching_Call node, this is
2254 -- the controlling type of the call; for an N_SCIL_Membership_Test node
2255 -- generated as part of testing membership in T'Class, this is T; for an
2256 -- N_SCIL_Dispatch_Table_Tag_Init node, this is the type being declared).
2258 -- SCIL_Controlling_Tag
2259 -- Present in N_SCIL_Dispatching_Call nodes. References the controlling
2260 -- tag of a dispatching call. This is usually an N_Selected_Component
2261 -- node (for a _tag component), but may be an N_Object_Declaration or
2262 -- N_Parameter_Specification node in some cases (e.g., for a call to
2263 -- a classwide streaming operation or a call to an instance of
2264 -- Ada.Tags.Generic_Dispatching_Constructor).
2266 -- SCIL_Tag_Value
2267 -- Present in N_SCIL_Membership_Test nodes. Used to reference the tag
2268 -- of the value that is being tested.
2270 -- SCIL_Target_Prim
2271 -- Present in N_SCIL_Dispatching_Call nodes. References the primitive
2272 -- operation named (statically) in a dispatching call.
2274 -- Scope
2275 -- Present in defining identifiers, defining character literals, and
2276 -- defining operator symbols (i.e. in all entities). The entities of a
2277 -- scope all use this field to reference the corresponding scope entity.
2278 -- See Einfo for further details.
2280 -- Shift_Count_OK
2281 -- A flag present in shift nodes to indicate that the shift count is
2282 -- known to be in range, i.e. is in the range from zero to word length
2283 -- minus one. If this flag is not set, then the shift count may be
2284 -- outside this range, i.e. larger than the word length, and the code
2285 -- must ensure that such shift counts give the appropriate result.
2287 -- Source_Type
2288 -- Used in an N_Validate_Unchecked_Conversion node to point to the
2289 -- source type entity for the unchecked conversion instantiation
2290 -- which gigi must do size validation for.
2292 -- Split_PPC
2293 -- When a Pre or Post aspect specification is processed, it is broken
2294 -- into AND THEN sections. The leftmost section has Split_PPC set to
2295 -- False, indicating that it is the original specification (e.g. for
2296 -- posting errors). For other sections, Split_PPC is set to True.
2297 -- This flag is set in both the N_Aspect_Specification node itself,
2298 -- and in the pragma which is generated from this node.
2300 -- Storage_Pool
2301 -- Present in N_Allocator, N_Free_Statement, N_Simple_Return_Statement,
2302 -- and N_Extended_Return_Statement nodes. References the entity for the
2303 -- storage pool to be used for the allocate or free call or for the
2304 -- allocation of the returned value from function. Empty indicates that
2305 -- the global default pool is to be used. Note that in the case
2306 -- of a return statement, this field is set only if the function returns
2307 -- value of a type whose size is not known at compile time on the
2308 -- secondary stack.
2310 -- Suppress_Assignment_Checks
2311 -- Used in generated N_Assignment_Statement nodes to suppress predicate
2312 -- and range checks in cases where the generated code knows that the
2313 -- value being assigned is in range and satisfies any predicate. Also
2314 -- can be set in N_Object_Declaration nodes, to similarly suppress any
2315 -- checks on the initializing value. In assignment statements it also
2316 -- suppresses access checks in the generated code for out- and in-out
2317 -- parameters in entry calls.
2319 -- Suppress_Loop_Warnings
2320 -- Used in N_Loop_Statement node to indicate that warnings within the
2321 -- body of the loop should be suppressed. This is set when the range
2322 -- of a FOR loop is known to be null, or is probably null (loop would
2323 -- only execute if invalid values are present).
2325 -- Target
2326 -- Present in call and variable reference marker nodes. References the
2327 -- entity of the original entity, operator, or subprogram being invoked,
2328 -- or the original variable being read or written.
2330 -- Target_Type
2331 -- Used in an N_Validate_Unchecked_Conversion node to point to the target
2332 -- type entity for the unchecked conversion instantiation which gigi must
2333 -- do size validation for.
2335 -- Then_Actions
2336 -- This field is present in if expression nodes. During code expansion
2337 -- we use the Insert_Actions procedure (in Exp_Util) to insert actions
2338 -- at an appropriate place in the tree to get elaborated at the right
2339 -- time. For if expressions, we have to be sure that the actions for
2340 -- for the Then branch are only elaborated if the condition is True.
2341 -- The Then_Actions field is used as a temporary parking place for
2342 -- these actions. The final tree is always rewritten to eliminate the
2343 -- need for this field, so in the tree passed to Gigi, this field is
2344 -- always set to No_List.
2346 -- TSS_Elist
2347 -- Present in N_Freeze_Entity nodes. Holds an element list containing
2348 -- entries for each TSS (type support subprogram) associated with the
2349 -- frozen type. The elements of the list are the entities for the
2350 -- subprograms (see package Exp_TSS for further details). Set to No_Elist
2351 -- if there are no type support subprograms for the type or if the freeze
2352 -- node is not for a type.
2354 -- Uneval_Old_Accept
2355 -- Present in N_Pragma nodes. Set True if Opt.Uneval_Old is set to 'A'
2356 -- (accept) at the point where the pragma is encountered (including the
2357 -- case of a pragma generated from an aspect specification). It is this
2358 -- setting that is relevant, rather than the setting at the point where
2359 -- a contract is finally analyzed after the delay till the freeze point.
2361 -- Uneval_Old_Warn
2362 -- Present in N_Pragma nodes. Set True if Opt.Uneval_Old is set to 'W'
2363 -- (warn) at the point where the pragma is encountered (including the
2364 -- case of a pragma generated from an aspect specification). It is this
2365 -- setting that is relevant, rather than the setting at the point where
2366 -- a contract is finally analyzed after the delay till the freeze point.
2368 -- Unreferenced_In_Spec
2369 -- Present in N_With_Clause nodes. Set if the with clause is on the
2370 -- package or subprogram spec where the main unit is the corresponding
2371 -- body, and is not referenced by the spec (it may still be referenced by
2372 -- the body, so this flag is used to generate the proper message (see
2373 -- Sem_Util.Check_Unused_Withs for details)
2375 -- Uninitialized_Variable
2376 -- Present in N_Formal_Private_Type_Definition and in N_Private_
2377 -- Extension_Declarations. Indicates that a variable in a generic unit
2378 -- whose type is a formal private or derived type is read without being
2379 -- initialized. Used to warn if the corresponding actual type is not
2380 -- a fully initialized type.
2382 -- Used_Operations
2383 -- Present in N_Use_Type_Clause nodes. Holds the list of operations that
2384 -- are made potentially use-visible by the clause. Simplifies processing
2385 -- on exit from the scope of the use_type_clause, in particular in the
2386 -- case of Use_All_Type, when those operations several scopes.
2388 -- Was_Attribute_Reference
2389 -- Present in N_Subprogram_Body. Set to True if the original source is an
2390 -- attribute reference which is an actual in a generic instantiation. The
2391 -- instantiation prologue renames these attributes, and expansion later
2392 -- converts them into subprogram bodies.
2394 -- Was_Expression_Function
2395 -- Present in N_Subprogram_Body. True if the original source had an
2396 -- N_Expression_Function, which was converted to the N_Subprogram_Body
2397 -- by Analyze_Expression_Function.
2399 -- Was_Originally_Stub
2400 -- This flag is set in the node for a proper body that replaces stub.
2401 -- During the analysis procedure, stubs in some situations get rewritten
2402 -- by the corresponding bodies, and we set this flag to remember that
2403 -- this happened. Note that it is not good enough to rely on the use of
2404 -- Original_Node here because of the case of nested instantiations where
2405 -- the substituted node can be copied.
2407 --------------------------------------------------
2408 -- Note on Use of End_Label and End_Span Fields --
2409 --------------------------------------------------
2411 -- Several constructs have end lines:
2413 -- Loop Statement end loop [loop_IDENTIFIER];
2414 -- Package Specification end [[PARENT_UNIT_NAME .] IDENTIFIER]
2415 -- Task Definition end [task_IDENTIFIER]
2416 -- Protected Definition end [protected_IDENTIFIER]
2417 -- Protected Body end [protected_IDENTIFIER]
2419 -- Block Statement end [block_IDENTIFIER];
2420 -- Subprogram Body end [DESIGNATOR];
2421 -- Package Body end [[PARENT_UNIT_NAME .] IDENTIFIER];
2422 -- Task Body end [task_IDENTIFIER];
2423 -- Accept Statement end [entry_IDENTIFIER]];
2424 -- Entry Body end [entry_IDENTIFIER];
2426 -- If Statement end if;
2427 -- Case Statement end case;
2429 -- Record Definition end record;
2430 -- Enumeration Definition );
2432 -- The End_Label and End_Span fields are used to mark the locations of
2433 -- these lines, and also keep track of the label in the case where a label
2434 -- is present.
2436 -- For the first group above, the End_Label field of the corresponding node
2437 -- is used to point to the label identifier. In the case where there is no
2438 -- label in the source, the parser supplies a dummy identifier (with
2439 -- Comes_From_Source set to False), and the Sloc of this dummy identifier
2440 -- marks the location of the token following the END token.
2442 -- For the second group, the use of End_Label is similar, but the End_Label
2443 -- is found in the N_Handled_Sequence_Of_Statements node. This is done
2444 -- simply because in some cases there is no room in the parent node.
2446 -- For the third group, there is never any label, and instead of using
2447 -- End_Label, we use the End_Span field which gives the location of the
2448 -- token following END, relative to the starting Sloc of the construct,
2449 -- i.e. add Sloc (Node) + End_Span (Node) to get the Sloc of the IF or CASE
2450 -- following the End_Label.
2452 -- The record definition case is handled specially, we treat it as though
2453 -- it required an optional label which is never present, and so the parser
2454 -- always builds a dummy identifier with Comes From Source set False. The
2455 -- reason we do this, rather than using End_Span in this case, is that we
2456 -- want to generate a cross-ref entry for the end of a record, since it
2457 -- represents a scope for name declaration purposes.
2459 -- The enumeration definition case is handled in an exactly similar manner,
2460 -- building a dummy identifier to get a cross-reference.
2462 -- Note: the reason we store the difference as a Uint, instead of storing
2463 -- the Source_Ptr value directly, is that Source_Ptr values cannot be
2464 -- distinguished from other types of values, and we count on all general
2465 -- use fields being self describing. To make things easier for clients,
2466 -- note that we provide function End_Location, and procedure
2467 -- Set_End_Location to allow access to the logical value (which is the
2468 -- Source_Ptr value for the end token).
2470 ---------------------
2471 -- Syntactic Nodes --
2472 ---------------------
2474 ---------------------
2475 -- 2.3 Identifier --
2476 ---------------------
2478 -- IDENTIFIER ::= IDENTIFIER_LETTER {[UNDERLINE] LETTER_OR_DIGIT}
2479 -- LETTER_OR_DIGIT ::= IDENTIFIER_LETTER | DIGIT
2481 -- An IDENTIFIER shall not be a reserved word
2483 -- In the Ada grammar identifiers are the bottom level tokens which have
2484 -- very few semantics. Actual program identifiers are direct names. If
2485 -- we were being 100% honest with the grammar, then we would have a node
2486 -- called N_Direct_Name which would point to an identifier. However,
2487 -- that's too many extra nodes, so we just use the N_Identifier node
2488 -- directly as a direct name, and it contains the expression fields and
2489 -- Entity field that correspond to its use as a direct name. In those
2490 -- few cases where identifiers appear in contexts where they are not
2491 -- direct names (pragmas, pragma argument associations, attribute
2492 -- references and attribute definition clauses), the Chars field of the
2493 -- node contains the Name_Id for the identifier name.
2495 -- Note: in GNAT, a reserved word can be treated as an identifier in two
2496 -- cases. First, an incorrect use of a reserved word as an identifier is
2497 -- diagnosed and then treated as a normal identifier. Second, an
2498 -- attribute designator of the form of a reserved word (access, delta,
2499 -- digits, range) is treated as an identifier.
2501 -- Note: The set of letters that is permitted in an identifier depends
2502 -- on the character set in use. See package Csets for full details.
2504 -- N_Identifier
2505 -- Sloc points to identifier
2506 -- Chars contains the Name_Id for the identifier
2507 -- Entity
2508 -- Associated_Node
2509 -- Original_Discriminant
2510 -- Is_Elaboration_Checks_OK_Node
2511 -- Is_SPARK_Mode_On_Node
2512 -- Is_Elaboration_Warnings_OK_Node
2513 -- Has_Private_View (set in generic units)
2514 -- Redundant_Use
2515 -- Atomic_Sync_Required
2516 -- plus fields for expression
2518 --------------------------
2519 -- 2.4 Numeric Literal --
2520 --------------------------
2522 -- NUMERIC_LITERAL ::= DECIMAL_LITERAL | BASED_LITERAL
2524 ----------------------------
2525 -- 2.4.1 Decimal Literal --
2526 ----------------------------
2528 -- DECIMAL_LITERAL ::= NUMERAL [.NUMERAL] [EXPONENT]
2530 -- NUMERAL ::= DIGIT {[UNDERLINE] DIGIT}
2532 -- EXPONENT ::= E [+] NUMERAL | E - NUMERAL
2534 -- Decimal literals appear in the tree as either integer literal nodes
2535 -- or real literal nodes, depending on whether a period is present.
2537 -- Note: literal nodes appear as a result of direct use of literals
2538 -- in the source program, and also as the result of evaluating
2539 -- expressions at compile time. In the latter case, it is possible
2540 -- to construct real literals that have no syntactic representation
2541 -- using the standard literal format. Such literals are listed by
2542 -- Sprint using the notation [numerator / denominator].
2544 -- Note: the value of an integer literal node created by the front end
2545 -- is never outside the range of values of the base type. However, it
2546 -- can be the case that the created value is outside the range of the
2547 -- particular subtype. This happens in the case of integer overflows
2548 -- with checks suppressed.
2550 -- N_Integer_Literal
2551 -- Sloc points to literal
2552 -- Original_Entity If not Empty, holds Named_Number that
2553 -- has been constant-folded into its literal value.
2554 -- Intval contains integer value of literal
2555 -- Print_In_Hex
2556 -- plus fields for expression
2558 -- N_Real_Literal
2559 -- Sloc points to literal
2560 -- Original_Entity If not Empty, holds Named_Number that
2561 -- has been constant-folded into its literal value.
2562 -- Realval contains real value of literal
2563 -- Corresponding_Integer_Value
2564 -- Is_Machine_Number
2565 -- plus fields for expression
2567 --------------------------
2568 -- 2.4.2 Based Literal --
2569 --------------------------
2571 -- BASED_LITERAL ::=
2572 -- BASE # BASED_NUMERAL [.BASED_NUMERAL] # [EXPONENT]
2574 -- BASE ::= NUMERAL
2576 -- BASED_NUMERAL ::=
2577 -- EXTENDED_DIGIT {[UNDERLINE] EXTENDED_DIGIT}
2579 -- EXTENDED_DIGIT ::= DIGIT | A | B | C | D | E | F
2581 -- Based literals appear in the tree as either integer literal nodes
2582 -- or real literal nodes, depending on whether a period is present.
2584 ----------------------------
2585 -- 2.5 Character Literal --
2586 ----------------------------
2588 -- CHARACTER_LITERAL ::= ' GRAPHIC_CHARACTER '
2590 -- N_Character_Literal
2591 -- Sloc points to literal
2592 -- Chars contains the Name_Id for the identifier
2593 -- Char_Literal_Value contains the literal value
2594 -- Entity
2595 -- Associated_Node
2596 -- Has_Private_View (set in generic units)
2597 -- plus fields for expression
2599 -- Note: the Entity field will be missing (set to Empty) for character
2600 -- literals whose type is Standard.Wide_Character or Standard.Character
2601 -- or a type derived from one of these two. In this case the character
2602 -- literal stands for its own coding. The reason we take this irregular
2603 -- short cut is to avoid the need to build lots of junk defining
2604 -- character literal nodes.
2606 -------------------------
2607 -- 2.6 String Literal --
2608 -------------------------
2610 -- STRING LITERAL ::= "{STRING_ELEMENT}"
2612 -- A STRING_ELEMENT is either a pair of quotation marks ("), or a
2613 -- single GRAPHIC_CHARACTER other than a quotation mark.
2615 -- Is_Folded_In_Parser is True if the parser created this literal by
2616 -- folding a sequence of "&" operators. For example, if the source code
2617 -- says "aaa" & "bbb" & "ccc", and this produces "aaabbbccc", the flag
2618 -- is set. This flag is needed because the parser doesn't know about
2619 -- visibility, so the folded result might be wrong, and semantic
2620 -- analysis needs to check for that.
2622 -- N_String_Literal
2623 -- Sloc points to literal
2624 -- Strval contains Id of string value
2625 -- Has_Wide_Character
2626 -- Has_Wide_Wide_Character
2627 -- Is_Folded_In_Parser
2628 -- plus fields for expression
2630 ------------------
2631 -- 2.7 Comment --
2632 ------------------
2634 -- A COMMENT starts with two adjacent hyphens and extends up to the
2635 -- end of the line. A COMMENT may appear on any line of a program.
2637 -- Comments are skipped by the scanner and do not appear in the tree.
2638 -- It is possible to reconstruct the position of comments with respect
2639 -- to the elements of the tree by using the source position (Sloc)
2640 -- pointers that appear in every tree node.
2642 -----------------
2643 -- 2.8 Pragma --
2644 -----------------
2646 -- PRAGMA ::= pragma IDENTIFIER
2647 -- [(PRAGMA_ARGUMENT_ASSOCIATION {, PRAGMA_ARGUMENT_ASSOCIATION})];
2649 -- Note that a pragma may appear in the tree anywhere a declaration
2650 -- or a statement may appear, as well as in some other situations
2651 -- which are explicitly documented.
2653 -- N_Pragma
2654 -- Sloc points to PRAGMA
2655 -- Next_Pragma
2656 -- Pragma_Argument_Associations (set to No_List if none)
2657 -- Corresponding_Aspect (set to Empty if not present)
2658 -- Pragma_Identifier
2659 -- Next_Rep_Item
2660 -- Is_Generic_Contract_Pragma
2661 -- Is_Checked_Ghost_Pragma
2662 -- Is_Inherited_Pragma
2663 -- Is_Analyzed_Pragma
2664 -- Class_Present set if from Aspect with 'Class
2665 -- Uneval_Old_Accept
2666 -- Is_Ignored_Ghost_Pragma
2667 -- Is_Ignored
2668 -- Is_Checked
2669 -- From_Aspect_Specification
2670 -- Is_Delayed_Aspect
2671 -- Is_Disabled
2672 -- Import_Interface_Present
2673 -- Split_PPC set if corresponding aspect had Split_PPC set
2674 -- Uneval_Old_Warn
2676 -- Note: we should have a section on what pragmas are passed on to
2677 -- the back end to be processed. This section should note that pragma
2678 -- Psect_Object is always converted to Common_Object, but there are
2679 -- undoubtedly many other similar notes required ???
2681 -- Note: utility functions Pragma_Name_Unmapped and Pragma_Name may be
2682 -- applied to pragma nodes to obtain the Chars or its mapped version.
2684 -- Note: if From_Aspect_Specification is set, then Sloc points to the
2685 -- aspect name, as does the Pragma_Identifier. In this case if the
2686 -- pragma has a local name argument (such as pragma Inline), it is
2687 -- resolved to point to the specific entity affected by the pragma.
2689 --------------------------------------
2690 -- 2.8 Pragma Argument Association --
2691 --------------------------------------
2693 -- PRAGMA_ARGUMENT_ASSOCIATION ::=
2694 -- [pragma_argument_IDENTIFIER =>] NAME
2695 -- | [pragma_argument_IDENTIFIER =>] EXPRESSION
2697 -- In Ada 2012, there are two more possibilities:
2699 -- PRAGMA_ARGUMENT_ASSOCIATION ::=
2700 -- [pragma_argument_ASPECT_MARK =>] NAME
2701 -- | [pragma_argument_ASPECT_MARK =>] EXPRESSION
2703 -- where the interesting allowed cases (which do not fit the syntax of
2704 -- the first alternative above) are
2706 -- ASPECT_MARK => Pre'Class |
2707 -- Post'Class |
2708 -- Type_Invariant'Class |
2709 -- Invariant'Class
2711 -- We allow this special usage in all Ada modes, but it would be a
2712 -- pain to allow these aspects to pervade the pragma syntax, and the
2713 -- representation of pragma nodes internally. So what we do is to
2714 -- replace these ASPECT_MARK forms with identifiers whose name is one
2715 -- of the special internal names _Pre, _Post, or _Type_Invariant.
2717 -- We do a similar replacement of these Aspect_Mark forms in the
2718 -- Expression of a pragma argument association for the cases of
2719 -- the first arguments of any Check pragmas and Check_Policy pragmas
2721 -- N_Pragma_Argument_Association
2722 -- Sloc points to first token in association
2723 -- Chars (set to No_Name if no pragma argument identifier)
2724 -- Expression_Copy
2725 -- Expression
2727 ------------------------
2728 -- 2.9 Reserved Word --
2729 ------------------------
2731 -- Reserved words are parsed by the scanner, and returned as the
2732 -- corresponding token types (e.g. PACKAGE is returned as Tok_Package)
2734 ----------------------------
2735 -- 3.1 Basic Declaration --
2736 ----------------------------
2738 -- BASIC_DECLARATION ::=
2739 -- TYPE_DECLARATION | SUBTYPE_DECLARATION
2740 -- | OBJECT_DECLARATION | NUMBER_DECLARATION
2741 -- | SUBPROGRAM_DECLARATION | ABSTRACT_SUBPROGRAM_DECLARATION
2742 -- | PACKAGE_DECLARATION | RENAMING_DECLARATION
2743 -- | EXCEPTION_DECLARATION | GENERIC_DECLARATION
2744 -- | GENERIC_INSTANTIATION
2746 -- Basic declaration also includes IMPLICIT_LABEL_DECLARATION
2747 -- see further description in section on semantic nodes.
2749 -- Also, in the tree that is constructed, a pragma may appear
2750 -- anywhere that a declaration may appear.
2752 ------------------------------
2753 -- 3.1 Defining Identifier --
2754 ------------------------------
2756 -- DEFINING_IDENTIFIER ::= IDENTIFIER
2758 -- A defining identifier is an entity, which has additional fields
2759 -- depending on the setting of the Ekind field. These additional
2760 -- fields are defined (and access subprograms declared) in package
2761 -- Einfo.
2763 -- Note: N_Defining_Identifier is an extended node whose fields are
2764 -- deliberately laid out to match the layout of fields in an ordinary
2765 -- N_Identifier node allowing for easy alteration of an identifier
2766 -- node into a defining identifier node. For details, see procedure
2767 -- Sinfo.CN.Change_Identifier_To_Defining_Identifier.
2769 -- N_Defining_Identifier
2770 -- Sloc points to identifier
2771 -- Chars contains the Name_Id for the identifier
2772 -- Next_Entity
2773 -- Scope
2774 -- Etype
2776 -----------------------------
2777 -- 3.2.1 Type Declaration --
2778 -----------------------------
2780 -- TYPE_DECLARATION ::=
2781 -- FULL_TYPE_DECLARATION
2782 -- | INCOMPLETE_TYPE_DECLARATION
2783 -- | PRIVATE_TYPE_DECLARATION
2784 -- | PRIVATE_EXTENSION_DECLARATION
2786 ----------------------------------
2787 -- 3.2.1 Full Type Declaration --
2788 ----------------------------------
2790 -- FULL_TYPE_DECLARATION ::=
2791 -- type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART]
2792 -- is TYPE_DEFINITION
2793 -- [ASPECT_SPECIFICATIONS];
2794 -- | TASK_TYPE_DECLARATION
2795 -- | PROTECTED_TYPE_DECLARATION
2797 -- The full type declaration node is used only for the first case. The
2798 -- second case (concurrent type declaration), is represented directly
2799 -- by a task type declaration or a protected type declaration.
2801 -- N_Full_Type_Declaration
2802 -- Sloc points to TYPE
2803 -- Defining_Identifier
2804 -- Incomplete_View
2805 -- Discriminant_Specifications (set to No_List if none)
2806 -- Type_Definition
2807 -- Discr_Check_Funcs_Built
2809 ----------------------------
2810 -- 3.2.1 Type Definition --
2811 ----------------------------
2813 -- TYPE_DEFINITION ::=
2814 -- ENUMERATION_TYPE_DEFINITION | INTEGER_TYPE_DEFINITION
2815 -- | REAL_TYPE_DEFINITION | ARRAY_TYPE_DEFINITION
2816 -- | RECORD_TYPE_DEFINITION | ACCESS_TYPE_DEFINITION
2817 -- | DERIVED_TYPE_DEFINITION | INTERFACE_TYPE_DEFINITION
2819 --------------------------------
2820 -- 3.2.2 Subtype Declaration --
2821 --------------------------------
2823 -- SUBTYPE_DECLARATION ::=
2824 -- subtype DEFINING_IDENTIFIER is [NULL_EXCLUSION] SUBTYPE_INDICATION
2825 -- [ASPECT_SPECIFICATIONS];
2827 -- The subtype indication field is set to Empty for subtypes
2828 -- declared in package Standard (Positive, Natural).
2830 -- N_Subtype_Declaration
2831 -- Sloc points to SUBTYPE
2832 -- Defining_Identifier
2833 -- Null_Exclusion_Present
2834 -- Subtype_Indication
2835 -- Generic_Parent_Type (set for an actual derived type).
2836 -- Exception_Junk
2838 -------------------------------
2839 -- 3.2.2 Subtype Indication --
2840 -------------------------------
2842 -- SUBTYPE_INDICATION ::= SUBTYPE_MARK [CONSTRAINT]
2844 -- Note: if no constraint is present, the subtype indication appears
2845 -- directly in the tree as a subtype mark. The N_Subtype_Indication
2846 -- node is used only if a constraint is present.
2848 -- Note: [For Ada 2005 (AI-231)]: Because Ada 2005 extends this rule
2849 -- with the null-exclusion part (see AI-231), we had to introduce a new
2850 -- attribute in all the parents of subtype_indication nodes to indicate
2851 -- if the null-exclusion is present.
2853 -- Note: the reason that this node has expression fields is that a
2854 -- subtype indication can appear as an operand of a membership test.
2856 -- N_Subtype_Indication
2857 -- Sloc points to first token of subtype mark
2858 -- Subtype_Mark
2859 -- Constraint
2860 -- Etype
2861 -- Must_Not_Freeze
2863 -- Note: Depending on context, the Etype is either the entity of the
2864 -- Subtype_Mark field, or it is an itype constructed to reify the
2865 -- subtype indication. In particular, such itypes are created for a
2866 -- subtype indication that appears in an array type declaration. This
2867 -- simplifies constraint checking in indexed components.
2869 -- For subtype indications that appear in scalar type and subtype
2870 -- declarations, the Etype is the entity of the subtype mark.
2872 -------------------------
2873 -- 3.2.2 Subtype Mark --
2874 -------------------------
2876 -- SUBTYPE_MARK ::= subtype_NAME
2878 -----------------------
2879 -- 3.2.2 Constraint --
2880 -----------------------
2882 -- CONSTRAINT ::= SCALAR_CONSTRAINT | COMPOSITE_CONSTRAINT
2884 ------------------------------
2885 -- 3.2.2 Scalar Constraint --
2886 ------------------------------
2888 -- SCALAR_CONSTRAINT ::=
2889 -- RANGE_CONSTRAINT | DIGITS_CONSTRAINT | DELTA_CONSTRAINT
2891 ---------------------------------
2892 -- 3.2.2 Composite Constraint --
2893 ---------------------------------
2895 -- COMPOSITE_CONSTRAINT ::=
2896 -- INDEX_CONSTRAINT | DISCRIMINANT_CONSTRAINT
2898 -------------------------------
2899 -- 3.3.1 Object Declaration --
2900 -------------------------------
2902 -- OBJECT_DECLARATION ::=
2903 -- DEFINING_IDENTIFIER_LIST : [aliased] [constant]
2904 -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION]
2905 -- [ASPECT_SPECIFICATIONS];
2906 -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant]
2907 -- ACCESS_DEFINITION [:= EXPRESSION]
2908 -- [ASPECT_SPECIFICATIONS];
2909 -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant]
2910 -- ARRAY_TYPE_DEFINITION [:= EXPRESSION]
2911 -- [ASPECT_SPECIFICATIONS];
2912 -- | SINGLE_TASK_DECLARATION
2913 -- | SINGLE_PROTECTED_DECLARATION
2915 -- Note: aliased is not permitted in Ada 83 mode
2917 -- The N_Object_Declaration node is only for the first three cases.
2918 -- Single task declaration is handled by P_Task (9.1)
2919 -- Single protected declaration is handled by P_protected (9.5)
2921 -- Although the syntax allows multiple identifiers in the list, the
2922 -- semantics is as though successive declarations were given with
2923 -- identical type definition and expression components. To simplify
2924 -- semantic processing, the parser represents a multiple declaration
2925 -- case as a sequence of single declarations, using the More_Ids and
2926 -- Prev_Ids flags to preserve the original source form as described
2927 -- in the section on "Handling of Defining Identifier Lists".
2929 -- The flag Has_Init_Expression is set if an initializing expression
2930 -- is present. Normally it is set if and only if Expression contains
2931 -- a non-empty value, but there is an exception to this. When the
2932 -- initializing expression is an aggregate which requires explicit
2933 -- assignments, the Expression field gets set to Empty, but this flag
2934 -- is still set, so we don't forget we had an initializing expression.
2936 -- Note: if a range check is required for the initialization
2937 -- expression then the Do_Range_Check flag is set in the Expression,
2938 -- with the check being done against the type given by the object
2939 -- definition, which is also the Etype of the defining identifier.
2941 -- Note: the contents of the Expression field must be ignored (i.e.
2942 -- treated as though it were Empty) if No_Initialization is set True.
2944 -- Note: the back end places some restrictions on the form of the
2945 -- Expression field. If the object being declared is Atomic, then
2946 -- the Expression may not have the form of an aggregate (since this
2947 -- might cause the back end to generate separate assignments). In this
2948 -- case the front end must generate an extra temporary and initialize
2949 -- this temporary as required (the temporary itself is not atomic).
2951 -- Note: there is no node kind for object definition. Instead, the
2952 -- corresponding field holds a subtype indication, an array type
2953 -- definition, or (Ada 2005, AI-406) an access definition.
2955 -- N_Object_Declaration
2956 -- Sloc points to first identifier
2957 -- Defining_Identifier
2958 -- Aliased_Present
2959 -- Constant_Present set if CONSTANT appears
2960 -- Null_Exclusion_Present
2961 -- Object_Definition subtype indic./array type def./access def.
2962 -- Expression (set to Empty if not present)
2963 -- Handler_List_Entry
2964 -- Corresponding_Generic_Association
2965 -- More_Ids (set to False if no more identifiers in list)
2966 -- Prev_Ids (set to False if no previous identifiers in list)
2967 -- No_Initialization
2968 -- Assignment_OK
2969 -- Exception_Junk
2970 -- Is_Subprogram_Descriptor
2971 -- Has_Init_Expression
2972 -- Suppress_Assignment_Checks
2974 -------------------------------------
2975 -- 3.3.1 Defining Identifier List --
2976 -------------------------------------
2978 -- DEFINING_IDENTIFIER_LIST ::=
2979 -- DEFINING_IDENTIFIER {, DEFINING_IDENTIFIER}
2981 -------------------------------
2982 -- 3.3.2 Number Declaration --
2983 -------------------------------
2985 -- NUMBER_DECLARATION ::=
2986 -- DEFINING_IDENTIFIER_LIST : constant := static_EXPRESSION;
2988 -- Although the syntax allows multiple identifiers in the list, the
2989 -- semantics is as though successive declarations were given with
2990 -- identical expressions. To simplify semantic processing, the parser
2991 -- represents a multiple declaration case as a sequence of single
2992 -- declarations, using the More_Ids and Prev_Ids flags to preserve
2993 -- the original source form as described in the section on "Handling
2994 -- of Defining Identifier Lists".
2996 -- N_Number_Declaration
2997 -- Sloc points to first identifier
2998 -- Defining_Identifier
2999 -- Expression
3000 -- More_Ids (set to False if no more identifiers in list)
3001 -- Prev_Ids (set to False if no previous identifiers in list)
3003 ----------------------------------
3004 -- 3.4 Derived Type Definition --
3005 ----------------------------------
3007 -- DERIVED_TYPE_DEFINITION ::=
3008 -- [abstract] [limited] new [NULL_EXCLUSION] parent_SUBTYPE_INDICATION
3009 -- [[and INTERFACE_LIST] RECORD_EXTENSION_PART]
3011 -- Note: ABSTRACT, LIMITED, and record extension part are not permitted
3012 -- in Ada 83 mode.
3014 -- Note: a record extension part is required if ABSTRACT is present
3016 -- N_Derived_Type_Definition
3017 -- Sloc points to NEW
3018 -- Abstract_Present
3019 -- Null_Exclusion_Present (set to False if not present)
3020 -- Subtype_Indication
3021 -- Record_Extension_Part (set to Empty if not present)
3022 -- Limited_Present
3023 -- Task_Present set in task interfaces
3024 -- Protected_Present set in protected interfaces
3025 -- Synchronized_Present set in interfaces
3026 -- Interface_List (set to No_List if none)
3027 -- Interface_Present set in abstract interfaces
3029 -- Note: Task_Present, Protected_Present, Synchronized_Present,
3030 -- Interface_List, and Interface_Present are used for abstract
3031 -- interfaces (see comments for INTERFACE_TYPE_DEFINITION).
3033 ---------------------------
3034 -- 3.5 Range Constraint --
3035 ---------------------------
3037 -- RANGE_CONSTRAINT ::= range RANGE
3039 -- N_Range_Constraint
3040 -- Sloc points to RANGE
3041 -- Range_Expression
3043 ----------------
3044 -- 3.5 Range --
3045 ----------------
3047 -- RANGE ::=
3048 -- RANGE_ATTRIBUTE_REFERENCE
3049 -- | SIMPLE_EXPRESSION .. SIMPLE_EXPRESSION
3051 -- Note: the case of a range given as a range attribute reference
3052 -- appears directly in the tree as an attribute reference.
3054 -- Note: the field name for a reference to a range is Range_Expression
3055 -- rather than Range, because range is a reserved keyword in Ada.
3057 -- Note: the reason that this node has expression fields is that a
3058 -- range can appear as an operand of a membership test. The Etype
3059 -- field is the type of the range (we do NOT construct an implicit
3060 -- subtype to represent the range exactly).
3062 -- N_Range
3063 -- Sloc points to ..
3064 -- Low_Bound
3065 -- High_Bound
3066 -- Includes_Infinities
3067 -- plus fields for expression
3069 -- Note: if the range appears in a context, such as a subtype
3070 -- declaration, where range checks are required on one or both of
3071 -- the expression fields, then type conversion nodes are inserted
3072 -- to represent the required checks.
3074 ----------------------------------------
3075 -- 3.5.1 Enumeration Type Definition --
3076 ----------------------------------------
3078 -- ENUMERATION_TYPE_DEFINITION ::=
3079 -- (ENUMERATION_LITERAL_SPECIFICATION
3080 -- {, ENUMERATION_LITERAL_SPECIFICATION})
3082 -- Note: the Literals field in the node described below is null for
3083 -- the case of the standard types CHARACTER and WIDE_CHARACTER, for
3084 -- which special processing handles these types as special cases.
3086 -- N_Enumeration_Type_Definition
3087 -- Sloc points to left parenthesis
3088 -- Literals (Empty for CHARACTER or WIDE_CHARACTER)
3089 -- End_Label (set to Empty if internally generated record)
3091 ----------------------------------------------
3092 -- 3.5.1 Enumeration Literal Specification --
3093 ----------------------------------------------
3095 -- ENUMERATION_LITERAL_SPECIFICATION ::=
3096 -- DEFINING_IDENTIFIER | DEFINING_CHARACTER_LITERAL
3098 ---------------------------------------
3099 -- 3.5.1 Defining Character Literal --
3100 ---------------------------------------
3102 -- DEFINING_CHARACTER_LITERAL ::= CHARACTER_LITERAL
3104 -- A defining character literal is an entity, which has additional
3105 -- fields depending on the setting of the Ekind field. These
3106 -- additional fields are defined (and access subprograms declared)
3107 -- in package Einfo.
3109 -- Note: N_Defining_Character_Literal is an extended node whose fields
3110 -- are deliberately laid out to match layout of fields in an ordinary
3111 -- N_Character_Literal node, allowing for easy alteration of a character
3112 -- literal node into a defining character literal node. For details, see
3113 -- Sinfo.CN.Change_Character_Literal_To_Defining_Character_Literal.
3115 -- N_Defining_Character_Literal
3116 -- Sloc points to literal
3117 -- Chars contains the Name_Id for the identifier
3118 -- Next_Entity
3119 -- Scope
3120 -- Etype
3122 ------------------------------------
3123 -- 3.5.4 Integer Type Definition --
3124 ------------------------------------
3126 -- Note: there is an error in this rule in the latest version of the
3127 -- grammar, so we have retained the old rule pending clarification.
3129 -- INTEGER_TYPE_DEFINITION ::=
3130 -- SIGNED_INTEGER_TYPE_DEFINITION
3131 -- | MODULAR_TYPE_DEFINITION
3133 -------------------------------------------
3134 -- 3.5.4 Signed Integer Type Definition --
3135 -------------------------------------------
3137 -- SIGNED_INTEGER_TYPE_DEFINITION ::=
3138 -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION
3140 -- Note: the Low_Bound and High_Bound fields are set to Empty
3141 -- for integer types defined in package Standard.
3143 -- N_Signed_Integer_Type_Definition
3144 -- Sloc points to RANGE
3145 -- Low_Bound
3146 -- High_Bound
3148 ------------------------------------
3149 -- 3.5.4 Modular Type Definition --
3150 ------------------------------------
3152 -- MODULAR_TYPE_DEFINITION ::= mod static_EXPRESSION
3154 -- N_Modular_Type_Definition
3155 -- Sloc points to MOD
3156 -- Expression
3158 ---------------------------------
3159 -- 3.5.6 Real Type Definition --
3160 ---------------------------------
3162 -- REAL_TYPE_DEFINITION ::=
3163 -- FLOATING_POINT_DEFINITION | FIXED_POINT_DEFINITION
3165 --------------------------------------
3166 -- 3.5.7 Floating Point Definition --
3167 --------------------------------------
3169 -- FLOATING_POINT_DEFINITION ::=
3170 -- digits static_SIMPLE_EXPRESSION [REAL_RANGE_SPECIFICATION]
3172 -- Note: The Digits_Expression and Real_Range_Specifications fields
3173 -- are set to Empty for floating-point types declared in Standard.
3175 -- N_Floating_Point_Definition
3176 -- Sloc points to DIGITS
3177 -- Digits_Expression
3178 -- Real_Range_Specification (set to Empty if not present)
3180 -------------------------------------
3181 -- 3.5.7 Real Range Specification --
3182 -------------------------------------
3184 -- REAL_RANGE_SPECIFICATION ::=
3185 -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION
3187 -- N_Real_Range_Specification
3188 -- Sloc points to RANGE
3189 -- Low_Bound
3190 -- High_Bound
3192 -----------------------------------
3193 -- 3.5.9 Fixed Point Definition --
3194 -----------------------------------
3196 -- FIXED_POINT_DEFINITION ::=
3197 -- ORDINARY_FIXED_POINT_DEFINITION | DECIMAL_FIXED_POINT_DEFINITION
3199 --------------------------------------------
3200 -- 3.5.9 Ordinary Fixed Point Definition --
3201 --------------------------------------------
3203 -- ORDINARY_FIXED_POINT_DEFINITION ::=
3204 -- delta static_EXPRESSION REAL_RANGE_SPECIFICATION
3206 -- Note: In Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION
3208 -- N_Ordinary_Fixed_Point_Definition
3209 -- Sloc points to DELTA
3210 -- Delta_Expression
3211 -- Real_Range_Specification
3213 -------------------------------------------
3214 -- 3.5.9 Decimal Fixed Point Definition --
3215 -------------------------------------------
3217 -- DECIMAL_FIXED_POINT_DEFINITION ::=
3218 -- delta static_EXPRESSION
3219 -- digits static_EXPRESSION [REAL_RANGE_SPECIFICATION]
3221 -- Note: decimal types are not permitted in Ada 83 mode
3223 -- N_Decimal_Fixed_Point_Definition
3224 -- Sloc points to DELTA
3225 -- Delta_Expression
3226 -- Digits_Expression
3227 -- Real_Range_Specification (set to Empty if not present)
3229 ------------------------------
3230 -- 3.5.9 Digits Constraint --
3231 ------------------------------
3233 -- DIGITS_CONSTRAINT ::=
3234 -- digits static_EXPRESSION [RANGE_CONSTRAINT]
3236 -- Note: in Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION
3237 -- Note: in Ada 95, reduced accuracy subtypes are obsolescent
3239 -- N_Digits_Constraint
3240 -- Sloc points to DIGITS
3241 -- Digits_Expression
3242 -- Range_Constraint (set to Empty if not present)
3244 --------------------------------
3245 -- 3.6 Array Type Definition --
3246 --------------------------------
3248 -- ARRAY_TYPE_DEFINITION ::=
3249 -- UNCONSTRAINED_ARRAY_DEFINITION | CONSTRAINED_ARRAY_DEFINITION
3251 -----------------------------------------
3252 -- 3.6 Unconstrained Array Definition --
3253 -----------------------------------------
3255 -- UNCONSTRAINED_ARRAY_DEFINITION ::=
3256 -- array (INDEX_SUBTYPE_DEFINITION {, INDEX_SUBTYPE_DEFINITION}) of
3257 -- COMPONENT_DEFINITION
3259 -- Note: dimensionality of array is indicated by number of entries in
3260 -- the Subtype_Marks list, which has one entry for each dimension.
3262 -- N_Unconstrained_Array_Definition
3263 -- Sloc points to ARRAY
3264 -- Subtype_Marks
3265 -- Component_Definition
3267 -----------------------------------
3268 -- 3.6 Index Subtype Definition --
3269 -----------------------------------
3271 -- INDEX_SUBTYPE_DEFINITION ::= SUBTYPE_MARK range <>
3273 -- There is no explicit node in the tree for an index subtype
3274 -- definition since the N_Unconstrained_Array_Definition node
3275 -- incorporates the type marks which appear in this context.
3277 ---------------------------------------
3278 -- 3.6 Constrained Array Definition --
3279 ---------------------------------------
3281 -- CONSTRAINED_ARRAY_DEFINITION ::=
3282 -- array (DISCRETE_SUBTYPE_DEFINITION
3283 -- {, DISCRETE_SUBTYPE_DEFINITION})
3284 -- of COMPONENT_DEFINITION
3286 -- Note: dimensionality of array is indicated by number of entries
3287 -- in the Discrete_Subtype_Definitions list, which has one entry
3288 -- for each dimension.
3290 -- N_Constrained_Array_Definition
3291 -- Sloc points to ARRAY
3292 -- Discrete_Subtype_Definitions
3293 -- Component_Definition
3295 -- Note: although the language allows the full syntax for discrete
3296 -- subtype definitions (i.e. a discrete subtype indication or a range),
3297 -- in the generated tree, we always rewrite these as N_Range nodes.
3299 --------------------------------------
3300 -- 3.6 Discrete Subtype Definition --
3301 --------------------------------------
3303 -- DISCRETE_SUBTYPE_DEFINITION ::=
3304 -- discrete_SUBTYPE_INDICATION | RANGE
3306 -------------------------------
3307 -- 3.6 Component Definition --
3308 -------------------------------
3310 -- COMPONENT_DEFINITION ::=
3311 -- [aliased] [NULL_EXCLUSION] SUBTYPE_INDICATION | ACCESS_DEFINITION
3313 -- Note: although the syntax does not permit a component definition to
3314 -- be an anonymous array (and the parser will diagnose such an attempt
3315 -- with an appropriate message), it is possible for anonymous arrays
3316 -- to appear as component definitions. The semantics and back end handle
3317 -- this case properly, and the expander in fact generates such cases.
3318 -- Access_Definition is an optional field that gives support to
3319 -- Ada 2005 (AI-230). The parser generates nodes that have either the
3320 -- Subtype_Indication field or else the Access_Definition field.
3322 -- N_Component_Definition
3323 -- Sloc points to ALIASED, ACCESS, or to first token of subtype mark
3324 -- Aliased_Present
3325 -- Null_Exclusion_Present
3326 -- Subtype_Indication (set to Empty if not present)
3327 -- Access_Definition (set to Empty if not present)
3329 -----------------------------
3330 -- 3.6.1 Index Constraint --
3331 -----------------------------
3333 -- INDEX_CONSTRAINT ::= (DISCRETE_RANGE {, DISCRETE_RANGE})
3335 -- It is not in general possible to distinguish between discriminant
3336 -- constraints and index constraints at parse time, since a simple
3337 -- name could be either the subtype mark of a discrete range, or an
3338 -- expression in a discriminant association with no name. Either
3339 -- entry appears simply as the name, and the semantic parse must
3340 -- distinguish between the two cases. Thus we use a common tree
3341 -- node format for both of these constraint types.
3343 -- See Discriminant_Constraint for format of node
3345 ---------------------------
3346 -- 3.6.1 Discrete Range --
3347 ---------------------------
3349 -- DISCRETE_RANGE ::= discrete_SUBTYPE_INDICATION | RANGE
3351 ----------------------------
3352 -- 3.7 Discriminant Part --
3353 ----------------------------
3355 -- DISCRIMINANT_PART ::=
3356 -- UNKNOWN_DISCRIMINANT_PART | KNOWN_DISCRIMINANT_PART
3358 ------------------------------------
3359 -- 3.7 Unknown Discriminant Part --
3360 ------------------------------------
3362 -- UNKNOWN_DISCRIMINANT_PART ::= (<>)
3364 -- Note: unknown discriminant parts are not permitted in Ada 83 mode
3366 -- There is no explicit node in the tree for an unknown discriminant
3367 -- part. Instead the Unknown_Discriminants_Present flag is set in the
3368 -- parent node.
3370 ----------------------------------
3371 -- 3.7 Known Discriminant Part --
3372 ----------------------------------
3374 -- KNOWN_DISCRIMINANT_PART ::=
3375 -- (DISCRIMINANT_SPECIFICATION {; DISCRIMINANT_SPECIFICATION})
3377 -------------------------------------
3378 -- 3.7 Discriminant Specification --
3379 -------------------------------------
3381 -- DISCRIMINANT_SPECIFICATION ::=
3382 -- DEFINING_IDENTIFIER_LIST : [NULL_EXCLUSION] SUBTYPE_MARK
3383 -- [:= DEFAULT_EXPRESSION]
3384 -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION
3385 -- [:= DEFAULT_EXPRESSION]
3387 -- Although the syntax allows multiple identifiers in the list, the
3388 -- semantics is as though successive specifications were given with
3389 -- identical type definition and expression components. To simplify
3390 -- semantic processing, the parser represents a multiple declaration
3391 -- case as a sequence of single specifications, using the More_Ids and
3392 -- Prev_Ids flags to preserve the original source form as described
3393 -- in the section on "Handling of Defining Identifier Lists".
3395 -- N_Discriminant_Specification
3396 -- Sloc points to first identifier
3397 -- Defining_Identifier
3398 -- Null_Exclusion_Present
3399 -- Discriminant_Type subtype mark or access parameter definition
3400 -- Expression (set to Empty if no default expression)
3401 -- More_Ids (set to False if no more identifiers in list)
3402 -- Prev_Ids (set to False if no previous identifiers in list)
3404 -----------------------------
3405 -- 3.7 Default Expression --
3406 -----------------------------
3408 -- DEFAULT_EXPRESSION ::= EXPRESSION
3410 ------------------------------------
3411 -- 3.7.1 Discriminant Constraint --
3412 ------------------------------------
3414 -- DISCRIMINANT_CONSTRAINT ::=
3415 -- (DISCRIMINANT_ASSOCIATION {, DISCRIMINANT_ASSOCIATION})
3417 -- It is not in general possible to distinguish between discriminant
3418 -- constraints and index constraints at parse time, since a simple
3419 -- name could be either the subtype mark of a discrete range, or an
3420 -- expression in a discriminant association with no name. Either
3421 -- entry appears simply as the name, and the semantic parse must
3422 -- distinguish between the two cases. Thus we use a common tree
3423 -- node format for both of these constraint types.
3425 -- N_Index_Or_Discriminant_Constraint
3426 -- Sloc points to left paren
3427 -- Constraints points to list of discrete ranges or
3428 -- discriminant associations
3430 -------------------------------------
3431 -- 3.7.1 Discriminant Association --
3432 -------------------------------------
3434 -- DISCRIMINANT_ASSOCIATION ::=
3435 -- [discriminant_SELECTOR_NAME
3436 -- {| discriminant_SELECTOR_NAME} =>] EXPRESSION
3438 -- Note: a discriminant association that has no selector name list
3439 -- appears directly as an expression in the tree.
3441 -- N_Discriminant_Association
3442 -- Sloc points to first token of discriminant association
3443 -- Selector_Names (always non-empty, since if no selector
3444 -- names are present, this node is not used, see comment above)
3445 -- Expression
3447 ---------------------------------
3448 -- 3.8 Record Type Definition --
3449 ---------------------------------
3451 -- RECORD_TYPE_DEFINITION ::=
3452 -- [[abstract] tagged] [limited] RECORD_DEFINITION
3454 -- Note: ABSTRACT, TAGGED, LIMITED are not permitted in Ada 83 mode
3456 -- There is no explicit node in the tree for a record type definition.
3457 -- Instead the flags for Tagged_Present and Limited_Present appear in
3458 -- the N_Record_Definition node for a record definition appearing in
3459 -- the context of a record type definition.
3461 ----------------------------
3462 -- 3.8 Record Definition --
3463 ----------------------------
3465 -- RECORD_DEFINITION ::=
3466 -- record
3467 -- COMPONENT_LIST
3468 -- end record
3469 -- | null record
3471 -- Note: the Abstract_Present, Tagged_Present, and Limited_Present
3472 -- flags appear only for a record definition appearing in a record
3473 -- type definition.
3475 -- Note: the NULL RECORD case is not permitted in Ada 83
3477 -- N_Record_Definition
3478 -- Sloc points to RECORD or NULL
3479 -- End_Label (set to Empty if internally generated record)
3480 -- Abstract_Present
3481 -- Tagged_Present
3482 -- Limited_Present
3483 -- Component_List empty in null record case
3484 -- Null_Present set in null record case
3485 -- Task_Present set in task interfaces
3486 -- Protected_Present set in protected interfaces
3487 -- Synchronized_Present set in interfaces
3488 -- Interface_Present set in abstract interfaces
3489 -- Interface_List (set to No_List if none)
3491 -- Note: Task_Present, Protected_Present, Synchronized _Present,
3492 -- Interface_List and Interface_Present are used for abstract
3493 -- interfaces (see comments for INTERFACE_TYPE_DEFINITION).
3495 -------------------------
3496 -- 3.8 Component List --
3497 -------------------------
3499 -- COMPONENT_LIST ::=
3500 -- COMPONENT_ITEM {COMPONENT_ITEM}
3501 -- | {COMPONENT_ITEM} VARIANT_PART
3502 -- | null;
3504 -- N_Component_List
3505 -- Sloc points to first token of component list
3506 -- Component_Items
3507 -- Variant_Part (set to Empty if no variant part)
3508 -- Null_Present
3510 -------------------------
3511 -- 3.8 Component Item --
3512 -------------------------
3514 -- COMPONENT_ITEM ::= COMPONENT_DECLARATION | REPRESENTATION_CLAUSE
3516 -- Note: A component item can also be a pragma, and in the tree
3517 -- that is obtained after semantic processing, a component item
3518 -- can be an N_Null node resulting from a non-recognized pragma.
3520 --------------------------------
3521 -- 3.8 Component Declaration --
3522 --------------------------------
3524 -- COMPONENT_DECLARATION ::=
3525 -- DEFINING_IDENTIFIER_LIST : COMPONENT_DEFINITION
3526 -- [:= DEFAULT_EXPRESSION]
3527 -- [ASPECT_SPECIFICATIONS];
3529 -- Note: although the syntax does not permit a component definition to
3530 -- be an anonymous array (and the parser will diagnose such an attempt
3531 -- with an appropriate message), it is possible for anonymous arrays
3532 -- to appear as component definitions. The semantics and back end handle
3533 -- this case properly, and the expander in fact generates such cases.
3535 -- Although the syntax allows multiple identifiers in the list, the
3536 -- semantics is as though successive declarations were given with the
3537 -- same component definition and expression components. To simplify
3538 -- semantic processing, the parser represents a multiple declaration
3539 -- case as a sequence of single declarations, using the More_Ids and
3540 -- Prev_Ids flags to preserve the original source form as described
3541 -- in the section on "Handling of Defining Identifier Lists".
3543 -- N_Component_Declaration
3544 -- Sloc points to first identifier
3545 -- Defining_Identifier
3546 -- Component_Definition
3547 -- Expression (set to Empty if no default expression)
3548 -- More_Ids (set to False if no more identifiers in list)
3549 -- Prev_Ids (set to False if no previous identifiers in list)
3551 -------------------------
3552 -- 3.8.1 Variant Part --
3553 -------------------------
3555 -- VARIANT_PART ::=
3556 -- case discriminant_DIRECT_NAME is
3557 -- VARIANT {VARIANT}
3558 -- end case;
3560 -- Note: the variants list can contain pragmas as well as variants.
3561 -- In a properly formed program there is at least one variant.
3563 -- N_Variant_Part
3564 -- Sloc points to CASE
3565 -- Name
3566 -- Variants
3568 --------------------
3569 -- 3.8.1 Variant --
3570 --------------------
3572 -- VARIANT ::=
3573 -- when DISCRETE_CHOICE_LIST =>
3574 -- COMPONENT_LIST
3576 -- N_Variant
3577 -- Sloc points to WHEN
3578 -- Discrete_Choices
3579 -- Component_List
3580 -- Enclosing_Variant
3581 -- Present_Expr
3582 -- Dcheck_Function
3583 -- Has_SP_Choice
3585 -- Note: in the list of Discrete_Choices, the tree passed to the back
3586 -- end does not have choice entries corresponding to names of statically
3587 -- predicated subtypes. Such entries are always expanded out to the list
3588 -- of equivalent values or ranges.
3590 ---------------------------------
3591 -- 3.8.1 Discrete Choice List --
3592 ---------------------------------
3594 -- DISCRETE_CHOICE_LIST ::= DISCRETE_CHOICE {| DISCRETE_CHOICE}
3596 ----------------------------
3597 -- 3.8.1 Discrete Choice --
3598 ----------------------------
3600 -- DISCRETE_CHOICE ::= EXPRESSION | DISCRETE_RANGE | others
3602 -- Note: in Ada 83 mode, the expression must be a simple expression
3604 -- The only choice that appears explicitly is the OTHERS choice, as
3605 -- defined here. Other cases of discrete choice (expression and
3606 -- discrete range) appear directly. This production is also used
3607 -- for the OTHERS possibility of an exception choice.
3609 -- Note: in accordance with the syntax, the parser does not check that
3610 -- OTHERS appears at the end on its own in a choice list context. This
3611 -- is a semantic check.
3613 -- N_Others_Choice
3614 -- Sloc points to OTHERS
3615 -- Others_Discrete_Choices
3616 -- All_Others
3618 ----------------------------------
3619 -- 3.9.1 Record Extension Part --
3620 ----------------------------------
3622 -- RECORD_EXTENSION_PART ::= with RECORD_DEFINITION
3624 -- Note: record extension parts are not permitted in Ada 83 mode
3626 --------------------------------------
3627 -- 3.9.4 Interface Type Definition --
3628 --------------------------------------
3630 -- INTERFACE_TYPE_DEFINITION ::=
3631 -- [limited | task | protected | synchronized]
3632 -- interface [interface_list]
3634 -- Note: Interfaces are implemented with N_Record_Definition and
3635 -- N_Derived_Type_Definition nodes because most of the support
3636 -- for the analysis of abstract types has been reused to
3637 -- analyze abstract interfaces.
3639 ----------------------------------
3640 -- 3.10 Access Type Definition --
3641 ----------------------------------
3643 -- ACCESS_TYPE_DEFINITION ::=
3644 -- ACCESS_TO_OBJECT_DEFINITION
3645 -- | ACCESS_TO_SUBPROGRAM_DEFINITION
3647 --------------------------
3648 -- 3.10 Null Exclusion --
3649 --------------------------
3651 -- NULL_EXCLUSION ::= not null
3653 ---------------------------------------
3654 -- 3.10 Access To Object Definition --
3655 ---------------------------------------
3657 -- ACCESS_TO_OBJECT_DEFINITION ::=
3658 -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER]
3659 -- SUBTYPE_INDICATION
3661 -- N_Access_To_Object_Definition
3662 -- Sloc points to ACCESS
3663 -- All_Present
3664 -- Null_Exclusion_Present
3665 -- Null_Excluding_Subtype
3666 -- Subtype_Indication
3667 -- Constant_Present
3669 -----------------------------------
3670 -- 3.10 General Access Modifier --
3671 -----------------------------------
3673 -- GENERAL_ACCESS_MODIFIER ::= all | constant
3675 -- Note: general access modifiers are not permitted in Ada 83 mode
3677 -- There is no explicit node in the tree for general access modifier.
3678 -- Instead the All_Present or Constant_Present flags are set in the
3679 -- parent node.
3681 -------------------------------------------
3682 -- 3.10 Access To Subprogram Definition --
3683 -------------------------------------------
3685 -- ACCESS_TO_SUBPROGRAM_DEFINITION
3686 -- [NULL_EXCLUSION] access [protected] procedure PARAMETER_PROFILE
3687 -- | [NULL_EXCLUSION] access [protected] function
3688 -- PARAMETER_AND_RESULT_PROFILE
3690 -- Note: access to subprograms are not permitted in Ada 83 mode
3692 -- N_Access_Function_Definition
3693 -- Sloc points to ACCESS
3694 -- Null_Exclusion_Present
3695 -- Null_Exclusion_In_Return_Present
3696 -- Protected_Present
3697 -- Parameter_Specifications (set to No_List if no formal part)
3698 -- Result_Definition result subtype (subtype mark or access def)
3700 -- N_Access_Procedure_Definition
3701 -- Sloc points to ACCESS
3702 -- Null_Exclusion_Present
3703 -- Protected_Present
3704 -- Parameter_Specifications (set to No_List if no formal part)
3706 -----------------------------
3707 -- 3.10 Access Definition --
3708 -----------------------------
3710 -- ACCESS_DEFINITION ::=
3711 -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER] SUBTYPE_MARK
3712 -- | ACCESS_TO_SUBPROGRAM_DEFINITION
3714 -- Note: access to subprograms are an Ada 2005 (AI-254) extension
3716 -- N_Access_Definition
3717 -- Sloc points to ACCESS
3718 -- Null_Exclusion_Present
3719 -- All_Present
3720 -- Constant_Present
3721 -- Subtype_Mark
3722 -- Access_To_Subprogram_Definition (set to Empty if not present)
3724 -----------------------------------------
3725 -- 3.10.1 Incomplete Type Declaration --
3726 -----------------------------------------
3728 -- INCOMPLETE_TYPE_DECLARATION ::=
3729 -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] [IS TAGGED];
3731 -- N_Incomplete_Type_Declaration
3732 -- Sloc points to TYPE
3733 -- Defining_Identifier
3734 -- Discriminant_Specifications (set to No_List if no
3735 -- discriminant part, or if the discriminant part is an
3736 -- unknown discriminant part)
3737 -- Premature_Use used for improved diagnostics.
3738 -- Unknown_Discriminants_Present set if (<>) discriminant
3739 -- Tagged_Present
3741 ----------------------------
3742 -- 3.11 Declarative Part --
3743 ----------------------------
3745 -- DECLARATIVE_PART ::= {DECLARATIVE_ITEM}
3747 -- Note: although the parser enforces the syntactic requirement that
3748 -- a declarative part can contain only declarations, the semantic
3749 -- processing may add statements to the list of actions in a
3750 -- declarative part, so the code generator should be prepared
3751 -- to accept a statement in this position.
3753 ----------------------------
3754 -- 3.11 Declarative Item --
3755 ----------------------------
3757 -- DECLARATIVE_ITEM ::= BASIC_DECLARATIVE_ITEM | BODY
3759 ----------------------------------
3760 -- 3.11 Basic Declarative Item --
3761 ----------------------------------
3763 -- BASIC_DECLARATIVE_ITEM ::=
3764 -- BASIC_DECLARATION | REPRESENTATION_CLAUSE | USE_CLAUSE
3766 ----------------
3767 -- 3.11 Body --
3768 ----------------
3770 -- BODY ::= PROPER_BODY | BODY_STUB
3772 -----------------------
3773 -- 3.11 Proper Body --
3774 -----------------------
3776 -- PROPER_BODY ::=
3777 -- SUBPROGRAM_BODY | PACKAGE_BODY | TASK_BODY | PROTECTED_BODY
3779 ---------------
3780 -- 4.1 Name --
3781 ---------------
3783 -- NAME ::=
3784 -- DIRECT_NAME | EXPLICIT_DEREFERENCE
3785 -- | INDEXED_COMPONENT | SLICE
3786 -- | SELECTED_COMPONENT | ATTRIBUTE_REFERENCE
3787 -- | TYPE_CONVERSION | FUNCTION_CALL
3788 -- | CHARACTER_LITERAL
3790 ----------------------
3791 -- 4.1 Direct Name --
3792 ----------------------
3794 -- DIRECT_NAME ::= IDENTIFIER | OPERATOR_SYMBOL
3796 -----------------
3797 -- 4.1 Prefix --
3798 -----------------
3800 -- PREFIX ::= NAME | IMPLICIT_DEREFERENCE
3802 -------------------------------
3803 -- 4.1 Explicit Dereference --
3804 -------------------------------
3806 -- EXPLICIT_DEREFERENCE ::= NAME . all
3808 -- N_Explicit_Dereference
3809 -- Sloc points to ALL
3810 -- Prefix
3811 -- Actual_Designated_Subtype
3812 -- Has_Dereference_Action
3813 -- Atomic_Sync_Required
3814 -- plus fields for expression
3816 -------------------------------
3817 -- 4.1 Implicit Dereference --
3818 -------------------------------
3820 -- IMPLICIT_DEREFERENCE ::= NAME
3822 ------------------------------
3823 -- 4.1.1 Indexed Component --
3824 ------------------------------
3826 -- INDEXED_COMPONENT ::= PREFIX (EXPRESSION {, EXPRESSION})
3828 -- Note: the parser may generate this node in some situations where it
3829 -- should be a function call. The semantic pass must correct this
3830 -- misidentification (which is inevitable at the parser level).
3832 -- N_Indexed_Component
3833 -- Sloc contains a copy of the Sloc value of the Prefix
3834 -- Prefix
3835 -- Expressions
3836 -- Generalized_Indexing
3837 -- Atomic_Sync_Required
3838 -- plus fields for expression
3840 -- Note: if any of the subscripts requires a range check, then the
3841 -- Do_Range_Check flag is set on the corresponding expression, with
3842 -- the index type being determined from the type of the Prefix, which
3843 -- references the array being indexed.
3845 -- Note: in a fully analyzed and expanded indexed component node, and
3846 -- hence in any such node that gigi sees, if the prefix is an access
3847 -- type, then an explicit dereference operation has been inserted.
3849 ------------------
3850 -- 4.1.2 Slice --
3851 ------------------
3853 -- SLICE ::= PREFIX (DISCRETE_RANGE)
3855 -- Note: an implicit subtype is created to describe the resulting
3856 -- type, so that the bounds of this type are the bounds of the slice.
3858 -- N_Slice
3859 -- Sloc points to first token of prefix
3860 -- Prefix
3861 -- Discrete_Range
3862 -- plus fields for expression
3864 -------------------------------
3865 -- 4.1.3 Selected Component --
3866 -------------------------------
3868 -- SELECTED_COMPONENT ::= PREFIX . SELECTOR_NAME
3870 -- Note: selected components that are semantically expanded names get
3871 -- changed during semantic processing into the separate N_Expanded_Name
3872 -- node. See description of this node in the section on semantic nodes.
3874 -- N_Selected_Component
3875 -- Sloc points to the period
3876 -- Prefix
3877 -- Selector_Name
3878 -- Associated_Node
3879 -- Do_Discriminant_Check
3880 -- Is_In_Discriminant_Check
3881 -- Atomic_Sync_Required
3882 -- Is_Prefixed_Call
3883 -- plus fields for expression
3885 --------------------------
3886 -- 4.1.3 Selector Name --
3887 --------------------------
3889 -- SELECTOR_NAME ::= IDENTIFIER | CHARACTER_LITERAL | OPERATOR_SYMBOL
3891 --------------------------------
3892 -- 4.1.4 Attribute Reference --
3893 --------------------------------
3895 -- ATTRIBUTE_REFERENCE ::= PREFIX ' ATTRIBUTE_DESIGNATOR
3897 -- Note: the syntax is quite ambiguous at this point. Consider:
3899 -- A'Length (X) X is part of the attribute designator
3900 -- A'Pos (X) X is an explicit actual parameter of function A'Pos
3901 -- A'Class (X) X is the expression of a type conversion
3903 -- It would be possible for the parser to distinguish these cases
3904 -- by looking at the attribute identifier. However, that would mean
3905 -- more work in introducing new implementation defined attributes,
3906 -- and also it would mean that special processing for attributes
3907 -- would be scattered around, instead of being centralized in the
3908 -- semantic routine that handles an N_Attribute_Reference node.
3909 -- Consequently, the parser in all the above cases stores the
3910 -- expression (X in these examples) as a single element list in
3911 -- in the Expressions field of the N_Attribute_Reference node.
3913 -- Similarly, for attributes like Max which take two arguments,
3914 -- we store the two arguments as a two element list in the
3915 -- Expressions field. Of course it is clear at parse time that
3916 -- this case is really a function call with an attribute as the
3917 -- prefix, but it turns out to be convenient to handle the two
3918 -- argument case in a similar manner to the one argument case,
3919 -- and indeed in general the parser will accept any number of
3920 -- expressions in this position and store them as a list in the
3921 -- attribute reference node. This allows for future addition of
3922 -- attributes that take more than two arguments.
3924 -- Note: named associates are not permitted in function calls where
3925 -- the function is an attribute (see RM 6.4(3)) so it is legitimate
3926 -- to skip the normal subprogram argument processing.
3928 -- Note: for the attributes whose designators are technically keywords,
3929 -- i.e. digits, access, delta, range, the Attribute_Name field contains
3930 -- the corresponding name, even though no identifier is involved.
3932 -- Note: the generated code may contain stream attributes applied to
3933 -- limited types for which no stream routines exist officially. In such
3934 -- case, the result is to use the stream attribute for the underlying
3935 -- full type, or in the case of a protected type, the components
3936 -- (including any discriminants) are merely streamed in order.
3938 -- See Exp_Attr for a complete description of which attributes are
3939 -- passed onto Gigi, and which are handled entirely by the front end.
3941 -- Gigi restriction: For the Pos attribute, the prefix cannot be
3942 -- a non-standard enumeration type or a nonzero/zero semantics
3943 -- boolean type, so the value is simply the stored representation.
3945 -- Gigi requirement: For the Mechanism_Code attribute, if the prefix
3946 -- references a subprogram that is a renaming, then the front end must
3947 -- rewrite the attribute to refer directly to the renamed entity.
3949 -- Note: syntactically the prefix of an attribute reference must be a
3950 -- name, and this (somewhat artificial) requirement is enforced by the
3951 -- parser. However, for many attributes, such as 'Valid, it is quite
3952 -- reasonable to apply the attribute to any value, and hence to any
3953 -- expression. Internally in the tree, the prefix is an expression which
3954 -- does not have to be a name, and this is handled fine by the semantic
3955 -- analysis and expansion, and back ends. This arises for the case of
3956 -- attribute references built by the expander (e.g. 'Valid for the case
3957 -- of an implicit validity check).
3959 -- Note: In generated code, the Address and Unrestricted_Access
3960 -- attributes can be applied to any expression, and the meaning is
3961 -- to create an object containing the value (the object is in the
3962 -- current stack frame), and pass the address of this value. If the
3963 -- Must_Be_Byte_Aligned flag is set, then the object whose address
3964 -- is taken must be on a byte (storage unit) boundary, and if it is
3965 -- not (or may not be), then the generated code must create a copy
3966 -- that is byte aligned, and pass the address of this copy.
3968 -- N_Attribute_Reference
3969 -- Sloc points to apostrophe
3970 -- Prefix (general expression, see note above)
3971 -- Attribute_Name identifier name from attribute designator
3972 -- Expressions (set to No_List if no associated expressions)
3973 -- Entity used if the attribute yields a type
3974 -- Associated_Node
3975 -- Is_Elaboration_Checks_OK_Node
3976 -- Is_SPARK_Mode_On_Node
3977 -- Is_Elaboration_Warnings_OK_Node
3978 -- Header_Size_Added
3979 -- Redundant_Use
3980 -- Must_Be_Byte_Aligned
3981 -- plus fields for expression
3983 -- Note: in Modify_Tree_For_C mode, Max and Min attributes are expanded
3984 -- into equivalent if expressions, properly taking care of side effects.
3986 ---------------------------------
3987 -- 4.1.4 Attribute Designator --
3988 ---------------------------------
3990 -- ATTRIBUTE_DESIGNATOR ::=
3991 -- IDENTIFIER [(static_EXPRESSION)]
3992 -- | access | delta | digits
3994 -- There is no explicit node in the tree for an attribute designator.
3995 -- Instead the Attribute_Name and Expressions fields of the parent
3996 -- node (N_Attribute_Reference node) hold the information.
3998 -- Note: if ACCESS, DELTA, or DIGITS appears in an attribute
3999 -- designator, then they are treated as identifiers internally
4000 -- rather than the keywords of the same name.
4002 --------------------------------------
4003 -- 4.1.4 Range Attribute Reference --
4004 --------------------------------------
4006 -- RANGE_ATTRIBUTE_REFERENCE ::= PREFIX ' RANGE_ATTRIBUTE_DESIGNATOR
4008 -- A range attribute reference is represented in the tree using the
4009 -- normal N_Attribute_Reference node.
4011 ---------------------------------------
4012 -- 4.1.4 Range Attribute Designator --
4013 ---------------------------------------
4015 -- RANGE_ATTRIBUTE_DESIGNATOR ::= Range [(static_EXPRESSION)]
4017 -- A range attribute designator is represented in the tree using the
4018 -- normal N_Attribute_Reference node.
4020 --------------------
4021 -- 4.3 Aggregate --
4022 --------------------
4024 -- AGGREGATE ::=
4025 -- RECORD_AGGREGATE | EXTENSION_AGGREGATE | ARRAY_AGGREGATE
4027 -----------------------------
4028 -- 4.3.1 Record Aggregate --
4029 -----------------------------
4031 -- RECORD_AGGREGATE ::= (RECORD_COMPONENT_ASSOCIATION_LIST)
4033 -- N_Aggregate
4034 -- Sloc points to left parenthesis
4035 -- Expressions (set to No_List if none or null record case)
4036 -- Component_Associations (set to No_List if none)
4037 -- Null_Record_Present
4038 -- Aggregate_Bounds
4039 -- Associated_Node
4040 -- Compile_Time_Known_Aggregate
4041 -- Expansion_Delayed
4042 -- Has_Self_Reference
4043 -- Is_Homogeneous_Aggregate
4044 -- plus fields for expression
4046 -- Note: this structure is used for both record and array aggregates
4047 -- since the two cases are not separable by the parser. The parser
4048 -- makes no attempt to enforce consistency here, so it is up to the
4049 -- semantic phase to make sure that the aggregate is consistent (i.e.
4050 -- that it is not a "half-and-half" case that mixes record and array
4051 -- syntax). In particular, for a record aggregate, the expressions
4052 -- field will be set if there are positional associations.
4054 -- Note: N_Aggregate is not used for all aggregates; in particular,
4055 -- there is a separate node kind for extension aggregates.
4057 -- Note: gigi/gcc can handle array aggregates correctly providing that
4058 -- they are entirely positional, and the array subtype involved has a
4059 -- known at compile time length and is not bit packed, or a convention
4060 -- Fortran array with more than one dimension. If these conditions
4061 -- are not met, then the front end must translate the aggregate into
4062 -- an appropriate set of assignments into a temporary.
4064 -- Note: for the record aggregate case, gigi/gcc can handle most cases
4065 -- of record aggregates, including those for packed, and rep-claused
4066 -- records, and also variant records, providing that there are no
4067 -- variable length fields whose size is not known at compile time,
4068 -- and providing that the aggregate is presented in fully named form.
4070 -- The other situation in which array aggregates and record aggregates
4071 -- cannot be passed to the back end is if assignment to one or more
4072 -- components itself needs expansion, e.g. in the case of an assignment
4073 -- of an object of a controlled type. In such cases, the front end
4074 -- must expand the aggregate to a series of assignments, and apply
4075 -- the required expansion to the individual assignment statements.
4077 ----------------------------------------------
4078 -- 4.3.1 Record Component Association List --
4079 ----------------------------------------------
4081 -- RECORD_COMPONENT_ASSOCIATION_LIST ::=
4082 -- RECORD_COMPONENT_ASSOCIATION {, RECORD_COMPONENT_ASSOCIATION}
4083 -- | null record
4085 -- There is no explicit node in the tree for a record component
4086 -- association list. Instead the Null_Record_Present flag is set in
4087 -- the parent node for the NULL RECORD case.
4089 ------------------------------------------------------
4090 -- 4.3.1 Record Component Association (also 4.3.3) --
4091 ------------------------------------------------------
4093 -- RECORD_COMPONENT_ASSOCIATION ::=
4094 -- [COMPONENT_CHOICE_LIST =>] EXPRESSION
4096 -- N_Component_Association
4097 -- Sloc points to first selector name
4098 -- Choices
4099 -- Expression (empty if Box_Present)
4100 -- Loop_Actions
4101 -- Box_Present
4102 -- Inherited_Discriminant
4103 -- Binding_Chars
4105 -- Note: this structure is used for both record component associations
4106 -- and array component associations, since the two cases aren't always
4107 -- separable by the parser. The choices list may represent either a
4108 -- list of selector names in the record aggregate case, or a list of
4109 -- discrete choices in the array aggregate case or an N_Others_Choice
4110 -- node (which appears as a singleton list). Box_Present gives support
4111 -- to Ada 2005 (AI-287). Binding_Chars is only set if GNAT extensions
4112 -- are enabled and the given component association occurs within a
4113 -- choice_expression; in this case, it is the Name_Id, if any, specified
4114 -- via either of two syntactic forms: "Foo => Bar is Abc" or
4115 -- "Foo => <Abc>".
4117 ----------------------------------
4118 -- 4.3.1 Component Choice List --
4119 ----------------------------------
4121 -- COMPONENT_CHOICE_LIST ::=
4122 -- component_SELECTOR_NAME {| component_SELECTOR_NAME}
4123 -- | others
4125 -- The entries of a component choice list appear in the Choices list of
4126 -- the associated N_Component_Association, as either selector names, or
4127 -- as an N_Others_Choice node.
4129 --------------------------------
4130 -- 4.3.2 Extension Aggregate --
4131 --------------------------------
4133 -- EXTENSION_AGGREGATE ::=
4134 -- (ANCESTOR_PART with RECORD_COMPONENT_ASSOCIATION_LIST)
4136 -- Note: extension aggregates are not permitted in Ada 83 mode
4138 -- N_Extension_Aggregate
4139 -- Sloc points to left parenthesis
4140 -- Ancestor_Part
4141 -- Associated_Node
4142 -- Expressions (set to No_List if none or null record case)
4143 -- Component_Associations (set to No_List if none)
4144 -- Null_Record_Present
4145 -- Expansion_Delayed
4146 -- Has_Self_Reference
4147 -- plus fields for expression
4149 --------------------------
4150 -- 4.3.2 Ancestor Part --
4151 --------------------------
4153 -- ANCESTOR_PART ::= EXPRESSION | SUBTYPE_MARK
4155 ----------------------------
4156 -- 4.3.3 Array Aggregate --
4157 ----------------------------
4159 -- ARRAY_AGGREGATE ::=
4160 -- POSITIONAL_ARRAY_AGGREGATE | NAMED_ARRAY_AGGREGATE
4162 ---------------------------------------
4163 -- 4.3.3 Positional Array Aggregate --
4164 ---------------------------------------
4166 -- POSITIONAL_ARRAY_AGGREGATE ::=
4167 -- (EXPRESSION, EXPRESSION {, EXPRESSION})
4168 -- | (EXPRESSION {, EXPRESSION}, others => EXPRESSION)
4170 -- See Record_Aggregate (4.3.1) for node structure
4172 ----------------------------------
4173 -- 4.3.3 Named Array Aggregate --
4174 ----------------------------------
4176 -- NAMED_ARRAY_AGGREGATE ::=
4177 -- (ARRAY_COMPONENT_ASSOCIATION {, ARRAY_COMPONENT_ASSOCIATION})
4179 -- See Record_Aggregate (4.3.1) for node structure
4181 ----------------------------------------
4182 -- 4.3.3 Array Component Association --
4183 ----------------------------------------
4185 -- ARRAY_COMPONENT_ASSOCIATION ::=
4186 -- DISCRETE_CHOICE_LIST => EXPRESSION
4187 -- | ITERATED_COMPONENT_ASSOCIATION
4189 -- See Record_Component_Association (4.3.1) for node structure
4190 -- The iterated_component_association is introduced into the
4191 -- Corrigendum of Ada_2012 by AI12-061.
4193 ------------------------------------------
4194 -- 4.3.3 Iterated component Association --
4195 ------------------------------------------
4197 -- ITERATED_COMPONENT_ASSOCIATION ::=
4198 -- for DEFINING_IDENTIFIER in DISCRETE_CHOICE_LIST => EXPRESSION
4200 -- N_Iterated_Component_Association
4201 -- Sloc points to FOR
4202 -- Defining_Identifier
4203 -- Iterator_Specification (set to Empty if no Iterator_Spec)
4204 -- Expression
4205 -- Discrete_Choices
4206 -- Loop_Actions
4207 -- Box_Present
4209 -- Note that Box_Present is always False, but it is intentionally added
4210 -- for completeness.
4212 ----------------------------
4213 -- 4.3.4 Delta Aggregate --
4214 ----------------------------
4216 -- N_Delta_Aggregate
4217 -- Sloc points to left parenthesis
4218 -- Expression
4219 -- Component_Associations
4220 -- Etype
4222 ---------------------------------
4223 -- 3.4.5 Comtainer_Aggregates --
4224 ---------------------------------
4226 -- N_Iterated_Element_Association
4227 -- Key_Expression
4228 -- Iterator_Specification
4229 -- Expression
4230 -- Loop_Parameter_Specification
4231 -- Loop_Actions
4232 -- Box_Present
4234 -- Exactly one of Iterator_Specification or Loop_Parameter_
4235 -- specification is present. If the Key_Expression is absent,
4236 -- the construct is parsed as an Iterated_Component_Association,
4237 -- and legality checks are performed during semantic analysis.
4239 -- Both iterated associations are Ada 2022 features that are
4240 -- expanded during aggregate construction, and do not appear in
4241 -- expanded code.
4243 --------------------------------------------------
4244 -- 4.4 Expression/Relation/Term/Factor/Primary --
4245 --------------------------------------------------
4247 -- EXPRESSION ::=
4248 -- RELATION {LOGICAL_OPERATOR RELATION}
4250 -- CHOICE_EXPRESSION ::=
4251 -- CHOICE_RELATION {LOGICAL_OPERATOR CHOICE_RELATION}
4253 -- CHOICE_RELATION ::=
4254 -- SIMPLE_EXPRESSION [RELATIONAL_OPERATOR SIMPLE_EXPRESSION]
4256 -- RELATION ::=
4257 -- SIMPLE_EXPRESSION [not] in MEMBERSHIP_CHOICE_LIST
4258 -- | RAISE_EXPRESSION
4260 -- MEMBERSHIP_CHOICE_LIST ::=
4261 -- MEMBERSHIP_CHOICE {'|' MEMBERSHIP CHOICE}
4263 -- MEMBERSHIP_CHOICE ::=
4264 -- CHOICE_EXPRESSION | RANGE | SUBTYPE_MARK
4266 -- LOGICAL_OPERATOR ::= and | and then | or | or else | xor
4268 -- SIMPLE_EXPRESSION ::=
4269 -- [UNARY_ADDING_OPERATOR] TERM {BINARY_ADDING_OPERATOR TERM}
4271 -- TERM ::= FACTOR {MULTIPLYING_OPERATOR FACTOR}
4273 -- FACTOR ::= PRIMARY [** PRIMARY] | abs PRIMARY | not PRIMARY
4275 -- No nodes are generated for any of these constructs. Instead, the
4276 -- node for the operator appears directly. When we refer to an
4277 -- expression in this description, we mean any of the possible
4278 -- constituent components of an expression (e.g. identifier is
4279 -- an example of an expression).
4281 -- Note: the above syntax is that Ada 2012 syntax which restricts
4282 -- choice relations to simple expressions to avoid ambiguities in
4283 -- some contexts with set membership notation. It has been decided
4284 -- that in retrospect, the Ada 95 change allowing general expressions
4285 -- in this context was a mistake, so we have reverted to the above
4286 -- syntax in Ada 95 and Ada 2005 modes (the restriction to simple
4287 -- expressions was there in Ada 83 from the start).
4289 ------------------
4290 -- 4.4 Primary --
4291 ------------------
4293 -- PRIMARY ::=
4294 -- NUMERIC_LITERAL | null
4295 -- | STRING_LITERAL | AGGREGATE
4296 -- | NAME | QUALIFIED_EXPRESSION
4297 -- | ALLOCATOR | (EXPRESSION)
4299 -- Usually there is no explicit node in the tree for primary. Instead
4300 -- the constituent (e.g. AGGREGATE) appears directly. There are two
4301 -- exceptions. First, there is an explicit node for a null primary.
4303 -- N_Null
4304 -- Sloc points to NULL
4305 -- plus fields for expression
4307 -- Second, the case of (EXPRESSION) is handled specially. Ada requires
4308 -- that the parser keep track of which subexpressions are enclosed
4309 -- in parentheses, and how many levels of parentheses are used. This
4310 -- information is required for optimization purposes, and also for
4311 -- some semantic checks (e.g. (((1))) in a procedure spec does not
4312 -- conform with ((((1)))) in the body).
4314 -- The parentheses are recorded by keeping a Paren_Count field in every
4315 -- subexpression node (it is actually present in all nodes, but only
4316 -- used in subexpression nodes). This count records the number of
4317 -- levels of parentheses. If the number of levels in the source exceeds
4318 -- the maximum accommodated by this count, then the count is simply left
4319 -- at the maximum value. This means that there are some pathological
4320 -- cases of failure to detect conformance failures (e.g. an expression
4321 -- with 500 levels of parens will conform with one with 501 levels),
4322 -- but we do not need to lose sleep over this.
4324 -- Historical note: in versions of GNAT prior to 1.75, there was a node
4325 -- type N_Parenthesized_Expression used to accurately record unlimited
4326 -- numbers of levels of parentheses. However, it turned out to be a
4327 -- real nuisance to have to take into account the possible presence of
4328 -- this node during semantic analysis, since basically parentheses have
4329 -- zero relevance to semantic analysis.
4331 -- Note: the level of parentheses always present in things like
4332 -- aggregates does not count, only the parentheses in the primary
4333 -- (EXPRESSION) affect the setting of the Paren_Count field.
4335 -- 2nd Note: the contents of the Expression field must be ignored (i.e.
4336 -- treated as though it were Empty) if No_Initialization is set True.
4338 --------------------------------------
4339 -- 4.5 Short-Circuit Control Forms --
4340 --------------------------------------
4342 -- EXPRESSION ::=
4343 -- RELATION {and then RELATION} | RELATION {or else RELATION}
4345 -- Gigi restriction: For both these control forms, the operand and
4346 -- result types are always Standard.Boolean. The expander inserts the
4347 -- required conversion operations where needed to ensure this is the
4348 -- case.
4350 -- N_And_Then
4351 -- Sloc points to AND of AND THEN
4352 -- Left_Opnd
4353 -- Right_Opnd
4354 -- Actions
4355 -- plus fields for expression
4357 -- N_Or_Else
4358 -- Sloc points to OR of OR ELSE
4359 -- Left_Opnd
4360 -- Right_Opnd
4361 -- Actions
4362 -- plus fields for expression
4364 -- Note: The Actions field is used to hold actions associated with
4365 -- the right hand operand. These have to be treated specially since
4366 -- they are not unconditionally executed. See Insert_Actions for a
4367 -- more detailed description of how these actions are handled.
4369 ---------------------------
4370 -- 4.5 Membership Tests --
4371 ---------------------------
4373 -- RELATION ::=
4374 -- SIMPLE_EXPRESSION [not] in MEMBERSHIP_CHOICE_LIST
4376 -- MEMBERSHIP_CHOICE_LIST ::=
4377 -- MEMBERSHIP_CHOICE {'|' MEMBERSHIP CHOICE}
4379 -- MEMBERSHIP_CHOICE ::=
4380 -- CHOICE_EXPRESSION | RANGE | SUBTYPE_MARK
4382 -- Note: although the grammar above allows only a range or a subtype
4383 -- mark, the parser in fact will accept any simple expression in place
4384 -- of a subtype mark. This means that the semantic analyzer must be able
4385 -- to deal with, and diagnose a simple expression other than a name for
4386 -- the right operand. This simplifies error recovery in the parser.
4388 -- The Alternatives field below is present only if there is more than
4389 -- one Membership_Choice present (which is legitimate only in Ada 2012
4390 -- mode) in which case Right_Opnd is Empty, and Alternatives contains
4391 -- the list of choices. In the tree passed to the back end, Alternatives
4392 -- is always No_List, and Right_Opnd is set (i.e. the expansion circuit
4393 -- expands out the complex set membership case using simple membership
4394 -- and equality operations).
4396 -- Should we rename Alternatives here to Membership_Choices ???
4398 -- N_In
4399 -- Sloc points to IN
4400 -- Left_Opnd
4401 -- Right_Opnd
4402 -- Alternatives (set to No_List if only one set alternative)
4403 -- No_Minimize_Eliminate
4404 -- plus fields for expression
4406 -- N_Not_In
4407 -- Sloc points to NOT of NOT IN
4408 -- Left_Opnd
4409 -- Right_Opnd
4410 -- Alternatives (set to No_List if only one set alternative)
4411 -- No_Minimize_Eliminate
4412 -- plus fields for expression
4414 --------------------
4415 -- 4.5 Operators --
4416 --------------------
4418 -- LOGICAL_OPERATOR ::= and | or | xor
4420 -- RELATIONAL_OPERATOR ::= = | /= | < | <= | > | >=
4422 -- BINARY_ADDING_OPERATOR ::= + | - | &
4424 -- UNARY_ADDING_OPERATOR ::= + | -
4426 -- MULTIPLYING_OPERATOR ::= * | / | mod | rem
4428 -- HIGHEST_PRECEDENCE_OPERATOR ::= ** | abs | not
4430 -- Gigi restriction: Gigi will never be given * / mod rem nodes with
4431 -- fixed-point operands. All handling of smalls for multiplication and
4432 -- division is handled by the front end (mod and rem result only from
4433 -- expansion). Gigi thus never needs to worry about small values (for
4434 -- other operators operating on fixed-point, e.g. addition, the small
4435 -- value does not have any semantic effect anyway, these are always
4436 -- integer operations).
4438 -- Gigi restriction: For all operators taking Boolean operands, the
4439 -- type is always Standard.Boolean. The expander inserts the required
4440 -- conversion operations where needed to ensure this is the case.
4442 -- N_Op_And
4443 -- Sloc points to AND
4444 -- Do_Length_Check
4445 -- plus fields for binary operator
4446 -- plus fields for expression
4448 -- N_Op_Or
4449 -- Sloc points to OR
4450 -- Do_Length_Check
4451 -- plus fields for binary operator
4452 -- plus fields for expression
4454 -- N_Op_Xor
4455 -- Sloc points to XOR
4456 -- Do_Length_Check
4457 -- plus fields for binary operator
4458 -- plus fields for expression
4460 -- N_Op_Eq
4461 -- Sloc points to =
4462 -- plus fields for binary operator
4463 -- plus fields for expression
4465 -- N_Op_Ne
4466 -- Sloc points to /=
4467 -- plus fields for binary operator
4468 -- plus fields for expression
4470 -- N_Op_Lt
4471 -- Sloc points to <
4472 -- plus fields for binary operator
4473 -- plus fields for expression
4475 -- N_Op_Le
4476 -- Sloc points to <=
4477 -- plus fields for binary operator
4478 -- plus fields for expression
4480 -- N_Op_Gt
4481 -- Sloc points to >
4482 -- plus fields for binary operator
4483 -- plus fields for expression
4485 -- N_Op_Ge
4486 -- Sloc points to >=
4487 -- plus fields for binary operator
4488 -- plus fields for expression
4490 -- N_Op_Add
4491 -- Sloc points to + (binary)
4492 -- plus fields for binary operator
4493 -- plus fields for expression
4495 -- N_Op_Subtract
4496 -- Sloc points to - (binary)
4497 -- plus fields for binary operator
4498 -- plus fields for expression
4500 -- N_Op_Concat
4501 -- Sloc points to &
4502 -- Is_Component_Left_Opnd
4503 -- Is_Component_Right_Opnd
4504 -- plus fields for binary operator
4505 -- plus fields for expression
4507 -- N_Op_Multiply
4508 -- Sloc points to *
4509 -- Rounded_Result
4510 -- plus fields for binary operator
4511 -- plus fields for expression
4513 -- N_Op_Divide
4514 -- Sloc points to /
4515 -- Do_Division_Check
4516 -- Rounded_Result
4517 -- plus fields for binary operator
4518 -- plus fields for expression
4520 -- N_Op_Mod
4521 -- Sloc points to MOD
4522 -- Do_Division_Check
4523 -- plus fields for binary operator
4524 -- plus fields for expression
4526 -- N_Op_Rem
4527 -- Sloc points to REM
4528 -- Do_Division_Check
4529 -- plus fields for binary operator
4530 -- plus fields for expression
4532 -- N_Op_Expon
4533 -- Sloc points to **
4534 -- Is_Power_Of_2_For_Shift
4535 -- plus fields for binary operator
4536 -- plus fields for expression
4538 -- N_Op_Plus
4539 -- Sloc points to + (unary)
4540 -- plus fields for unary operator
4541 -- plus fields for expression
4543 -- N_Op_Minus
4544 -- Sloc points to - (unary)
4545 -- plus fields for unary operator
4546 -- plus fields for expression
4548 -- N_Op_Abs
4549 -- Sloc points to ABS
4550 -- plus fields for unary operator
4551 -- plus fields for expression
4553 -- N_Op_Not
4554 -- Sloc points to NOT
4555 -- plus fields for unary operator
4556 -- plus fields for expression
4558 -- See also shift operators in section B.2
4560 -- Note on fixed-point operations passed to Gigi: For adding operators,
4561 -- the semantics is to treat these simply as integer operations, with
4562 -- the small values being ignored (the bounds are already stored in
4563 -- units of small, so that constraint checking works as usual). For the
4564 -- case of multiply/divide/rem/mod operations, Gigi will never see them.
4566 -- Note on equality/inequality tests for records. In the expanded tree,
4567 -- record comparisons are always expanded to be a series of component
4568 -- comparisons, so the back end will never see an equality or inequality
4569 -- operation with operands of a record type.
4571 -- Note on overflow handling: When the overflow checking mode is set to
4572 -- MINIMIZED or ELIMINATED, nodes for signed arithmetic operations may
4573 -- be modified to use a larger type for the operands and result. In
4574 -- the case where the computed range exceeds that of Long_Long_Integer,
4575 -- and we are running in ELIMINATED mode, the operator node will be
4576 -- changed to be a call to the appropriate routine in System.Bignums.
4578 -- Note: In Modify_Tree_For_C mode, we do not generate an N_Op_Mod node
4579 -- for signed integer types (since there is no equivalent operator in
4580 -- C). Instead we rewrite such an operation in terms of REM (which is
4581 -- % in C) and other C-available operators.
4583 ------------------------------------
4584 -- 4.5.7 Conditional Expressions --
4585 ------------------------------------
4587 -- CONDITIONAL_EXPRESSION ::= IF_EXPRESSION | CASE_EXPRESSION
4589 --------------------------
4590 -- 4.5.7 If Expression --
4591 --------------------------
4593 -- IF_EXPRESSION ::=
4594 -- if CONDITION then DEPENDENT_EXPRESSION
4595 -- {elsif CONDITION then DEPENDENT_EXPRESSION}
4596 -- [else DEPENDENT_EXPRESSION]
4598 -- DEPENDENT_EXPRESSION ::= EXPRESSION
4600 -- Note: if we have (IF x1 THEN x2 ELSIF x3 THEN x4 ELSE x5) then it
4601 -- is represented as (IF x1 THEN x2 ELSE (IF x3 THEN x4 ELSE x5)) and
4602 -- the Is_Elsif flag is set on the inner if expression.
4604 -- N_If_Expression
4605 -- Sloc points to IF or ELSIF keyword
4606 -- Expressions
4607 -- Then_Actions
4608 -- Else_Actions
4609 -- Is_Elsif (set if comes from ELSIF)
4610 -- Do_Overflow_Check
4611 -- plus fields for expression
4613 -- Expressions here is a three-element list, whose first element is the
4614 -- condition, the second element is the dependent expression after THEN
4615 -- and the third element is the dependent expression after the ELSE
4616 -- (explicitly set to True if missing).
4618 -- Note: the Then_Actions and Else_Actions fields are always set to
4619 -- No_List in the tree passed to the back end. These are used only
4620 -- for temporary processing purposes in the expander. Even though they
4621 -- are semantic fields, their parent pointers are set because analysis
4622 -- of actions nodes in those lists may generate additional actions that
4623 -- need to know their insertion point (for example for the creation of
4624 -- transient scopes).
4626 -- Note: in the tree passed to the back end, if the result type is
4627 -- an unconstrained array, the if expression can only appears in the
4628 -- initializing expression of an object declaration (this avoids the
4629 -- back end having to create a variable length temporary on the fly).
4631 ----------------------------
4632 -- 4.5.7 Case Expression --
4633 ----------------------------
4635 -- CASE_EXPRESSION ::=
4636 -- case SELECTING_EXPRESSION is
4637 -- CASE_EXPRESSION_ALTERNATIVE
4638 -- {,CASE_EXPRESSION_ALTERNATIVE}
4640 -- Note that the Alternatives cannot include pragmas (this contrasts
4641 -- with the situation of case statements where pragmas are allowed).
4643 -- N_Case_Expression
4644 -- Sloc points to CASE
4645 -- Expression (the selecting expression)
4646 -- Alternatives (the case expression alternatives)
4647 -- Etype
4648 -- Do_Overflow_Check
4650 ----------------------------------------
4651 -- 4.5.7 Case Expression Alternative --
4652 ----------------------------------------
4654 -- CASE_EXPRESSION_ALTERNATIVE ::=
4655 -- when DISCRETE_CHOICE_LIST =>
4656 -- DEPENDENT_EXPRESSION
4658 -- N_Case_Expression_Alternative
4659 -- Sloc points to WHEN
4660 -- Actions
4661 -- Discrete_Choices
4662 -- Expression
4663 -- Has_SP_Choice
4665 -- Note: The Actions field temporarily holds any actions associated with
4666 -- evaluation of the Expression. During expansion of the case expression
4667 -- these actions are wrapped into an N_Expressions_With_Actions node
4668 -- replacing the original expression.
4670 -- Note: this node never appears in the tree passed to the back end,
4671 -- since the expander converts case expressions into case statements.
4673 ---------------------------------
4674 -- 4.5.8 Quantified Expression --
4675 ---------------------------------
4677 -- QUANTIFIED_EXPRESSION ::=
4678 -- for QUANTIFIER LOOP_PARAMETER_SPECIFICATION => PREDICATE
4679 -- | for QUANTIFIER ITERATOR_SPECIFICATION => PREDICATE
4681 -- QUANTIFIER ::= all | some
4683 -- At most one of (Iterator_Specification, Loop_Parameter_Specification)
4684 -- is present at a time, in which case the other one is empty.
4686 -- N_Quantified_Expression
4687 -- Sloc points to FOR
4688 -- Iterator_Specification
4689 -- Loop_Parameter_Specification
4690 -- Condition
4691 -- All_Present
4693 --------------------------
4694 -- 4.6 Type Conversion --
4695 --------------------------
4697 -- TYPE_CONVERSION ::=
4698 -- SUBTYPE_MARK (EXPRESSION) | SUBTYPE_MARK (NAME)
4700 -- In the (NAME) case, the name is stored as the expression
4702 -- Note: the parser never generates a type conversion node, since it
4703 -- looks like an indexed component which is generated by preference.
4704 -- The semantic pass must correct this misidentification.
4706 -- Gigi handles conversions that involve no change in the root type,
4707 -- and also all conversions from integer to floating-point types.
4708 -- Conversions from floating-point to integer are only handled in
4709 -- the case where Float_Truncate flag set. Other conversions from
4710 -- floating-point to integer (involving rounding) and all conversions
4711 -- involving fixed-point types are handled by the expander, unless the
4712 -- Conversion_OK flag is set.
4714 -- Sprint syntax if Float_Truncate set: X^(Y)
4715 -- Sprint syntax if Conversion_OK set X?(Y)
4716 -- Sprint syntax if both flags set X?^(Y)
4718 -- Note: If either the operand or result type is fixed-point, Gigi will
4719 -- only see a type conversion node with Conversion_OK set. The front end
4720 -- takes care of all handling of small's for fixed-point conversions.
4722 -- N_Type_Conversion
4723 -- Sloc points to first token of subtype mark
4724 -- Subtype_Mark
4725 -- Expression
4726 -- Do_Discriminant_Check
4727 -- Do_Length_Check
4728 -- Float_Truncate
4729 -- Conversion_OK
4730 -- Do_Overflow_Check
4731 -- Rounded_Result
4732 -- plus fields for expression
4734 -- Note: if a range check is required, then the Do_Range_Check flag
4735 -- is set in the Expression with the check being done against the
4736 -- target type range (after the base type conversion, if any).
4738 -------------------------------
4739 -- 4.7 Qualified Expression --
4740 -------------------------------
4742 -- QUALIFIED_EXPRESSION ::=
4743 -- SUBTYPE_MARK ' (EXPRESSION) | SUBTYPE_MARK ' AGGREGATE
4745 -- Note: the parentheses in the (EXPRESSION) case are deemed to enclose
4746 -- the expression, so the Expression field of this node always points
4747 -- to a parenthesized expression in this case (i.e. Paren_Count will
4748 -- always be non-zero for the referenced expression if it is not an
4749 -- aggregate).
4751 -- N_Qualified_Expression
4752 -- Sloc points to apostrophe
4753 -- Subtype_Mark
4754 -- Expression expression or aggregate
4755 -- Is_Qualified_Universal_Literal
4756 -- plus fields for expression
4758 --------------------
4759 -- 4.8 Allocator --
4760 --------------------
4762 -- ALLOCATOR ::=
4763 -- new [SUBPOOL_SPECIFICATION] SUBTYPE_INDICATION
4764 -- | new [SUBPOOL_SPECIFICATION] QUALIFIED_EXPRESSION
4766 -- SUBPOOL_SPECIFICATION ::= (subpool_handle_NAME)
4768 -- Sprint syntax (when storage pool present)
4769 -- new xxx (storage_pool = pool)
4770 -- or
4771 -- new (subpool) xxx (storage_pool = pool)
4773 -- N_Allocator
4774 -- Sloc points to NEW
4775 -- Expression subtype indication or qualified expression
4776 -- Subpool_Handle_Name (set to Empty if not present)
4777 -- Storage_Pool
4778 -- Procedure_To_Call
4779 -- Alloc_For_BIP_Return
4780 -- Null_Exclusion_Present
4781 -- No_Initialization
4782 -- Is_Static_Coextension
4783 -- Do_Storage_Check
4784 -- Is_Dynamic_Coextension
4785 -- plus fields for expression
4787 -- Note: like all nodes, the N_Allocator has the Comes_From_Source flag.
4788 -- This flag has a special function in conjunction with the restriction
4789 -- No_Implicit_Heap_Allocations, which will be triggered if this flag
4790 -- is not set. This means that if a source allocator is replaced with
4791 -- a constructed allocator, the Comes_From_Source flag should be copied
4792 -- to the newly created allocator.
4794 ---------------------------------
4795 -- 5.1 Sequence Of Statements --
4796 ---------------------------------
4798 -- SEQUENCE_OF_STATEMENTS ::= STATEMENT {STATEMENT}
4800 -- Note: Although the parser will not accept a declaration as a
4801 -- statement, the semantic analyzer may insert declarations (e.g.
4802 -- declarations of implicit types needed for execution of other
4803 -- statements) into a sequence of statements, so the code generator
4804 -- should be prepared to accept a declaration where a statement is
4805 -- expected. Note also that pragmas can appear as statements.
4807 --------------------
4808 -- 5.1 Statement --
4809 --------------------
4811 -- STATEMENT ::=
4812 -- {LABEL} SIMPLE_STATEMENT | {LABEL} COMPOUND_STATEMENT
4814 -- There is no explicit node in the tree for a statement. Instead, the
4815 -- individual statement appears directly. Labels are treated as a
4816 -- kind of statement, i.e. they are linked into a statement list at
4817 -- the point they appear, so the labeled statement appears following
4818 -- the label or labels in the statement list.
4820 ---------------------------
4821 -- 5.1 Simple Statement --
4822 ---------------------------
4824 -- SIMPLE_STATEMENT ::= NULL_STATEMENT
4825 -- | ASSIGNMENT_STATEMENT | EXIT_STATEMENT
4826 -- | GOTO_STATEMENT | PROCEDURE_CALL_STATEMENT
4827 -- | SIMPLE_RETURN_STATEMENT | ENTRY_CALL_STATEMENT
4828 -- | REQUEUE_STATEMENT | DELAY_STATEMENT
4829 -- | ABORT_STATEMENT | RAISE_STATEMENT
4830 -- | CODE_STATEMENT
4832 -----------------------------
4833 -- 5.1 Compound Statement --
4834 -----------------------------
4836 -- COMPOUND_STATEMENT ::=
4837 -- IF_STATEMENT | CASE_STATEMENT
4838 -- | LOOP_STATEMENT | BLOCK_STATEMENT
4839 -- | EXTENDED_RETURN_STATEMENT
4840 -- | ACCEPT_STATEMENT | SELECT_STATEMENT
4842 -------------------------
4843 -- 5.1 Null Statement --
4844 -------------------------
4846 -- NULL_STATEMENT ::= null;
4848 -- N_Null_Statement
4849 -- Sloc points to NULL
4850 -- Next_Rep_Item
4852 ----------------
4853 -- 5.1 Label --
4854 ----------------
4856 -- LABEL ::= <<label_STATEMENT_IDENTIFIER>>
4858 -- Note that the occurrence of a label is not a defining identifier,
4859 -- but rather a referencing occurrence. The defining occurrence is
4860 -- in the implicit label declaration which occurs in the innermost
4861 -- enclosing block.
4863 -- N_Label
4864 -- Sloc points to <<
4865 -- Identifier direct name of statement identifier
4866 -- Exception_Junk
4868 -- Note: Before Ada 2012, a label is always followed by a statement,
4869 -- and this is true in the tree even in Ada 2012 mode (the parser
4870 -- inserts a null statement marked with Comes_From_Source False).
4872 -------------------------------
4873 -- 5.1 Statement Identifier --
4874 -------------------------------
4876 -- STATEMENT_IDENTIFIER ::= DIRECT_NAME
4878 -- The IDENTIFIER of a STATEMENT_IDENTIFIER shall be an identifier
4879 -- (not an OPERATOR_SYMBOL)
4881 -------------------------------
4882 -- 5.2 Assignment Statement --
4883 -------------------------------
4885 -- ASSIGNMENT_STATEMENT ::=
4886 -- variable_NAME := EXPRESSION;
4888 -- N_Assignment_Statement
4889 -- Sloc points to :=
4890 -- Name
4891 -- Expression
4892 -- Is_Elaboration_Checks_OK_Node
4893 -- Is_SPARK_Mode_On_Node
4894 -- Do_Discriminant_Check
4895 -- Do_Length_Check
4896 -- Forwards_OK
4897 -- Backwards_OK
4898 -- No_Ctrl_Actions
4899 -- Has_Target_Names
4900 -- Is_Elaboration_Code
4901 -- Componentwise_Assignment
4902 -- Suppress_Assignment_Checks
4904 -- Note: if a range check is required, then the Do_Range_Check flag
4905 -- is set in the Expression (right hand side), with the check being
4906 -- done against the type of the Name (left hand side).
4908 -- Note: the back end places some restrictions on the form of the
4909 -- Expression field. If the object being assigned to is Atomic, then
4910 -- the Expression may not have the form of an aggregate (since this
4911 -- might cause the back end to generate separate assignments). In this
4912 -- case the front end must generate an extra temporary and initialize
4913 -- this temporary as required (the temporary itself is not atomic).
4915 ------------------
4916 -- Target_Name --
4917 ------------------
4919 -- N_Target_Name
4920 -- Sloc points to @
4921 -- Etype
4923 -- Note (Ada 2022): node is used during analysis as a placeholder for
4924 -- the value of the LHS of the enclosing assignment statement. Node is
4925 -- eventually rewritten together with enclosing assignment, and backends
4926 -- are not aware of it.
4928 -----------------------
4929 -- 5.3 If Statement --
4930 -----------------------
4932 -- IF_STATEMENT ::=
4933 -- if CONDITION then
4934 -- SEQUENCE_OF_STATEMENTS
4935 -- {elsif CONDITION then
4936 -- SEQUENCE_OF_STATEMENTS}
4937 -- [else
4938 -- SEQUENCE_OF_STATEMENTS]
4939 -- end if;
4941 -- Gigi restriction: This expander ensures that the type of the
4942 -- Condition fields is always Standard.Boolean, even if the type
4943 -- in the source is some non-standard boolean type.
4945 -- N_If_Statement
4946 -- Sloc points to IF
4947 -- Condition
4948 -- Then_Statements
4949 -- Elsif_Parts (set to No_List if none present)
4950 -- Else_Statements (set to No_List if no else part present)
4951 -- End_Span (set to Uint_0 if expander generated)
4952 -- From_Conditional_Expression
4954 -- N_Elsif_Part
4955 -- Sloc points to ELSIF
4956 -- Condition
4957 -- Then_Statements
4958 -- Condition_Actions
4960 --------------------
4961 -- 5.3 Condition --
4962 --------------------
4964 -- CONDITION ::= boolean_EXPRESSION
4966 -------------------------
4967 -- 5.4 Case Statement --
4968 -------------------------
4970 -- CASE_STATEMENT ::=
4971 -- case EXPRESSION is
4972 -- CASE_STATEMENT_ALTERNATIVE
4973 -- {CASE_STATEMENT_ALTERNATIVE}
4974 -- end case;
4976 -- Note: the Alternatives can contain pragmas. These only occur at
4977 -- the start of the list, since any pragmas occurring after the first
4978 -- alternative are absorbed into the corresponding statement sequence.
4980 -- N_Case_Statement
4981 -- Sloc points to CASE
4982 -- Expression
4983 -- Alternatives
4984 -- End_Span (set to Uint_0 if expander generated)
4985 -- From_Conditional_Expression
4987 -- Note: Before Ada 2012, a pragma in a statement sequence is always
4988 -- followed by a statement, and this is true in the tree even in Ada
4989 -- 2012 mode (the parser inserts a null statement marked with the flag
4990 -- Comes_From_Source False).
4992 -------------------------------------
4993 -- 5.4 Case Statement Alternative --
4994 -------------------------------------
4996 -- CASE_STATEMENT_ALTERNATIVE ::=
4997 -- when DISCRETE_CHOICE_LIST =>
4998 -- SEQUENCE_OF_STATEMENTS
5000 -- N_Case_Statement_Alternative
5001 -- Sloc points to WHEN
5002 -- Discrete_Choices
5003 -- Statements
5004 -- Has_SP_Choice
5005 -- Multidefined_Bindings
5007 -- Note: in the list of Discrete_Choices, the tree passed to the back
5008 -- end does not have choice entries corresponding to names of statically
5009 -- predicated subtypes. Such entries are always expanded out to the list
5010 -- of equivalent values or ranges. Multidefined_Bindings is True iff
5011 -- more than one choice is present and each choice contains
5012 -- at least one component association having a non-null Binding_Chars
5013 -- attribute; this can only occur if GNAT extensions are enabled
5014 -- and the type of the case selector is composite.
5016 -------------------------
5017 -- 5.5 Loop Statement --
5018 -------------------------
5020 -- LOOP_STATEMENT ::=
5021 -- [loop_STATEMENT_IDENTIFIER :]
5022 -- [ITERATION_SCHEME] loop
5023 -- SEQUENCE_OF_STATEMENTS
5024 -- end loop [loop_IDENTIFIER];
5026 -- Note: The occurrence of a loop label is not a defining identifier
5027 -- but rather a referencing occurrence. The defining occurrence is in
5028 -- the implicit label declaration which occurs in the innermost
5029 -- enclosing block.
5031 -- Note: there is always a loop statement identifier present in the
5032 -- tree, even if none was given in the source. In the case where no loop
5033 -- identifier is given in the source, the parser creates a name of the
5034 -- form _Loop_n, where n is a decimal integer (the two underlines ensure
5035 -- that the loop names created in this manner do not conflict with any
5036 -- user defined identifiers), and the flag Has_Created_Identifier is set
5037 -- to True. The only exception to the rule that all loop statement nodes
5038 -- have identifiers occurs for loops constructed by the expander, and
5039 -- the semantic analyzer will create and supply dummy loop identifiers
5040 -- in these cases.
5042 -- N_Loop_Statement
5043 -- Sloc points to LOOP
5044 -- Identifier loop identifier (set to Empty if no identifier)
5045 -- Iteration_Scheme (set to Empty if no iteration scheme)
5046 -- Statements
5047 -- End_Label
5048 -- Has_Created_Identifier
5049 -- Is_Null_Loop
5050 -- Suppress_Loop_Warnings
5052 -- Note: the parser fills in the Identifier field if there is an
5053 -- explicit loop identifier. Otherwise the parser leaves this field
5054 -- set to Empty, and then the semantic processing for a loop statement
5055 -- creates an identifier, setting the Has_Created_Identifier flag to
5056 -- True. So after semantic analysis, the Identifier is always set,
5057 -- referencing an identifier whose entity has an Ekind of E_Loop.
5059 ---------------------------
5060 -- 5.5 Iteration Scheme --
5061 ---------------------------
5063 -- ITERATION_SCHEME ::=
5064 -- while CONDITION
5065 -- | for LOOP_PARAMETER_SPECIFICATION
5066 -- | for ITERATOR_SPECIFICATION
5068 -- At most one of (Iterator_Specification, Loop_Parameter_Specification)
5069 -- is present at a time, in which case the other one is empty. Both are
5070 -- empty in the case of a WHILE loop.
5072 -- Gigi restriction: The expander ensures that the type of the Condition
5073 -- field is always Standard.Boolean, even if the type in the source is
5074 -- some non-standard boolean type.
5076 -- N_Iteration_Scheme
5077 -- Sloc points to WHILE or FOR
5078 -- Condition (set to Empty if FOR case)
5079 -- Condition_Actions
5080 -- Iterator_Specification (set to Empty if WHILE case)
5081 -- Loop_Parameter_Specification (set to Empty if WHILE case)
5083 ---------------------------------------
5084 -- 5.5 Loop Parameter Specification --
5085 ---------------------------------------
5087 -- LOOP_PARAMETER_SPECIFICATION ::=
5088 -- DEFINING_IDENTIFIER in [reverse] DISCRETE_SUBTYPE_DEFINITION
5089 -- [Iterator_Filter]
5091 -- Note: the optional Iterator_Filter is an Ada 2022 construct.
5093 -- N_Loop_Parameter_Specification
5094 -- Sloc points to first identifier
5095 -- Defining_Identifier
5096 -- Reverse_Present
5097 -- Iterator_Filter (set to Empty if not present)
5098 -- Discrete_Subtype_Definition
5100 -----------------------------------
5101 -- 5.5.1 Iterator Specification --
5102 -----------------------------------
5104 -- ITERATOR_SPECIFICATION ::=
5105 -- DEFINING_IDENTIFIER in [reverse] NAME
5106 -- | DEFINING_IDENTIFIER [: SUBTYPE_INDICATION] of [reverse] NAME
5108 -- N_Iterator_Specification
5109 -- Sloc points to defining identifier
5110 -- Defining_Identifier
5111 -- Name
5112 -- Reverse_Present
5113 -- Of_Present
5114 -- Iterator_Filter (set to Empty if not present)
5115 -- Subtype_Indication
5117 -- Note: The Of_Present flag distinguishes the two forms
5119 --------------------------
5120 -- 5.6 Block Statement --
5121 --------------------------
5123 -- BLOCK_STATEMENT ::=
5124 -- [block_STATEMENT_IDENTIFIER:]
5125 -- [declare
5126 -- DECLARATIVE_PART]
5127 -- begin
5128 -- HANDLED_SEQUENCE_OF_STATEMENTS
5129 -- end [block_IDENTIFIER];
5131 -- Note that the occurrence of a block identifier is not a defining
5132 -- identifier, but rather a referencing occurrence. The defining
5133 -- occurrence is an E_Block entity declared by the implicit label
5134 -- declaration which occurs in the innermost enclosing block statement
5135 -- or body; the block identifier denotes that E_Block.
5137 -- For block statements that come from source code, there is always a
5138 -- block statement identifier present in the tree, denoting an E_Block.
5139 -- In the case where no block identifier is given in the source,
5140 -- the parser creates a name of the form B_n, where n is a decimal
5141 -- integer, and the flag Has_Created_Identifier is set to True. Blocks
5142 -- constructed by the expander usually have no identifier, and no
5143 -- corresponding entity.
5145 -- Note: the block statement created for an extended return statement
5146 -- has an entity, and this entity is an E_Return_Statement, rather than
5147 -- the usual E_Block.
5149 -- Note: Exception_Junk is set for the wrapping blocks created during
5150 -- local raise optimization (Exp_Ch11.Expand_Local_Exception_Handlers).
5152 -- Note: from a control flow viewpoint, a block statement defines an
5153 -- extended basic block, i.e. the entry of the block dominates every
5154 -- statement in the sequence. When generating new statements with
5155 -- exception handlers in the expander at the end of a sequence that
5156 -- comes from source code, it can be necessary to wrap them all in a
5157 -- block statement in order to expose the implicit control flow to
5158 -- gigi and thus prevent it from issuing bogus control flow warnings.
5160 -- N_Block_Statement
5161 -- Sloc points to DECLARE or BEGIN
5162 -- Identifier block direct name (set to Empty if not present)
5163 -- Declarations (set to No_List if no DECLARE part)
5164 -- Handled_Statement_Sequence
5165 -- Activation_Chain_Entity
5166 -- Cleanup_Actions
5167 -- Has_Created_Identifier
5168 -- Is_Asynchronous_Call_Block
5169 -- Is_Task_Allocation_Block
5170 -- Exception_Junk
5171 -- Is_Abort_Block
5172 -- Is_Finalization_Wrapper
5173 -- Is_Initialization_Block
5174 -- Is_Task_Master
5176 -------------------------
5177 -- 5.7 Exit Statement --
5178 -------------------------
5180 -- EXIT_STATEMENT ::= exit [loop_NAME] [when CONDITION];
5182 -- Gigi restriction: The expander ensures that the type of the Condition
5183 -- field is always Standard.Boolean, even if the type in the source is
5184 -- some non-standard boolean type.
5186 -- N_Exit_Statement
5187 -- Sloc points to EXIT
5188 -- Name (set to Empty if no loop name present)
5189 -- Condition (set to Empty if no WHEN part present)
5190 -- Next_Exit_Statement : Next exit on chain
5192 -------------------------
5193 -- 5.9 Goto Statement --
5194 -------------------------
5196 -- GOTO_STATEMENT ::= goto label_NAME;
5198 -- N_Goto_Statement
5199 -- Sloc points to GOTO
5200 -- Name
5201 -- Exception_Junk
5203 ---------------------------------
5204 -- 6.1 Subprogram Declaration --
5205 ---------------------------------
5207 -- SUBPROGRAM_DECLARATION ::=
5208 -- SUBPROGRAM_SPECIFICATION
5209 -- [ASPECT_SPECIFICATIONS];
5211 -- N_Subprogram_Declaration
5212 -- Sloc points to FUNCTION or PROCEDURE
5213 -- Specification
5214 -- Body_To_Inline
5215 -- Corresponding_Body
5216 -- Parent_Spec
5217 -- Is_Entry_Barrier_Function
5218 -- Is_Task_Body_Procedure
5220 ------------------------------------------
5221 -- 6.1 Abstract Subprogram Declaration --
5222 ------------------------------------------
5224 -- ABSTRACT_SUBPROGRAM_DECLARATION ::=
5225 -- SUBPROGRAM_SPECIFICATION is abstract
5226 -- [ASPECT_SPECIFICATIONS];
5228 -- N_Abstract_Subprogram_Declaration
5229 -- Sloc points to ABSTRACT
5230 -- Specification
5232 -----------------------------------
5233 -- 6.1 Subprogram Specification --
5234 -----------------------------------
5236 -- SUBPROGRAM_SPECIFICATION ::=
5237 -- [[not] overriding]
5238 -- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE
5239 -- | [[not] overriding]
5240 -- function DEFINING_DESIGNATOR PARAMETER_AND_RESULT_PROFILE
5242 -- Note: there are no separate nodes for the profiles, instead the
5243 -- information appears directly in the following nodes.
5245 -- N_Function_Specification
5246 -- Sloc points to FUNCTION
5247 -- Defining_Unit_Name (the designator)
5248 -- Parameter_Specifications (set to No_List if no formal part)
5249 -- Null_Exclusion_Present
5250 -- Result_Definition for result subtype
5251 -- Generic_Parent
5252 -- Must_Override set if overriding indicator present
5253 -- Must_Not_Override set if not_overriding indicator present
5255 -- N_Procedure_Specification
5256 -- Sloc points to PROCEDURE
5257 -- Defining_Unit_Name
5258 -- Null_Statement NULL statement for body, if Null_Present
5259 -- Parameter_Specifications (set to No_List if no formal part)
5260 -- Generic_Parent
5261 -- Null_Present set for null procedure case (Ada 2005 feature)
5262 -- Must_Override set if overriding indicator present
5263 -- Must_Not_Override set if not_overriding indicator present
5265 -- Note: overriding indicator is an Ada 2005 feature
5267 ---------------------
5268 -- 6.1 Designator --
5269 ---------------------
5271 -- DESIGNATOR ::=
5272 -- [PARENT_UNIT_NAME .] IDENTIFIER | OPERATOR_SYMBOL
5274 -- Designators that are simply identifiers or operator symbols appear
5275 -- directly in the tree in this form. The following node is used only
5276 -- in the case where the designator has a parent unit name component.
5278 -- N_Designator
5279 -- Sloc points to period
5280 -- Name holds the parent unit name
5281 -- Identifier
5283 -- Note: Name is always non-Empty, since this node is only used for the
5284 -- case where a parent library unit package name is present.
5286 -- Note that the identifier can also be an operator symbol here
5288 ------------------------------
5289 -- 6.1 Defining Designator --
5290 ------------------------------
5292 -- DEFINING_DESIGNATOR ::=
5293 -- DEFINING_PROGRAM_UNIT_NAME | DEFINING_OPERATOR_SYMBOL
5295 -------------------------------------
5296 -- 6.1 Defining Program Unit Name --
5297 -------------------------------------
5299 -- DEFINING_PROGRAM_UNIT_NAME ::=
5300 -- [PARENT_UNIT_NAME .] DEFINING_IDENTIFIER
5302 -- The parent unit name is present only in the case of a child unit name
5303 -- (permissible only for Ada 95 for a library level unit, i.e. a unit
5304 -- at scope level one). If no such name is present, the defining program
5305 -- unit name is represented simply as the defining identifier. In the
5306 -- child unit case, the following node is used to represent the child
5307 -- unit name.
5309 -- N_Defining_Program_Unit_Name
5310 -- Sloc points to period
5311 -- Name holds the parent unit name
5312 -- Defining_Identifier
5314 -- Note: Name is always non-Empty, since this node is only used for the
5315 -- case where a parent unit name is present.
5317 --------------------------
5318 -- 6.1 Operator Symbol --
5319 --------------------------
5321 -- OPERATOR_SYMBOL ::= STRING_LITERAL
5323 -- Note: the fields of the N_Operator_Symbol node are laid out to match
5324 -- the corresponding fields of an N_Character_Literal node. This allows
5325 -- easy conversion of the operator symbol node into a character literal
5326 -- node in the case where a string constant of the form of an operator
5327 -- symbol is scanned out as such, but turns out semantically to be a
5328 -- string literal that is not an operator. For details see Sinfo.CN.
5329 -- Change_Operator_Symbol_To_String_Literal.
5331 -- N_Operator_Symbol
5332 -- Sloc points to literal
5333 -- Chars contains the Name_Id for the operator symbol
5334 -- Strval Id of string value. This is used if the operator
5335 -- symbol turns out to be a normal string after all.
5336 -- Entity
5337 -- Associated_Node Note this is shared with Entity
5338 -- Etype
5339 -- Has_Private_View (set in generic units)
5341 -- Note: the Strval field may be set to No_String for generated
5342 -- operator symbols that are known not to be string literals
5343 -- semantically.
5345 -----------------------------------
5346 -- 6.1 Defining Operator Symbol --
5347 -----------------------------------
5349 -- DEFINING_OPERATOR_SYMBOL ::= OPERATOR_SYMBOL
5351 -- A defining operator symbol is an entity, which has additional
5352 -- fields depending on the setting of the Ekind field. These
5353 -- additional fields are defined (and access subprograms declared)
5354 -- in package Einfo.
5356 -- Note: N_Defining_Operator_Symbol is an extended node whose fields
5357 -- are deliberately laid out to match the layout of fields in an
5358 -- ordinary N_Operator_Symbol node allowing for easy alteration of
5359 -- an operator symbol node into a defining operator symbol node.
5360 -- See Sinfo.CN.Change_Operator_Symbol_To_Defining_Operator_Symbol
5361 -- for further details.
5363 -- N_Defining_Operator_Symbol
5364 -- Sloc points to literal
5365 -- Chars contains the Name_Id for the operator symbol
5366 -- Next_Entity
5367 -- Scope
5368 -- Etype
5370 ----------------------------
5371 -- 6.1 Parameter Profile --
5372 ----------------------------
5374 -- PARAMETER_PROFILE ::= [FORMAL_PART]
5376 ---------------------------------------
5377 -- 6.1 Parameter and Result Profile --
5378 ---------------------------------------
5380 -- PARAMETER_AND_RESULT_PROFILE ::=
5381 -- [FORMAL_PART] return [NULL_EXCLUSION] SUBTYPE_MARK
5382 -- | [FORMAL_PART] return ACCESS_DEFINITION
5384 -- There is no explicit node in the tree for a parameter and result
5385 -- profile. Instead the information appears directly in the parent.
5387 ----------------------
5388 -- 6.1 Formal Part --
5389 ----------------------
5391 -- FORMAL_PART ::=
5392 -- (PARAMETER_SPECIFICATION {; PARAMETER_SPECIFICATION})
5394 ----------------------------------
5395 -- 6.1 Parameter Specification --
5396 ----------------------------------
5398 -- PARAMETER_SPECIFICATION ::=
5399 -- DEFINING_IDENTIFIER_LIST : [ALIASED] MODE [NULL_EXCLUSION]
5400 -- SUBTYPE_MARK [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATIONS]
5401 -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION
5402 -- [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATIONS]
5404 -- Although the syntax allows multiple identifiers in the list, the
5405 -- semantics is as though successive specifications were given with
5406 -- identical type definition and expression components. To simplify
5407 -- semantic processing, the parser represents a multiple declaration
5408 -- case as a sequence of single Specifications, using the More_Ids and
5409 -- Prev_Ids flags to preserve the original source form as described
5410 -- in the section on "Handling of Defining Identifier Lists".
5412 -- ALIASED can only be present in Ada 2012 mode
5414 -- N_Parameter_Specification
5415 -- Sloc points to first identifier
5416 -- Defining_Identifier
5417 -- Aliased_Present
5418 -- In_Present
5419 -- Out_Present
5420 -- Null_Exclusion_Present
5421 -- Parameter_Type subtype mark or access definition
5422 -- Expression (set to Empty if no default expression present)
5423 -- More_Ids (set to False if no more identifiers in list)
5424 -- Prev_Ids (set to False if no previous identifiers in list)
5425 -- Default_Expression
5427 ---------------
5428 -- 6.1 Mode --
5429 ---------------
5431 -- MODE ::= [in] | in out | out
5433 -- There is no explicit node in the tree for the Mode. Instead the
5434 -- In_Present and Out_Present flags are set in the parent node to
5435 -- record the presence of keywords specifying the mode.
5437 --------------------------
5438 -- 6.3 Subprogram Body --
5439 --------------------------
5441 -- SUBPROGRAM_BODY ::=
5442 -- SUBPROGRAM_SPECIFICATION [ASPECT_SPECIFICATIONS] is
5443 -- DECLARATIVE_PART
5444 -- begin
5445 -- HANDLED_SEQUENCE_OF_STATEMENTS
5446 -- end [DESIGNATOR];
5448 -- N_Subprogram_Body
5449 -- Sloc points to FUNCTION or PROCEDURE
5450 -- Specification
5451 -- Declarations
5452 -- Handled_Statement_Sequence
5453 -- Activation_Chain_Entity
5454 -- Corresponding_Spec
5455 -- Acts_As_Spec
5456 -- Bad_Is_Detected used only by parser
5457 -- Do_Storage_Check
5458 -- Has_Relative_Deadline_Pragma
5459 -- Is_Entry_Barrier_Function
5460 -- Is_Protected_Subprogram_Body
5461 -- Is_Task_Body_Procedure
5462 -- Is_Task_Master
5463 -- Was_Attribute_Reference
5464 -- Was_Expression_Function
5465 -- Was_Originally_Stub
5467 -----------------------------------
5468 -- 6.4 Procedure Call Statement --
5469 -----------------------------------
5471 -- PROCEDURE_CALL_STATEMENT ::=
5472 -- procedure_NAME; | procedure_PREFIX ACTUAL_PARAMETER_PART;
5474 -- Note: the reason that a procedure call has expression fields is that
5475 -- it semantically resembles an expression, e.g. overloading is allowed
5476 -- and a type is concocted for semantic processing purposes. Certain of
5477 -- these fields, such as Parens are not relevant, but it is easier to
5478 -- just supply all of them together.
5480 -- N_Procedure_Call_Statement
5481 -- Sloc points to first token of name or prefix
5482 -- Name stores name or prefix
5483 -- Parameter_Associations (set to No_List if no
5484 -- actual parameter part)
5485 -- First_Named_Actual
5486 -- Controlling_Argument (set to Empty if not dispatching)
5487 -- Is_Elaboration_Checks_OK_Node
5488 -- Is_SPARK_Mode_On_Node
5489 -- Is_Elaboration_Warnings_OK_Node
5490 -- No_Elaboration_Check
5491 -- Is_Known_Guaranteed_ABE
5492 -- plus fields for expression
5494 -- If any IN parameter requires a range check, then the corresponding
5495 -- argument expression has the Do_Range_Check flag set, and the range
5496 -- check is done against the formal type. Note that this argument
5497 -- expression may appear directly in the Parameter_Associations list,
5498 -- or may be a descendant of an N_Parameter_Association node that
5499 -- appears in this list.
5501 ------------------------
5502 -- 6.4 Function Call --
5503 ------------------------
5505 -- FUNCTION_CALL ::=
5506 -- function_NAME | function_PREFIX ACTUAL_PARAMETER_PART
5508 -- Note: the parser may generate an indexed component node or simply
5509 -- a name node instead of a function call node. The semantic pass must
5510 -- correct this misidentification.
5512 -- N_Function_Call
5513 -- Sloc points to first token of name or prefix
5514 -- Name stores name or prefix
5515 -- Parameter_Associations (set to No_List if no
5516 -- actual parameter part)
5517 -- First_Named_Actual
5518 -- Controlling_Argument (set to Empty if not dispatching)
5519 -- Is_Elaboration_Checks_OK_Node
5520 -- Is_SPARK_Mode_On_Node
5521 -- Is_Elaboration_Warnings_OK_Node
5522 -- No_Elaboration_Check
5523 -- Is_Expanded_Build_In_Place_Call
5524 -- No_Side_Effect_Removal
5525 -- Is_Known_Guaranteed_ABE
5526 -- plus fields for expression
5528 --------------------------------
5529 -- 6.4 Actual Parameter Part --
5530 --------------------------------
5532 -- ACTUAL_PARAMETER_PART ::=
5533 -- (PARAMETER_ASSOCIATION {,PARAMETER_ASSOCIATION})
5535 --------------------------------
5536 -- 6.4 Parameter Association --
5537 --------------------------------
5539 -- PARAMETER_ASSOCIATION ::=
5540 -- [formal_parameter_SELECTOR_NAME =>] EXPLICIT_ACTUAL_PARAMETER
5542 -- Note: the N_Parameter_Association node is built only if a formal
5543 -- parameter selector name is present, otherwise the parameter
5544 -- association appears in the tree simply as the node for the
5545 -- explicit actual parameter.
5547 -- N_Parameter_Association
5548 -- Sloc points to formal parameter
5549 -- Selector_Name (always non-Empty)
5550 -- Explicit_Actual_Parameter
5551 -- Next_Named_Actual
5552 -- Is_Accessibility_Actual
5554 ---------------------------
5555 -- 6.4 Actual Parameter --
5556 ---------------------------
5558 -- EXPLICIT_ACTUAL_PARAMETER ::=
5559 -- EXPRESSION | variable_NAME | REDUCTION_EXPRESSION_PARAMETER
5561 ---------------------------
5562 -- 6.5 Return Statement --
5563 ---------------------------
5565 -- SIMPLE_RETURN_STATEMENT ::= return [EXPRESSION];
5567 -- EXTENDED_RETURN_STATEMENT ::=
5568 -- return DEFINING_IDENTIFIER : [aliased] RETURN_SUBTYPE_INDICATION
5569 -- [:= EXPRESSION] [do
5570 -- HANDLED_SEQUENCE_OF_STATEMENTS
5571 -- end return];
5573 -- RETURN_SUBTYPE_INDICATION ::= SUBTYPE_INDICATION | ACCESS_DEFINITION
5575 -- The term "return statement" is defined in 6.5 to mean either a
5576 -- SIMPLE_RETURN_STATEMENT or an EXTENDED_RETURN_STATEMENT. We avoid
5577 -- the use of this term, since it used to mean someting else in earlier
5578 -- versions of Ada.
5580 -- N_Simple_Return_Statement
5581 -- Sloc points to RETURN
5582 -- Return_Statement_Entity
5583 -- Expression (set to Empty if no expression present)
5584 -- Storage_Pool
5585 -- Procedure_To_Call
5586 -- By_Ref
5587 -- Comes_From_Extended_Return_Statement
5589 -- Note: Return_Statement_Entity points to an E_Return_Statement
5591 -- If a range check is required, then Do_Range_Check is set on the
5592 -- Expression. The check is against the return subtype of the function.
5594 -- N_Extended_Return_Statement
5595 -- Sloc points to RETURN
5596 -- Return_Statement_Entity
5597 -- Return_Object_Declarations
5598 -- Handled_Statement_Sequence (set to Empty if not present)
5599 -- Storage_Pool
5600 -- Procedure_To_Call
5601 -- By_Ref
5603 -- Note: Return_Statement_Entity points to an E_Return_Statement.
5605 -- Note that Return_Object_Declarations is a list containing the
5606 -- N_Object_Declaration -- see comment on this field above.
5608 -- The declared object will have Is_Return_Object = True.
5610 -- There is no such syntactic category as return_object_declaration
5611 -- in the RM. Return_Object_Declarations represents this portion of
5612 -- the syntax for EXTENDED_RETURN_STATEMENT:
5613 -- DEFINING_IDENTIFIER : [aliased] RETURN_SUBTYPE_INDICATION
5614 -- [:= EXPRESSION]
5616 -- There are two entities associated with an extended_return_statement:
5617 -- the Return_Statement_Entity represents the statement itself,
5618 -- and the Defining_Identifier of the Object_Declaration in
5619 -- Return_Object_Declarations represents the object being
5620 -- returned. N_Simple_Return_Statement has only the former.
5622 ------------------------------
5623 -- 6.8 Expression Function --
5624 ------------------------------
5626 -- EXPRESSION_FUNCTION ::=
5627 -- FUNCTION SPECIFICATION IS (EXPRESSION)
5628 -- [ASPECT_SPECIFICATIONS];
5630 -- N_Expression_Function
5631 -- Sloc points to FUNCTION
5632 -- Specification
5633 -- Expression
5634 -- Corresponding_Spec
5636 ------------------------------
5637 -- 7.1 Package Declaration --
5638 ------------------------------
5640 -- PACKAGE_DECLARATION ::=
5641 -- PACKAGE_SPECIFICATION;
5643 -- Note: the activation chain entity for a package spec is used for
5644 -- all tasks declared in the package spec, or in the package body.
5646 -- N_Package_Declaration
5647 -- Sloc points to PACKAGE
5648 -- Specification
5649 -- Corresponding_Body
5650 -- Parent_Spec
5651 -- Activation_Chain_Entity
5653 --------------------------------
5654 -- 7.1 Package Specification --
5655 --------------------------------
5657 -- PACKAGE_SPECIFICATION ::=
5658 -- package DEFINING_PROGRAM_UNIT_NAME
5659 -- [ASPECT_SPECIFICATIONS]
5660 -- is
5661 -- {BASIC_DECLARATIVE_ITEM}
5662 -- [private
5663 -- {BASIC_DECLARATIVE_ITEM}]
5664 -- end [[PARENT_UNIT_NAME .] IDENTIFIER]
5666 -- N_Package_Specification
5667 -- Sloc points to PACKAGE
5668 -- Defining_Unit_Name
5669 -- Visible_Declarations
5670 -- Private_Declarations (set to No_List if no private
5671 -- part present)
5672 -- End_Label
5673 -- Generic_Parent
5674 -- Limited_View_Installed
5676 -----------------------
5677 -- 7.1 Package Body --
5678 -----------------------
5680 -- PACKAGE_BODY ::=
5681 -- package body DEFINING_PROGRAM_UNIT_NAME
5682 -- [ASPECT_SPECIFICATIONS]
5683 -- is
5684 -- DECLARATIVE_PART
5685 -- [begin
5686 -- HANDLED_SEQUENCE_OF_STATEMENTS]
5687 -- end [[PARENT_UNIT_NAME .] IDENTIFIER];
5689 -- N_Package_Body
5690 -- Sloc points to PACKAGE
5691 -- Defining_Unit_Name
5692 -- Declarations
5693 -- Handled_Statement_Sequence (set to Empty if no HSS present)
5694 -- Corresponding_Spec
5695 -- Was_Originally_Stub
5697 -- Note: if a source level package does not contain a handled sequence
5698 -- of statements, then the parser supplies a dummy one with a null
5699 -- sequence of statements. Comes_From_Source will be False in this
5700 -- constructed sequence. The reason we need this is for the End_Label
5701 -- field in the HSS.
5703 -----------------------------------
5704 -- 7.4 Private Type Declaration --
5705 -----------------------------------
5707 -- PRIVATE_TYPE_DECLARATION ::=
5708 -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART]
5709 -- is [[abstract] tagged] [limited] private
5710 -- [ASPECT_SPECIFICATIONS];
5712 -- Note: TAGGED is not permitted in Ada 83 mode
5714 -- N_Private_Type_Declaration
5715 -- Sloc points to TYPE
5716 -- Defining_Identifier
5717 -- Discriminant_Specifications (set to No_List if no
5718 -- discriminant part)
5719 -- Unknown_Discriminants_Present set if (<>) discriminant
5720 -- Abstract_Present
5721 -- Tagged_Present
5722 -- Limited_Present
5724 ----------------------------------------
5725 -- 7.4 Private Extension Declaration --
5726 ----------------------------------------
5728 -- PRIVATE_EXTENSION_DECLARATION ::=
5729 -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] is
5730 -- [abstract] [limited | synchronized]
5731 -- new ancestor_SUBTYPE_INDICATION [and INTERFACE_LIST]
5732 -- with private [ASPECT_SPECIFICATIONS];
5734 -- Note: LIMITED, and private extension declarations are not allowed
5735 -- in Ada 83 mode.
5737 -- N_Private_Extension_Declaration
5738 -- Sloc points to TYPE
5739 -- Defining_Identifier
5740 -- Uninitialized_Variable
5741 -- Discriminant_Specifications (set to No_List if no
5742 -- discriminant part)
5743 -- Unknown_Discriminants_Present set if (<>) discriminant
5744 -- Abstract_Present
5745 -- Limited_Present
5746 -- Synchronized_Present
5747 -- Subtype_Indication
5748 -- Interface_List (set to No_List if none)
5750 ---------------------
5751 -- 8.4 Use Clause --
5752 ---------------------
5754 -- USE_CLAUSE ::= USE_PACKAGE_CLAUSE | USE_TYPE_CLAUSE
5756 -----------------------------
5757 -- 8.4 Use Package Clause --
5758 -----------------------------
5760 -- USE_PACKAGE_CLAUSE ::= use package_NAME {, package_NAME};
5762 -- N_Use_Package_Clause
5763 -- Sloc points to USE
5764 -- Prev_Use_Clause
5765 -- Name
5766 -- Next_Use_Clause
5767 -- Associated_Node
5768 -- Hidden_By_Use_Clause
5769 -- Is_Effective_Use_Clause
5770 -- More_Ids (set to False if no more identifiers in list)
5771 -- Prev_Ids (set to False if no previous identifiers in list)
5773 --------------------------
5774 -- 8.4 Use Type Clause --
5775 --------------------------
5777 -- USE_TYPE_CLAUSE ::= use [ALL] type SUBTYPE_MARK {, SUBTYPE_MARK};
5779 -- Note: use type clause is not permitted in Ada 83 mode
5781 -- Note: the ALL keyword can appear only in Ada 2012 mode
5783 -- N_Use_Type_Clause
5784 -- Sloc points to USE
5785 -- Prev_Use_Clause
5786 -- Used_Operations
5787 -- Next_Use_Clause
5788 -- Subtype_Mark
5789 -- Hidden_By_Use_Clause
5790 -- Is_Effective_Use_Clause
5791 -- More_Ids (set to False if no more identifiers in list)
5792 -- Prev_Ids (set to False if no previous identifiers in list)
5793 -- All_Present
5795 -------------------------------
5796 -- 8.5 Renaming Declaration --
5797 -------------------------------
5799 -- RENAMING_DECLARATION ::=
5800 -- OBJECT_RENAMING_DECLARATION
5801 -- | EXCEPTION_RENAMING_DECLARATION
5802 -- | PACKAGE_RENAMING_DECLARATION
5803 -- | SUBPROGRAM_RENAMING_DECLARATION
5804 -- | GENERIC_RENAMING_DECLARATION
5806 --------------------------------------
5807 -- 8.5 Object Renaming Declaration --
5808 --------------------------------------
5810 -- OBJECT_RENAMING_DECLARATION ::=
5811 -- DEFINING_IDENTIFIER :
5812 -- [NULL_EXCLUSION] SUBTYPE_MARK renames object_NAME
5813 -- [ASPECT_SPECIFICATIONS];
5814 -- | DEFINING_IDENTIFIER :
5815 -- ACCESS_DEFINITION renames object_NAME
5816 -- [ASPECT_SPECIFICATIONS];
5818 -- Note: Access_Definition is an optional field that gives support to
5819 -- Ada 2005 (AI-230). The parser generates nodes that have either the
5820 -- Subtype_Indication field or else the Access_Definition field.
5822 -- N_Object_Renaming_Declaration
5823 -- Sloc points to first identifier
5824 -- Defining_Identifier
5825 -- Null_Exclusion_Present (set to False if not present)
5826 -- Subtype_Mark (set to Empty if not present)
5827 -- Access_Definition (set to Empty if not present)
5828 -- Name
5829 -- Corresponding_Generic_Association
5831 -----------------------------------------
5832 -- 8.5 Exception Renaming Declaration --
5833 -----------------------------------------
5835 -- EXCEPTION_RENAMING_DECLARATION ::=
5836 -- DEFINING_IDENTIFIER : exception renames exception_NAME
5837 -- [ASPECT_SPECIFICATIONS];
5839 -- N_Exception_Renaming_Declaration
5840 -- Sloc points to first identifier
5841 -- Defining_Identifier
5842 -- Name
5844 ---------------------------------------
5845 -- 8.5 Package Renaming Declaration --
5846 ---------------------------------------
5848 -- PACKAGE_RENAMING_DECLARATION ::=
5849 -- package DEFINING_PROGRAM_UNIT_NAME renames package_NAME
5850 -- [ASPECT_SPECIFICATIONS];
5852 -- N_Package_Renaming_Declaration
5853 -- Sloc points to PACKAGE
5854 -- Defining_Unit_Name
5855 -- Name
5856 -- Parent_Spec
5858 ------------------------------------------
5859 -- 8.5 Subprogram Renaming Declaration --
5860 ------------------------------------------
5862 -- SUBPROGRAM_RENAMING_DECLARATION ::=
5863 -- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME
5864 -- [ASPECT_SPECIFICATIONS];
5866 -- N_Subprogram_Renaming_Declaration
5867 -- Sloc points to RENAMES
5868 -- Specification
5869 -- Name
5870 -- Parent_Spec
5871 -- Corresponding_Spec
5872 -- Corresponding_Formal_Spec
5873 -- From_Default
5875 -----------------------------------------
5876 -- 8.5.5 Generic Renaming Declaration --
5877 -----------------------------------------
5879 -- GENERIC_RENAMING_DECLARATION ::=
5880 -- generic package DEFINING_PROGRAM_UNIT_NAME
5881 -- renames generic_package_NAME
5882 -- [ASPECT_SPECIFICATIONS];
5883 -- | generic procedure DEFINING_PROGRAM_UNIT_NAME
5884 -- renames generic_procedure_NAME
5885 -- [ASPECT_SPECIFICATIONS];
5886 -- | generic function DEFINING_PROGRAM_UNIT_NAME
5887 -- renames generic_function_NAME
5888 -- [ASPECT_SPECIFICATIONS];
5890 -- N_Generic_Package_Renaming_Declaration
5891 -- Sloc points to GENERIC
5892 -- Defining_Unit_Name
5893 -- Name
5894 -- Parent_Spec
5896 -- N_Generic_Procedure_Renaming_Declaration
5897 -- Sloc points to GENERIC
5898 -- Defining_Unit_Name
5899 -- Name
5900 -- Parent_Spec
5902 -- N_Generic_Function_Renaming_Declaration
5903 -- Sloc points to GENERIC
5904 -- Defining_Unit_Name
5905 -- Name
5906 -- Parent_Spec
5908 --------------------------------
5909 -- 9.1 Task Type Declaration --
5910 --------------------------------
5912 -- TASK_TYPE_DECLARATION ::=
5913 -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART]
5914 -- [ASPECT_SPECIFICATIONS]
5915 -- [is [new INTERFACE_LIST with] TASK_DEFINITION];
5917 -- N_Task_Type_Declaration
5918 -- Sloc points to TASK
5919 -- Defining_Identifier
5920 -- Discriminant_Specifications (set to No_List if no
5921 -- discriminant part)
5922 -- Interface_List (set to No_List if none)
5923 -- Task_Definition (set to Empty if not present)
5924 -- Corresponding_Body
5926 ----------------------------------
5927 -- 9.1 Single Task Declaration --
5928 ----------------------------------
5930 -- SINGLE_TASK_DECLARATION ::=
5931 -- task DEFINING_IDENTIFIER
5932 -- [ASPECT_SPECIFICATIONS]
5933 -- [is [new INTERFACE_LIST with] TASK_DEFINITION];
5935 -- N_Single_Task_Declaration
5936 -- Sloc points to TASK
5937 -- Defining_Identifier
5938 -- Interface_List (set to No_List if none)
5939 -- Task_Definition (set to Empty if not present)
5941 --------------------------
5942 -- 9.1 Task Definition --
5943 --------------------------
5945 -- TASK_DEFINITION ::=
5946 -- {TASK_ITEM}
5947 -- [private
5948 -- {TASK_ITEM}]
5949 -- end [task_IDENTIFIER]
5951 -- Note: as a result of semantic analysis, the list of task items can
5952 -- include implicit type declarations resulting from entry families.
5954 -- N_Task_Definition
5955 -- Sloc points to first token of task definition
5956 -- Visible_Declarations
5957 -- Private_Declarations (set to No_List if no private part)
5958 -- End_Label
5959 -- Has_Storage_Size_Pragma
5960 -- Has_Relative_Deadline_Pragma
5962 --------------------
5963 -- 9.1 Task Item --
5964 --------------------
5966 -- TASK_ITEM ::= ENTRY_DECLARATION | REPRESENTATION_CLAUSE
5968 --------------------
5969 -- 9.1 Task Body --
5970 --------------------
5972 -- TASK_BODY ::=
5973 -- task body task_DEFINING_IDENTIFIER
5974 -- [ASPECT_SPECIFICATIONS]
5975 -- is
5976 -- DECLARATIVE_PART
5977 -- begin
5978 -- HANDLED_SEQUENCE_OF_STATEMENTS
5979 -- end [task_IDENTIFIER];
5981 -- Gigi restriction: This node never appears
5983 -- N_Task_Body
5984 -- Sloc points to TASK
5985 -- Defining_Identifier
5986 -- Declarations
5987 -- Handled_Statement_Sequence
5988 -- Is_Task_Master
5989 -- Activation_Chain_Entity
5990 -- Corresponding_Spec
5991 -- Was_Originally_Stub
5993 -------------------------------------
5994 -- 9.4 Protected Type Declaration --
5995 -------------------------------------
5997 -- PROTECTED_TYPE_DECLARATION ::=
5998 -- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART]
5999 -- [ASPECT_SPECIFICATIONS]
6000 -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION;
6002 -- Note: protected type declarations are not permitted in Ada 83 mode
6004 -- N_Protected_Type_Declaration
6005 -- Sloc points to PROTECTED
6006 -- Defining_Identifier
6007 -- Discriminant_Specifications (set to No_List if no
6008 -- discriminant part)
6009 -- Interface_List (set to No_List if none)
6010 -- Protected_Definition
6011 -- Corresponding_Body
6013 ---------------------------------------
6014 -- 9.4 Single Protected Declaration --
6015 ---------------------------------------
6017 -- SINGLE_PROTECTED_DECLARATION ::=
6018 -- protected DEFINING_IDENTIFIER
6019 -- [ASPECT_SPECIFICATIONS]
6020 -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION;
6022 -- Note: single protected declarations are not allowed in Ada 83 mode
6024 -- N_Single_Protected_Declaration
6025 -- Sloc points to PROTECTED
6026 -- Defining_Identifier
6027 -- Interface_List (set to No_List if none)
6028 -- Protected_Definition
6030 -------------------------------
6031 -- 9.4 Protected Definition --
6032 -------------------------------
6034 -- PROTECTED_DEFINITION ::=
6035 -- {PROTECTED_OPERATION_DECLARATION}
6036 -- [private
6037 -- {PROTECTED_ELEMENT_DECLARATION}]
6038 -- end [protected_IDENTIFIER]
6040 -- N_Protected_Definition
6041 -- Sloc points to first token of protected definition
6042 -- Visible_Declarations
6043 -- Private_Declarations (set to No_List if no private part)
6044 -- End_Label
6046 ------------------------------------------
6047 -- 9.4 Protected Operation Declaration --
6048 ------------------------------------------
6050 -- PROTECTED_OPERATION_DECLARATION ::=
6051 -- SUBPROGRAM_DECLARATION
6052 -- | ENTRY_DECLARATION
6053 -- | REPRESENTATION_CLAUSE
6055 ----------------------------------------
6056 -- 9.4 Protected Element Declaration --
6057 ----------------------------------------
6059 -- PROTECTED_ELEMENT_DECLARATION ::=
6060 -- PROTECTED_OPERATION_DECLARATION | COMPONENT_DECLARATION
6062 -------------------------
6063 -- 9.4 Protected Body --
6064 -------------------------
6066 -- PROTECTED_BODY ::=
6067 -- protected body DEFINING_IDENTIFIER
6068 -- [ASPECT_SPECIFICATIONS];
6069 -- is
6070 -- {PROTECTED_OPERATION_ITEM}
6071 -- end [protected_IDENTIFIER];
6073 -- Note: protected bodies are not allowed in Ada 83 mode
6075 -- Gigi restriction: This node never appears
6077 -- N_Protected_Body
6078 -- Sloc points to PROTECTED
6079 -- Defining_Identifier
6080 -- Declarations protected operation items (and pragmas)
6081 -- End_Label
6082 -- Corresponding_Spec
6083 -- Was_Originally_Stub
6085 -----------------------------------
6086 -- 9.4 Protected Operation Item --
6087 -----------------------------------
6089 -- PROTECTED_OPERATION_ITEM ::=
6090 -- SUBPROGRAM_DECLARATION
6091 -- | SUBPROGRAM_BODY
6092 -- | ENTRY_BODY
6093 -- | REPRESENTATION_CLAUSE
6095 ------------------------------
6096 -- 9.5.2 Entry Declaration --
6097 ------------------------------
6099 -- ENTRY_DECLARATION ::=
6100 -- [[not] overriding]
6101 -- entry DEFINING_IDENTIFIER
6102 -- [(DISCRETE_SUBTYPE_DEFINITION)] PARAMETER_PROFILE
6103 -- [ASPECT_SPECIFICATIONS];
6105 -- N_Entry_Declaration
6106 -- Sloc points to ENTRY
6107 -- Defining_Identifier
6108 -- Discrete_Subtype_Definition (set to Empty if not present)
6109 -- Parameter_Specifications (set to No_List if no formal part)
6110 -- Corresponding_Body
6111 -- Must_Override set if overriding indicator present
6112 -- Must_Not_Override set if not_overriding indicator present
6114 -- Note: overriding indicator is an Ada 2005 feature
6116 -----------------------------
6117 -- 9.5.2 Accept statement --
6118 -----------------------------
6120 -- ACCEPT_STATEMENT ::=
6121 -- accept entry_DIRECT_NAME
6122 -- [(ENTRY_INDEX)] PARAMETER_PROFILE [do
6123 -- HANDLED_SEQUENCE_OF_STATEMENTS
6124 -- end [entry_IDENTIFIER]];
6126 -- Gigi restriction: This node never appears
6128 -- Note: there are no explicit declarations allowed in an accept
6129 -- statement. However, the implicit declarations for any statement
6130 -- identifiers (labels and block/loop identifiers) are declarations
6131 -- that belong logically to the accept statement, and that is why
6132 -- there is a Declarations field in this node.
6134 -- N_Accept_Statement
6135 -- Sloc points to ACCEPT
6136 -- Entry_Direct_Name
6137 -- Entry_Index (set to Empty if not present)
6138 -- Parameter_Specifications (set to No_List if no formal part)
6139 -- Handled_Statement_Sequence
6140 -- Declarations (set to No_List if no declarations)
6142 ------------------------
6143 -- 9.5.2 Entry Index --
6144 ------------------------
6146 -- ENTRY_INDEX ::= EXPRESSION
6148 -----------------------
6149 -- 9.5.2 Entry Body --
6150 -----------------------
6152 -- ENTRY_BODY ::=
6153 -- entry DEFINING_IDENTIFIER ENTRY_BODY_FORMAL_PART ENTRY_BARRIER is
6154 -- DECLARATIVE_PART
6155 -- begin
6156 -- HANDLED_SEQUENCE_OF_STATEMENTS
6157 -- end [entry_IDENTIFIER];
6159 -- ENTRY_BARRIER ::= when CONDITION
6161 -- Note: we store the CONDITION of the ENTRY_BARRIER in the node for
6162 -- the ENTRY_BODY_FORMAL_PART to avoid the N_Entry_Body node getting
6163 -- too full (it would otherwise have too many fields)
6165 -- Gigi restriction: This node never appears
6167 -- N_Entry_Body
6168 -- Sloc points to ENTRY
6169 -- Defining_Identifier
6170 -- Entry_Body_Formal_Part
6171 -- Declarations
6172 -- Handled_Statement_Sequence
6173 -- Activation_Chain_Entity
6175 -----------------------------------
6176 -- 9.5.2 Entry Body Formal Part --
6177 -----------------------------------
6179 -- ENTRY_BODY_FORMAL_PART ::=
6180 -- [(ENTRY_INDEX_SPECIFICATION)] PARAMETER_PROFILE
6182 -- Note that an entry body formal part node is present even if it is
6183 -- empty. This reflects the grammar, in which it is the components of
6184 -- the entry body formal part that are optional, not the entry body
6185 -- formal part itself. Also this means that the barrier condition
6186 -- always has somewhere to be stored.
6188 -- Gigi restriction: This node never appears
6190 -- N_Entry_Body_Formal_Part
6191 -- Sloc points to first token
6192 -- Entry_Index_Specification (set to Empty if not present)
6193 -- Parameter_Specifications (set to No_List if no formal part)
6194 -- Condition from entry barrier of entry body
6196 --------------------------
6197 -- 9.5.2 Entry Barrier --
6198 --------------------------
6200 -- ENTRY_BARRIER ::= when CONDITION
6202 --------------------------------------
6203 -- 9.5.2 Entry Index Specification --
6204 --------------------------------------
6206 -- ENTRY_INDEX_SPECIFICATION ::=
6207 -- for DEFINING_IDENTIFIER in DISCRETE_SUBTYPE_DEFINITION
6209 -- Gigi restriction: This node never appears
6211 -- N_Entry_Index_Specification
6212 -- Sloc points to FOR
6213 -- Defining_Identifier
6214 -- Discrete_Subtype_Definition
6216 ---------------------------------
6217 -- 9.5.3 Entry Call Statement --
6218 ---------------------------------
6220 -- ENTRY_CALL_STATEMENT ::= entry_NAME [ACTUAL_PARAMETER_PART];
6222 -- The parser may generate a procedure call for this construct. The
6223 -- semantic pass must correct this misidentification where needed.
6225 -- Gigi restriction: This node never appears
6227 -- N_Entry_Call_Statement
6228 -- Sloc points to first token of name
6229 -- Name
6230 -- Parameter_Associations (set to No_List if no
6231 -- actual parameter part)
6232 -- First_Named_Actual
6233 -- Is_Elaboration_Checks_OK_Node
6234 -- Is_SPARK_Mode_On_Node
6235 -- Is_Elaboration_Warnings_OK_Node
6237 ------------------------------
6238 -- 9.5.4 Requeue Statement --
6239 ------------------------------
6241 -- REQUEUE_STATEMENT ::= requeue entry_NAME [with abort];
6243 -- Note: requeue statements are not permitted in Ada 83 mode
6245 -- Gigi restriction: This node never appears
6247 -- N_Requeue_Statement
6248 -- Sloc points to REQUEUE
6249 -- Name
6250 -- Abort_Present
6251 -- Is_Elaboration_Checks_OK_Node
6252 -- Is_SPARK_Mode_On_Node
6253 -- Is_Elaboration_Warnings_OK_Node
6255 --------------------------
6256 -- 9.6 Delay Statement --
6257 --------------------------
6259 -- DELAY_STATEMENT ::=
6260 -- DELAY_UNTIL_STATEMENT
6261 -- | DELAY_RELATIVE_STATEMENT
6263 --------------------------------
6264 -- 9.6 Delay Until Statement --
6265 --------------------------------
6267 -- DELAY_UNTIL_STATEMENT ::= delay until delay_EXPRESSION;
6269 -- Note: delay until statements are not permitted in Ada 83 mode
6271 -- Gigi restriction: This node never appears
6273 -- N_Delay_Until_Statement
6274 -- Sloc points to DELAY
6275 -- Expression
6277 -----------------------------------
6278 -- 9.6 Delay Relative Statement --
6279 -----------------------------------
6281 -- DELAY_RELATIVE_STATEMENT ::= delay delay_EXPRESSION;
6283 -- Gigi restriction: This node never appears
6285 -- N_Delay_Relative_Statement
6286 -- Sloc points to DELAY
6287 -- Expression
6289 ---------------------------
6290 -- 9.7 Select Statement --
6291 ---------------------------
6293 -- SELECT_STATEMENT ::=
6294 -- SELECTIVE_ACCEPT
6295 -- | TIMED_ENTRY_CALL
6296 -- | CONDITIONAL_ENTRY_CALL
6297 -- | ASYNCHRONOUS_SELECT
6299 -----------------------------
6300 -- 9.7.1 Selective Accept --
6301 -----------------------------
6303 -- SELECTIVE_ACCEPT ::=
6304 -- select
6305 -- [GUARD]
6306 -- SELECT_ALTERNATIVE
6307 -- {or
6308 -- [GUARD]
6309 -- SELECT_ALTERNATIVE}
6310 -- [else
6311 -- SEQUENCE_OF_STATEMENTS]
6312 -- end select;
6314 -- Gigi restriction: This node never appears
6316 -- Note: the guard expression, if present, appears in the node for
6317 -- the select alternative.
6319 -- N_Selective_Accept
6320 -- Sloc points to SELECT
6321 -- Select_Alternatives
6322 -- Else_Statements (set to No_List if no else part)
6324 ------------------
6325 -- 9.7.1 Guard --
6326 ------------------
6328 -- GUARD ::= when CONDITION =>
6330 -- As noted above, the CONDITION that is part of a GUARD is included
6331 -- in the node for the select alternative for convenience.
6333 -------------------------------
6334 -- 9.7.1 Select Alternative --
6335 -------------------------------
6337 -- SELECT_ALTERNATIVE ::=
6338 -- ACCEPT_ALTERNATIVE
6339 -- | DELAY_ALTERNATIVE
6340 -- | TERMINATE_ALTERNATIVE
6342 -------------------------------
6343 -- 9.7.1 Accept Alternative --
6344 -------------------------------
6346 -- ACCEPT_ALTERNATIVE ::=
6347 -- ACCEPT_STATEMENT [SEQUENCE_OF_STATEMENTS]
6349 -- Gigi restriction: This node never appears
6351 -- N_Accept_Alternative
6352 -- Sloc points to ACCEPT
6353 -- Accept_Statement
6354 -- Condition from the guard (set to Empty if no guard present)
6355 -- Statements (set to Empty_List if no statements)
6356 -- Pragmas_Before pragmas before alt (set to No_List if none)
6357 -- Accept_Handler_Records
6359 ------------------------------
6360 -- 9.7.1 Delay Alternative --
6361 ------------------------------
6363 -- DELAY_ALTERNATIVE ::=
6364 -- DELAY_STATEMENT [SEQUENCE_OF_STATEMENTS]
6366 -- Gigi restriction: This node never appears
6368 -- N_Delay_Alternative
6369 -- Sloc points to DELAY
6370 -- Delay_Statement
6371 -- Condition from the guard (set to Empty if no guard present)
6372 -- Statements (set to Empty_List if no statements)
6373 -- Pragmas_Before pragmas before alt (set to No_List if none)
6375 ----------------------------------
6376 -- 9.7.1 Terminate Alternative --
6377 ----------------------------------
6379 -- TERMINATE_ALTERNATIVE ::= terminate;
6381 -- Gigi restriction: This node never appears
6383 -- N_Terminate_Alternative
6384 -- Sloc points to TERMINATE
6385 -- Condition from the guard (set to Empty if no guard present)
6386 -- Pragmas_Before pragmas before alt (set to No_List if none)
6387 -- Pragmas_After pragmas after alt (set to No_List if none)
6389 -----------------------------
6390 -- 9.7.2 Timed Entry Call --
6391 -----------------------------
6393 -- TIMED_ENTRY_CALL ::=
6394 -- select
6395 -- ENTRY_CALL_ALTERNATIVE
6396 -- or
6397 -- DELAY_ALTERNATIVE
6398 -- end select;
6400 -- Gigi restriction: This node never appears
6402 -- N_Timed_Entry_Call
6403 -- Sloc points to SELECT
6404 -- Entry_Call_Alternative
6405 -- Delay_Alternative
6407 -----------------------------------
6408 -- 9.7.2 Entry Call Alternative --
6409 -----------------------------------
6411 -- ENTRY_CALL_ALTERNATIVE ::=
6412 -- PROCEDURE_OR_ENTRY_CALL [SEQUENCE_OF_STATEMENTS]
6414 -- PROCEDURE_OR_ENTRY_CALL ::=
6415 -- PROCEDURE_CALL_STATEMENT | ENTRY_CALL_STATEMENT
6417 -- Gigi restriction: This node never appears
6419 -- N_Entry_Call_Alternative
6420 -- Sloc points to first token of entry call statement
6421 -- Entry_Call_Statement
6422 -- Statements (set to Empty_List if no statements)
6423 -- Pragmas_Before pragmas before alt (set to No_List if none)
6425 -----------------------------------
6426 -- 9.7.3 Conditional Entry Call --
6427 -----------------------------------
6429 -- CONDITIONAL_ENTRY_CALL ::=
6430 -- select
6431 -- ENTRY_CALL_ALTERNATIVE
6432 -- else
6433 -- SEQUENCE_OF_STATEMENTS
6434 -- end select;
6436 -- Gigi restriction: This node never appears
6438 -- N_Conditional_Entry_Call
6439 -- Sloc points to SELECT
6440 -- Entry_Call_Alternative
6441 -- Else_Statements
6443 --------------------------------
6444 -- 9.7.4 Asynchronous Select --
6445 --------------------------------
6447 -- ASYNCHRONOUS_SELECT ::=
6448 -- select
6449 -- TRIGGERING_ALTERNATIVE
6450 -- then abort
6451 -- ABORTABLE_PART
6452 -- end select;
6454 -- Note: asynchronous select is not permitted in Ada 83 mode
6456 -- Gigi restriction: This node never appears
6458 -- N_Asynchronous_Select
6459 -- Sloc points to SELECT
6460 -- Triggering_Alternative
6461 -- Abortable_Part
6463 -----------------------------------
6464 -- 9.7.4 Triggering Alternative --
6465 -----------------------------------
6467 -- TRIGGERING_ALTERNATIVE ::=
6468 -- TRIGGERING_STATEMENT [SEQUENCE_OF_STATEMENTS]
6470 -- Gigi restriction: This node never appears
6472 -- N_Triggering_Alternative
6473 -- Sloc points to first token of triggering statement
6474 -- Triggering_Statement
6475 -- Statements (set to Empty_List if no statements)
6476 -- Pragmas_Before pragmas before alt (set to No_List if none)
6478 ---------------------------------
6479 -- 9.7.4 Triggering Statement --
6480 ---------------------------------
6482 -- TRIGGERING_STATEMENT ::= PROCEDURE_OR_ENTRY_CALL | DELAY_STATEMENT
6484 ---------------------------
6485 -- 9.7.4 Abortable Part --
6486 ---------------------------
6488 -- ABORTABLE_PART ::= SEQUENCE_OF_STATEMENTS
6490 -- Gigi restriction: This node never appears
6492 -- N_Abortable_Part
6493 -- Sloc points to ABORT
6494 -- Statements
6496 --------------------------
6497 -- 9.8 Abort Statement --
6498 --------------------------
6500 -- ABORT_STATEMENT ::= abort task_NAME {, task_NAME};
6502 -- Gigi restriction: This node never appears
6504 -- N_Abort_Statement
6505 -- Sloc points to ABORT
6506 -- Names
6508 -------------------------
6509 -- 10.1.1 Compilation --
6510 -------------------------
6512 -- COMPILATION ::= {COMPILATION_UNIT}
6514 -- There is no explicit node in the tree for a compilation, since in
6515 -- general the compiler is processing only a single compilation unit
6516 -- at a time. It is possible to parse multiple units in syntax check
6517 -- only mode, but the trees are discarded in that case.
6519 ------------------------------
6520 -- 10.1.1 Compilation Unit --
6521 ------------------------------
6523 -- COMPILATION_UNIT ::=
6524 -- CONTEXT_CLAUSE LIBRARY_ITEM
6525 -- | CONTEXT_CLAUSE SUBUNIT
6527 -- The N_Compilation_Unit node itself represents the above syntax.
6528 -- However, there are two additional items not reflected in the above
6529 -- syntax. First we have the global declarations that are added by the
6530 -- code generator. These are outer level declarations (so they cannot
6531 -- be represented as being inside the units). An example is the wrapper
6532 -- subprograms that are created to do ABE checking. As always a list of
6533 -- declarations can contain actions as well (i.e. statements), and such
6534 -- statements are executed as part of the elaboration of the unit. Note
6535 -- that all such declarations are elaborated before the library unit.
6537 -- Similarly, certain actions need to be elaborated at the completion
6538 -- of elaboration of the library unit (notably the statement that sets
6539 -- the Boolean flag indicating that elaboration is complete).
6541 -- The third item not reflected in the syntax is pragmas that appear
6542 -- after the compilation unit. As always pragmas are a problem since
6543 -- they are not part of the formal syntax, but can be stuck into the
6544 -- source following a set of ad hoc rules, and we have to find an ad
6545 -- hoc way of sticking them into the tree. For pragmas that appear
6546 -- before the library unit, we just consider them to be part of the
6547 -- context clause, and pragmas can appear in the Context_Items list
6548 -- of the compilation unit. However, pragmas can also appear after
6549 -- the library item.
6551 -- To deal with all these problems, we create an auxiliary node for
6552 -- a compilation unit, referenced from the N_Compilation_Unit node,
6553 -- that contains these items.
6555 -- N_Compilation_Unit
6556 -- Sloc points to first token of defining unit name
6557 -- Context_Items context items and pragmas preceding unit
6558 -- Private_Present set if library unit has private keyword
6559 -- Unit library item or subunit
6560 -- Aux_Decls_Node points to the N_Compilation_Unit_Aux node
6561 -- First_Inlined_Subprogram
6562 -- Library_Unit corresponding/parent spec/body
6563 -- Save_Invocation_Graph_Of_Body
6564 -- Acts_As_Spec flag for subprogram body with no spec
6565 -- Body_Required set for spec if body is required
6566 -- Has_Pragma_Suppress_All
6567 -- Context_Pending
6568 -- Has_No_Elaboration_Code
6570 -- N_Compilation_Unit_Aux
6571 -- Sloc is a copy of the Sloc from the N_Compilation_Unit node
6572 -- Declarations (set to No_List if no global declarations)
6573 -- Actions (set to No_List if no actions)
6574 -- Pragmas_After pragmas after unit (set to No_List if none)
6575 -- Config_Pragmas config pragmas (set to Empty_List if none)
6576 -- Default_Storage_Pool
6578 --------------------------
6579 -- 10.1.1 Library Item --
6580 --------------------------
6582 -- LIBRARY_ITEM ::=
6583 -- [private] LIBRARY_UNIT_DECLARATION
6584 -- | LIBRARY_UNIT_BODY
6585 -- | [private] LIBRARY_UNIT_RENAMING_DECLARATION
6587 -- Note: PRIVATE is not allowed in Ada 83 mode
6589 -- There is no explicit node in the tree for library item, instead
6590 -- the declaration or body, and the flag for private if present,
6591 -- appear in the N_Compilation_Unit node.
6593 --------------------------------------
6594 -- 10.1.1 Library Unit Declaration --
6595 --------------------------------------
6597 -- LIBRARY_UNIT_DECLARATION ::=
6598 -- SUBPROGRAM_DECLARATION | PACKAGE_DECLARATION
6599 -- | GENERIC_DECLARATION | GENERIC_INSTANTIATION
6601 -----------------------------------------------
6602 -- 10.1.1 Library Unit Renaming Declaration --
6603 -----------------------------------------------
6605 -- LIBRARY_UNIT_RENAMING_DECLARATION ::=
6606 -- PACKAGE_RENAMING_DECLARATION
6607 -- | GENERIC_RENAMING_DECLARATION
6608 -- | SUBPROGRAM_RENAMING_DECLARATION
6610 -------------------------------
6611 -- 10.1.1 Library unit body --
6612 -------------------------------
6614 -- LIBRARY_UNIT_BODY ::= SUBPROGRAM_BODY | PACKAGE_BODY
6616 ------------------------------
6617 -- 10.1.1 Parent Unit Name --
6618 ------------------------------
6620 -- PARENT_UNIT_NAME ::= NAME
6622 ----------------------------
6623 -- 10.1.2 Context clause --
6624 ----------------------------
6626 -- CONTEXT_CLAUSE ::= {CONTEXT_ITEM}
6628 -- The context clause can include pragmas, and any pragmas that appear
6629 -- before the context clause proper (i.e. all configuration pragmas,
6630 -- also appear at the front of this list).
6632 --------------------------
6633 -- 10.1.2 Context_Item --
6634 --------------------------
6636 -- CONTEXT_ITEM ::= WITH_CLAUSE | USE_CLAUSE | WITH_TYPE_CLAUSE
6638 -------------------------
6639 -- 10.1.2 With clause --
6640 -------------------------
6642 -- WITH_CLAUSE ::=
6643 -- with library_unit_NAME {,library_unit_NAME};
6645 -- A separate With clause is built for each name, so that we have
6646 -- a Corresponding_Spec field for each with'ed spec. The flags
6647 -- First_Name and Last_Name are used to reconstruct the exact
6648 -- source form. When a list of names appears in one with clause,
6649 -- the first name in the list has First_Name set, and the last
6650 -- has Last_Name set. If the with clause has only one name, then
6651 -- both of the flags First_Name and Last_Name are set in this name.
6653 -- Note: in the case of implicit with's that are installed by the
6654 -- Rtsfind routine, Implicit_With is set, and the Sloc is typically
6655 -- set to Standard_Location, but it is incorrect to test the Sloc
6656 -- to find out if a with clause is implicit, test the flag instead.
6658 -- N_With_Clause
6659 -- Sloc points to first token of library unit name
6660 -- Name
6661 -- Private_Present set if with_clause has private keyword
6662 -- Limited_Present set if LIMITED is present
6663 -- Next_Implicit_With
6664 -- Library_Unit
6665 -- Corresponding_Spec
6666 -- First_Name (set to True if first name or only one name)
6667 -- Last_Name (set to True if last name or only one name)
6668 -- Context_Installed
6669 -- Elaborate_Present
6670 -- Elaborate_All_Present
6671 -- Elaborate_All_Desirable
6672 -- Elaborate_Desirable
6673 -- Implicit_With
6674 -- Limited_View_Installed
6675 -- Parent_With
6676 -- Unreferenced_In_Spec
6677 -- No_Entities_Ref_In_Spec
6679 -- Note: Limited_Present and Limited_View_Installed are used to support
6680 -- the implementation of Ada 2005 (AI-50217).
6682 -- Similarly, Private_Present is used to support the implementation of
6683 -- Ada 2005 (AI-50262).
6685 -- Note: if the WITH clause refers to a standard library unit, then a
6686 -- limited with clause is changed into a normal with clause, because we
6687 -- are not prepared to deal with limited with in the context of Rtsfind.
6688 -- So in this case, the Limited_Present flag will be False in the final
6689 -- tree.
6691 ----------------------
6692 -- With_Type clause --
6693 ----------------------
6695 -- This is a GNAT extension, used to implement mutually recursive
6696 -- types declared in different packages.
6698 -- Note: this is now obsolete. The functionality of this construct
6699 -- is now implemented by the Ada 2005 limited_with_clause.
6701 ---------------------
6702 -- 10.2 Body stub --
6703 ---------------------
6705 -- BODY_STUB ::=
6706 -- SUBPROGRAM_BODY_STUB
6707 -- | PACKAGE_BODY_STUB
6708 -- | TASK_BODY_STUB
6709 -- | PROTECTED_BODY_STUB
6711 ----------------------------------
6712 -- 10.1.3 Subprogram Body Stub --
6713 ----------------------------------
6715 -- SUBPROGRAM_BODY_STUB ::=
6716 -- SUBPROGRAM_SPECIFICATION is separate
6717 -- [ASPECT_SPECIFICATION];
6719 -- N_Subprogram_Body_Stub
6720 -- Sloc points to FUNCTION or PROCEDURE
6721 -- Specification
6722 -- Corresponding_Spec_Of_Stub
6723 -- Library_Unit points to the subunit
6724 -- Corresponding_Body
6726 -------------------------------
6727 -- 10.1.3 Package Body Stub --
6728 -------------------------------
6730 -- PACKAGE_BODY_STUB ::=
6731 -- package body DEFINING_IDENTIFIER is separate
6732 -- [ASPECT_SPECIFICATION];
6734 -- N_Package_Body_Stub
6735 -- Sloc points to PACKAGE
6736 -- Defining_Identifier
6737 -- Corresponding_Spec_Of_Stub
6738 -- Library_Unit points to the subunit
6739 -- Corresponding_Body
6741 ----------------------------
6742 -- 10.1.3 Task Body Stub --
6743 ----------------------------
6745 -- TASK_BODY_STUB ::=
6746 -- task body DEFINING_IDENTIFIER is separate
6747 -- [ASPECT_SPECIFICATION];
6749 -- N_Task_Body_Stub
6750 -- Sloc points to TASK
6751 -- Defining_Identifier
6752 -- Corresponding_Spec_Of_Stub
6753 -- Library_Unit points to the subunit
6754 -- Corresponding_Body
6756 ---------------------------------
6757 -- 10.1.3 Protected Body Stub --
6758 ---------------------------------
6760 -- PROTECTED_BODY_STUB ::=
6761 -- protected body DEFINING_IDENTIFIER is separate
6762 -- [ASPECT_SPECIFICATION];
6764 -- Note: protected body stubs are not allowed in Ada 83 mode
6766 -- N_Protected_Body_Stub
6767 -- Sloc points to PROTECTED
6768 -- Defining_Identifier
6769 -- Corresponding_Spec_Of_Stub
6770 -- Library_Unit points to the subunit
6771 -- Corresponding_Body
6773 ---------------------
6774 -- 10.1.3 Subunit --
6775 ---------------------
6777 -- SUBUNIT ::= separate (PARENT_UNIT_NAME) PROPER_BODY
6779 -- N_Subunit
6780 -- Sloc points to SEPARATE
6781 -- Name is the name of the parent unit
6782 -- Proper_Body is the subunit body
6783 -- Corresponding_Stub is the stub declaration for the unit.
6785 ---------------------------------
6786 -- 11.1 Exception Declaration --
6787 ---------------------------------
6789 -- EXCEPTION_DECLARATION ::= DEFINING_IDENTIFIER_LIST : exception
6790 -- [ASPECT_SPECIFICATIONS];
6792 -- For consistency with object declarations etc., the parser converts
6793 -- the case of multiple identifiers being declared to a series of
6794 -- declarations in which the expression is copied, using the More_Ids
6795 -- and Prev_Ids flags to remember the source form as described in the
6796 -- section on "Handling of Defining Identifier Lists".
6798 -- N_Exception_Declaration
6799 -- Sloc points to EXCEPTION
6800 -- Defining_Identifier
6801 -- Expression
6802 -- Renaming_Exception
6803 -- More_Ids (set to False if no more identifiers in list)
6804 -- Prev_Ids (set to False if no previous identifiers in list)
6806 ------------------------------------------
6807 -- 11.2 Handled Sequence Of Statements --
6808 ------------------------------------------
6810 -- HANDLED_SEQUENCE_OF_STATEMENTS ::=
6811 -- SEQUENCE_OF_STATEMENTS
6812 -- [exception
6813 -- EXCEPTION_HANDLER
6814 -- {EXCEPTION_HANDLER}]
6815 -- [at end
6816 -- cleanup_procedure_call (param, param, param, ...);]
6818 -- The AT END phrase is a GNAT extension to provide for cleanups. It is
6819 -- used only internally currently, but is considered to be syntactic.
6820 -- At the moment, the only cleanup action allowed is a single call to
6821 -- a parameterless procedure, and the Identifier field of the node is
6822 -- the procedure to be called. The cleanup action occurs whenever the
6823 -- sequence of statements is left for any reason. The possible reasons
6824 -- are:
6825 -- 1. reaching the end of the sequence
6826 -- 2. exit, return, or goto
6827 -- 3. exception or abort
6828 -- For some back ends, such as gcc with ZCX, "at end" is implemented
6829 -- entirely in the back end. In this case, a handled sequence of
6830 -- statements with an "at end" cannot also have exception handlers.
6831 -- For other back ends, such as gcc with front-end SJLJ, the
6832 -- implementation is split between the front end and back end; the front
6833 -- end implements 3, and the back end implements 1 and 2. In this case,
6834 -- if there is an "at end", the front end inserts the appropriate
6835 -- exception handler, and this handler takes precedence over "at end"
6836 -- in case of exception.
6838 -- The inserted exception handler is of the form:
6840 -- when all others =>
6841 -- cleanup;
6842 -- raise;
6844 -- where cleanup is the procedure to be called. The reason we do this is
6845 -- so that the front end can handle the necessary entries in the
6846 -- exception tables, and other exception handler actions required as
6847 -- part of the normal handling for exception handlers.
6849 -- The AT END cleanup handler protects only the sequence of statements
6850 -- (not the associated declarations of the parent), just like exception
6851 -- handlers. The big difference is that the cleanup procedure is called
6852 -- on either a normal or an abnormal exit from the statement sequence.
6854 -- Note: the list of Exception_Handlers can contain pragmas as well
6855 -- as actual handlers. In practice these pragmas can only occur at
6856 -- the start of the list, since any pragmas occurring later on will
6857 -- be included in the statement list of the corresponding handler.
6859 -- Note: although in the Ada syntax, the sequence of statements in
6860 -- a handled sequence of statements can only contain statements, we
6861 -- allow free mixing of declarations and statements in the resulting
6862 -- expanded tree. This is for example used to deal with the case of
6863 -- a cleanup procedure that must handle declarations as well as the
6864 -- statements of a block.
6866 -- Note: the cleanup_procedure_call does not go through the common
6867 -- processing for calls, which in particular means that it will not be
6868 -- automatically inlined in all cases, even though the procedure to be
6869 -- called is marked inline. More specifically, if the procedure comes
6870 -- from another unit than the main source unit, for example a run-time
6871 -- unit, then it needs to be manually added to the list of bodies to be
6872 -- inlined by invoking Add_Inlined_Body on it.
6874 -- N_Handled_Sequence_Of_Statements
6875 -- Sloc points to first token of first statement
6876 -- Statements
6877 -- End_Label (set to Empty if expander generated)
6878 -- Exception_Handlers (set to No_List if none present)
6879 -- At_End_Proc (set to Empty if no clean up procedure)
6880 -- First_Real_Statement
6882 -- Note: the parent always contains a Declarations field which contains
6883 -- declarations associated with the handled sequence of statements. This
6884 -- is true even in the case of an accept statement (see description of
6885 -- the N_Accept_Statement node).
6887 -- End_Label refers to the containing construct
6889 -----------------------------
6890 -- 11.2 Exception Handler --
6891 -----------------------------
6893 -- EXCEPTION_HANDLER ::=
6894 -- when [CHOICE_PARAMETER_SPECIFICATION :]
6895 -- EXCEPTION_CHOICE {| EXCEPTION_CHOICE} =>
6896 -- SEQUENCE_OF_STATEMENTS
6898 -- Note: choice parameter specification is not allowed in Ada 83 mode
6900 -- N_Exception_Handler
6901 -- Sloc points to WHEN
6902 -- Choice_Parameter (set to Empty if not present)
6903 -- Exception_Choices
6904 -- Statements
6905 -- Exception_Label (set to Empty if not present)
6906 -- Local_Raise_Statements (set to No_Elist if not present)
6907 -- Local_Raise_Not_OK
6908 -- Has_Local_Raise
6910 ------------------------------------------
6911 -- 11.2 Choice parameter specification --
6912 ------------------------------------------
6914 -- CHOICE_PARAMETER_SPECIFICATION ::= DEFINING_IDENTIFIER
6916 ----------------------------
6917 -- 11.2 Exception Choice --
6918 ----------------------------
6920 -- EXCEPTION_CHOICE ::= exception_NAME | others
6922 -- Except in the case of OTHERS, no explicit node appears in the tree
6923 -- for exception choice. Instead the exception name appears directly.
6924 -- An OTHERS choice is represented by a N_Others_Choice node (see
6925 -- section 3.8.1.
6927 -- Note: for the exception choice created for an at end handler, the
6928 -- exception choice is an N_Others_Choice node with All_Others set.
6930 ---------------------------
6931 -- 11.3 Raise Statement --
6932 ---------------------------
6934 -- RAISE_STATEMENT ::= raise [exception_NAME];
6936 -- In Ada 2005, we have
6938 -- RAISE_STATEMENT ::=
6939 -- raise; | raise exception_NAME [with string_EXPRESSION];
6941 -- N_Raise_Statement
6942 -- Sloc points to RAISE
6943 -- Name (set to Empty if no exception name present)
6944 -- Expression (set to Empty if no expression present)
6945 -- From_At_End
6947 ----------------------------
6948 -- 11.3 Raise Expression --
6949 ----------------------------
6951 -- RAISE_EXPRESSION ::= raise exception_NAME [with string_EXPRESSION]
6953 -- N_Raise_Expression
6954 -- Sloc points to RAISE
6955 -- Name (always present)
6956 -- Expression (set to Empty if no expression present)
6957 -- Convert_To_Return_False
6958 -- plus fields for expression
6960 -------------------------------
6961 -- 12.1 Generic Declaration --
6962 -------------------------------
6964 -- GENERIC_DECLARATION ::=
6965 -- GENERIC_SUBPROGRAM_DECLARATION | GENERIC_PACKAGE_DECLARATION
6967 ------------------------------------------
6968 -- 12.1 Generic Subprogram Declaration --
6969 ------------------------------------------
6971 -- GENERIC_SUBPROGRAM_DECLARATION ::=
6972 -- GENERIC_FORMAL_PART SUBPROGRAM_SPECIFICATION
6973 -- [ASPECT_SPECIFICATIONS];
6975 -- Note: Generic_Formal_Declarations can include pragmas
6977 -- N_Generic_Subprogram_Declaration
6978 -- Sloc points to GENERIC
6979 -- Specification subprogram specification
6980 -- Corresponding_Body
6981 -- Generic_Formal_Declarations from generic formal part
6982 -- Parent_Spec
6984 ---------------------------------------
6985 -- 12.1 Generic Package Declaration --
6986 ---------------------------------------
6988 -- GENERIC_PACKAGE_DECLARATION ::=
6989 -- GENERIC_FORMAL_PART PACKAGE_SPECIFICATION
6990 -- [ASPECT_SPECIFICATIONS];
6992 -- Note: when we do generics right, the Activation_Chain_Entity entry
6993 -- for this node can be removed (since the expander won't see generic
6994 -- units any more)???.
6996 -- Note: Generic_Formal_Declarations can include pragmas
6998 -- N_Generic_Package_Declaration
6999 -- Sloc points to GENERIC
7000 -- Specification package specification
7001 -- Corresponding_Body
7002 -- Generic_Formal_Declarations from generic formal part
7003 -- Parent_Spec
7004 -- Activation_Chain_Entity
7006 -------------------------------
7007 -- 12.1 Generic Formal Part --
7008 -------------------------------
7010 -- GENERIC_FORMAL_PART ::=
7011 -- generic {GENERIC_FORMAL_PARAMETER_DECLARATION | USE_CLAUSE}
7013 ------------------------------------------------
7014 -- 12.1 Generic Formal Parameter Declaration --
7015 ------------------------------------------------
7017 -- GENERIC_FORMAL_PARAMETER_DECLARATION ::=
7018 -- FORMAL_OBJECT_DECLARATION
7019 -- | FORMAL_TYPE_DECLARATION
7020 -- | FORMAL_SUBPROGRAM_DECLARATION
7021 -- | FORMAL_PACKAGE_DECLARATION
7023 ---------------------------------
7024 -- 12.3 Generic Instantiation --
7025 ---------------------------------
7027 -- GENERIC_INSTANTIATION ::=
7028 -- package DEFINING_PROGRAM_UNIT_NAME is
7029 -- new generic_package_NAME [GENERIC_ACTUAL_PART]
7030 -- [ASPECT_SPECIFICATIONS];
7031 -- | [[not] overriding]
7032 -- procedure DEFINING_PROGRAM_UNIT_NAME is
7033 -- new generic_procedure_NAME [GENERIC_ACTUAL_PART]
7034 -- [ASPECT_SPECIFICATIONS];
7035 -- | [[not] overriding]
7036 -- function DEFINING_DESIGNATOR is
7037 -- new generic_function_NAME [GENERIC_ACTUAL_PART]
7038 -- [ASPECT_SPECIFICATIONS];
7040 -- N_Package_Instantiation
7041 -- Sloc points to PACKAGE
7042 -- Defining_Unit_Name
7043 -- Name
7044 -- Generic_Associations (set to No_List if no
7045 -- generic actual part)
7046 -- Parent_Spec
7047 -- Instance_Spec
7048 -- Is_Elaboration_Checks_OK_Node
7049 -- Is_SPARK_Mode_On_Node
7050 -- Is_Elaboration_Warnings_OK_Node
7051 -- Is_Declaration_Level_Node
7052 -- Is_Known_Guaranteed_ABE
7054 -- N_Procedure_Instantiation
7055 -- Sloc points to PROCEDURE
7056 -- Defining_Unit_Name
7057 -- Name
7058 -- Parent_Spec
7059 -- Generic_Associations (set to No_List if no
7060 -- generic actual part)
7061 -- Instance_Spec
7062 -- Is_Elaboration_Checks_OK_Node
7063 -- Is_SPARK_Mode_On_Node
7064 -- Is_Elaboration_Warnings_OK_Node
7065 -- Is_Declaration_Level_Node
7066 -- Must_Override set if overriding indicator present
7067 -- Must_Not_Override set if not_overriding indicator present
7068 -- Is_Known_Guaranteed_ABE
7070 -- N_Function_Instantiation
7071 -- Sloc points to FUNCTION
7072 -- Defining_Unit_Name
7073 -- Name
7074 -- Generic_Associations (set to No_List if no
7075 -- generic actual part)
7076 -- Parent_Spec
7077 -- Instance_Spec
7078 -- Is_Elaboration_Checks_OK_Node
7079 -- Is_SPARK_Mode_On_Node
7080 -- Is_Elaboration_Warnings_OK_Node
7081 -- Is_Declaration_Level_Node
7082 -- Must_Override set if overriding indicator present
7083 -- Must_Not_Override set if not_overriding indicator present
7084 -- Is_Known_Guaranteed_ABE
7086 -- Note: overriding indicator is an Ada 2005 feature
7088 -------------------------------
7089 -- 12.3 Generic Actual Part --
7090 -------------------------------
7092 -- GENERIC_ACTUAL_PART ::=
7093 -- (GENERIC_ASSOCIATION {, GENERIC_ASSOCIATION})
7095 -------------------------------
7096 -- 12.3 Generic Association --
7097 -------------------------------
7099 -- GENERIC_ASSOCIATION ::=
7100 -- [generic_formal_parameter_SELECTOR_NAME =>]
7102 -- Note: unlike the procedure call case, a generic association node
7103 -- is generated for every association, even if no formal parameter
7104 -- selector name is present. In this case the parser will leave the
7105 -- Selector_Name field set to Empty, to be filled in later by the
7106 -- semantic pass.
7108 -- In Ada 2005, a formal may be associated with a box, if the
7109 -- association is part of the list of actuals for a formal package.
7110 -- If the association is given by OTHERS => <>, the association is
7111 -- an N_Others_Choice.
7113 -- N_Generic_Association
7114 -- Sloc points to first token of generic association
7115 -- Selector_Name (set to Empty if no formal
7116 -- parameter selector name)
7117 -- Explicit_Generic_Actual_Parameter (Empty if box present)
7118 -- Box_Present (for formal_package associations with a box)
7120 ---------------------------------------------
7121 -- 12.3 Explicit Generic Actual Parameter --
7122 ---------------------------------------------
7124 -- EXPLICIT_GENERIC_ACTUAL_PARAMETER ::=
7125 -- EXPRESSION | variable_NAME | subprogram_NAME
7126 -- | entry_NAME | SUBTYPE_MARK | package_instance_NAME
7128 -------------------------------------
7129 -- 12.4 Formal Object Declaration --
7130 -------------------------------------
7132 -- FORMAL_OBJECT_DECLARATION ::=
7133 -- DEFINING_IDENTIFIER_LIST :
7134 -- MODE [NULL_EXCLUSION] SUBTYPE_MARK [:= DEFAULT_EXPRESSION]
7135 -- [ASPECT_SPECIFICATIONS];
7136 -- | DEFINING_IDENTIFIER_LIST :
7137 -- MODE ACCESS_DEFINITION [:= DEFAULT_EXPRESSION]
7138 -- [ASPECT_SPECIFICATIONS];
7140 -- Although the syntax allows multiple identifiers in the list, the
7141 -- semantics is as though successive declarations were given with
7142 -- identical type definition and expression components. To simplify
7143 -- semantic processing, the parser represents a multiple declaration
7144 -- case as a sequence of single declarations, using the More_Ids and
7145 -- Prev_Ids flags to preserve the original source form as described
7146 -- in the section on "Handling of Defining Identifier Lists".
7148 -- N_Formal_Object_Declaration
7149 -- Sloc points to first identifier
7150 -- Defining_Identifier
7151 -- In_Present
7152 -- Out_Present
7153 -- Null_Exclusion_Present (set to False if not present)
7154 -- Subtype_Mark (set to Empty if not present)
7155 -- Access_Definition (set to Empty if not present)
7156 -- Default_Expression (set to Empty if no default expression)
7157 -- More_Ids (set to False if no more identifiers in list)
7158 -- Prev_Ids (set to False if no previous identifiers in list)
7160 -----------------------------------
7161 -- 12.5 Formal Type Declaration --
7162 -----------------------------------
7164 -- FORMAL_TYPE_DECLARATION ::=
7165 -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART]
7166 -- is FORMAL_TYPE_DEFINITION
7167 -- [ASPECT_SPECIFICATIONS];
7168 -- | type DEFINING_IDENTIFIER [DISCRIMINANT_PART] [is tagged]
7170 -- N_Formal_Type_Declaration
7171 -- Sloc points to TYPE
7172 -- Defining_Identifier
7173 -- Formal_Type_Definition
7174 -- Discriminant_Specifications (set to No_List if no
7175 -- discriminant part)
7176 -- Unknown_Discriminants_Present set if (<>) discriminant
7177 -- Default_Subtype_Mark
7179 ----------------------------------
7180 -- 12.5 Formal type definition --
7181 ----------------------------------
7183 -- FORMAL_TYPE_DEFINITION ::=
7184 -- FORMAL_PRIVATE_TYPE_DEFINITION
7185 -- | FORMAL_DERIVED_TYPE_DEFINITION
7186 -- | FORMAL_DISCRETE_TYPE_DEFINITION
7187 -- | FORMAL_SIGNED_INTEGER_TYPE_DEFINITION
7188 -- | FORMAL_MODULAR_TYPE_DEFINITION
7189 -- | FORMAL_FLOATING_POINT_DEFINITION
7190 -- | FORMAL_ORDINARY_FIXED_POINT_DEFINITION
7191 -- | FORMAL_DECIMAL_FIXED_POINT_DEFINITION
7192 -- | FORMAL_ARRAY_TYPE_DEFINITION
7193 -- | FORMAL_ACCESS_TYPE_DEFINITION
7194 -- | FORMAL_INTERFACE_TYPE_DEFINITION
7195 -- | FORMAL_INCOMPLETE_TYPE_DEFINITION
7197 -- The Ada 2012 syntax introduces two new non-terminals:
7198 -- Formal_{Complete,Incomplete}_Type_Declaration just to introduce
7199 -- the latter category. Here we introduce an incomplete type definition
7200 -- in order to preserve as much as possible the existing structure.
7202 ---------------------------------------------
7203 -- 12.5.1 Formal Private Type Definition --
7204 ---------------------------------------------
7206 -- FORMAL_PRIVATE_TYPE_DEFINITION ::=
7207 -- [[abstract] tagged] [limited] private
7209 -- Note: TAGGED is not allowed in Ada 83 mode
7211 -- N_Formal_Private_Type_Definition
7212 -- Sloc points to PRIVATE
7213 -- Uninitialized_Variable
7214 -- Abstract_Present
7215 -- Tagged_Present
7216 -- Limited_Present
7218 --------------------------------------------
7219 -- 12.5.1 Formal Derived Type Definition --
7220 --------------------------------------------
7222 -- FORMAL_DERIVED_TYPE_DEFINITION ::=
7223 -- [abstract] [limited | synchronized]
7224 -- new SUBTYPE_MARK [[and INTERFACE_LIST] with private]
7225 -- Note: this construct is not allowed in Ada 83 mode
7227 -- N_Formal_Derived_Type_Definition
7228 -- Sloc points to NEW
7229 -- Subtype_Mark
7230 -- Private_Present
7231 -- Abstract_Present
7232 -- Limited_Present
7233 -- Synchronized_Present
7234 -- Interface_List (set to No_List if none)
7236 -----------------------------------------------
7237 -- 12.5.1 Formal Incomplete Type Definition --
7238 -----------------------------------------------
7240 -- FORMAL_INCOMPLETE_TYPE_DEFINITION ::= [tagged]
7242 -- N_Formal_Incomplete_Type_Definition
7243 -- Sloc points to identifier of parent
7244 -- Tagged_Present
7246 ---------------------------------------------
7247 -- 12.5.2 Formal Discrete Type Definition --
7248 ---------------------------------------------
7250 -- FORMAL_DISCRETE_TYPE_DEFINITION ::= (<>)
7252 -- N_Formal_Discrete_Type_Definition
7253 -- Sloc points to (
7255 ---------------------------------------------------
7256 -- 12.5.2 Formal Signed Integer Type Definition --
7257 ---------------------------------------------------
7259 -- FORMAL_SIGNED_INTEGER_TYPE_DEFINITION ::= range <>
7261 -- N_Formal_Signed_Integer_Type_Definition
7262 -- Sloc points to RANGE
7264 --------------------------------------------
7265 -- 12.5.2 Formal Modular Type Definition --
7266 --------------------------------------------
7268 -- FORMAL_MODULAR_TYPE_DEFINITION ::= mod <>
7270 -- N_Formal_Modular_Type_Definition
7271 -- Sloc points to MOD
7273 ----------------------------------------------
7274 -- 12.5.2 Formal Floating Point Definition --
7275 ----------------------------------------------
7277 -- FORMAL_FLOATING_POINT_DEFINITION ::= digits <>
7279 -- N_Formal_Floating_Point_Definition
7280 -- Sloc points to DIGITS
7282 ----------------------------------------------------
7283 -- 12.5.2 Formal Ordinary Fixed Point Definition --
7284 ----------------------------------------------------
7286 -- FORMAL_ORDINARY_FIXED_POINT_DEFINITION ::= delta <>
7288 -- N_Formal_Ordinary_Fixed_Point_Definition
7289 -- Sloc points to DELTA
7291 ---------------------------------------------------
7292 -- 12.5.2 Formal Decimal Fixed Point Definition --
7293 ---------------------------------------------------
7295 -- FORMAL_DECIMAL_FIXED_POINT_DEFINITION ::= delta <> digits <>
7297 -- Note: formal decimal fixed point definition not allowed in Ada 83
7299 -- N_Formal_Decimal_Fixed_Point_Definition
7300 -- Sloc points to DELTA
7302 ------------------------------------------
7303 -- 12.5.3 Formal Array Type Definition --
7304 ------------------------------------------
7306 -- FORMAL_ARRAY_TYPE_DEFINITION ::= ARRAY_TYPE_DEFINITION
7308 -------------------------------------------
7309 -- 12.5.4 Formal Access Type Definition --
7310 -------------------------------------------
7312 -- FORMAL_ACCESS_TYPE_DEFINITION ::= ACCESS_TYPE_DEFINITION
7314 ----------------------------------------------
7315 -- 12.5.5 Formal Interface Type Definition --
7316 ----------------------------------------------
7318 -- FORMAL_INTERFACE_TYPE_DEFINITION ::= INTERFACE_TYPE_DEFINITION
7320 -----------------------------------------
7321 -- 12.6 Formal Subprogram Declaration --
7322 -----------------------------------------
7324 -- FORMAL_SUBPROGRAM_DECLARATION ::=
7325 -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION
7326 -- | FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION
7328 --------------------------------------------------
7329 -- 12.6 Formal Concrete Subprogram Declaration --
7330 --------------------------------------------------
7332 -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION ::=
7333 -- with SUBPROGRAM_SPECIFICATION [is SUBPROGRAM_DEFAULT]
7334 -- [ASPECT_SPECIFICATIONS];
7336 -- N_Formal_Concrete_Subprogram_Declaration
7337 -- Sloc points to WITH
7338 -- Specification
7339 -- Default_Name (set to Empty if no subprogram default)
7340 -- Box_Present
7342 -- Note: if no subprogram default is present, then Name is set
7343 -- to Empty, and Box_Present is False.
7345 --------------------------------------------------
7346 -- 12.6 Formal Abstract Subprogram Declaration --
7347 --------------------------------------------------
7349 -- FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION ::=
7350 -- with SUBPROGRAM_SPECIFICATION is abstract [SUBPROGRAM_DEFAULT]
7351 -- [ASPECT_SPECIFICATIONS];
7353 -- N_Formal_Abstract_Subprogram_Declaration
7354 -- Sloc points to WITH
7355 -- Specification
7356 -- Default_Name (set to Empty if no subprogram default)
7357 -- Box_Present
7359 -- Note: if no subprogram default is present, then Name is set
7360 -- to Empty, and Box_Present is False.
7362 ------------------------------
7363 -- 12.6 Subprogram Default --
7364 ------------------------------
7366 -- SUBPROGRAM_DEFAULT ::= DEFAULT_NAME | <>
7368 -- There is no separate node in the tree for a subprogram default.
7369 -- Instead the parent (N_Formal_Concrete_Subprogram_Declaration
7370 -- or N_Formal_Abstract_Subprogram_Declaration) node contains the
7371 -- default name or box indication, as needed.
7373 ------------------------
7374 -- 12.6 Default Name --
7375 ------------------------
7377 -- DEFAULT_NAME ::= NAME
7379 --------------------------------------
7380 -- 12.7 Formal Package Declaration --
7381 --------------------------------------
7383 -- FORMAL_PACKAGE_DECLARATION ::=
7384 -- with package DEFINING_IDENTIFIER
7385 -- is new generic_package_NAME FORMAL_PACKAGE_ACTUAL_PART
7386 -- [ASPECT_SPECIFICATIONS];
7388 -- Note: formal package declarations not allowed in Ada 83 mode
7390 -- N_Formal_Package_Declaration
7391 -- Sloc points to WITH
7392 -- Defining_Identifier
7393 -- Name
7394 -- Generic_Associations (set to No_List if (<>) case or
7395 -- empty generic actual part)
7396 -- Box_Present
7397 -- Instance_Spec
7398 -- Is_Known_Guaranteed_ABE
7400 --------------------------------------
7401 -- 12.7 Formal Package Actual Part --
7402 --------------------------------------
7404 -- FORMAL_PACKAGE_ACTUAL_PART ::=
7405 -- ([OTHERS] => <>)
7406 -- | [GENERIC_ACTUAL_PART]
7407 -- (FORMAL_PACKAGE_ASSOCIATION {. FORMAL_PACKAGE_ASSOCIATION}
7409 -- FORMAL_PACKAGE_ASSOCIATION ::=
7410 -- GENERIC_ASSOCIATION
7411 -- | GENERIC_FORMAL_PARAMETER_SELECTOR_NAME => <>
7413 -- There is no explicit node in the tree for a formal package actual
7414 -- part. Instead the information appears in the parent node (i.e. the
7415 -- formal package declaration node itself).
7417 -- There is no explicit node for a formal package association. All of
7418 -- them are represented either by a generic association, possibly with
7419 -- Box_Present, or by an N_Others_Choice.
7421 ---------------------------------
7422 -- 13.1 Representation clause --
7423 ---------------------------------
7425 -- REPRESENTATION_CLAUSE ::=
7426 -- ATTRIBUTE_DEFINITION_CLAUSE
7427 -- | ENUMERATION_REPRESENTATION_CLAUSE
7428 -- | RECORD_REPRESENTATION_CLAUSE
7429 -- | AT_CLAUSE
7431 ----------------------
7432 -- 13.1 Local Name --
7433 ----------------------
7435 -- LOCAL_NAME :=
7436 -- DIRECT_NAME
7437 -- | DIRECT_NAME'ATTRIBUTE_DESIGNATOR
7438 -- | library_unit_NAME
7440 -- The construct DIRECT_NAME'ATTRIBUTE_DESIGNATOR appears in the tree
7441 -- as an attribute reference, which has essentially the same form.
7443 ---------------------------------------
7444 -- 13.3 Attribute definition clause --
7445 ---------------------------------------
7447 -- ATTRIBUTE_DEFINITION_CLAUSE ::=
7448 -- for LOCAL_NAME'ATTRIBUTE_DESIGNATOR use EXPRESSION;
7449 -- | for LOCAL_NAME'ATTRIBUTE_DESIGNATOR use NAME;
7451 -- In Ada 83, the expression must be a simple expression and the
7452 -- local name must be a direct name.
7454 -- Note: the only attribute definition clause that is processed by
7455 -- gigi is an address clause. For all other cases, the information
7456 -- is extracted by the front end and either results in setting entity
7457 -- information, e.g. Esize for the Size clause, or in appropriate
7458 -- expansion actions (e.g. in the case of Storage_Size).
7460 -- For an address clause, Gigi constructs the appropriate addressing
7461 -- code. It also ensures that no aliasing optimizations are made
7462 -- for the object for which the address clause appears.
7464 -- Note: for an address clause used to achieve an overlay:
7466 -- A : Integer;
7467 -- B : Integer;
7468 -- for B'Address use A'Address;
7470 -- the above rule means that Gigi will ensure that no optimizations
7471 -- will be made for B that would violate the implementation advice
7472 -- of RM 13.3(19). However, this advice applies only to B and not
7473 -- to A, which seems unfortunate. The GNAT front end will mark the
7474 -- object A as volatile to also prevent unwanted optimization
7475 -- assumptions based on no aliasing being made for B.
7477 -- N_Attribute_Definition_Clause
7478 -- Sloc points to FOR
7479 -- Name the local name
7480 -- Chars the identifier name from the attribute designator
7481 -- Expression the expression or name
7482 -- Entity
7483 -- Next_Rep_Item
7484 -- From_At_Mod
7485 -- Check_Address_Alignment
7486 -- From_Aspect_Specification
7487 -- Is_Delayed_Aspect
7488 -- Address_Warning_Posted
7490 -- Note: if From_Aspect_Specification is set, then Sloc points to the
7491 -- aspect name, and Entity is resolved already to reference the entity
7492 -- to which the aspect applies.
7494 -----------------------------------
7495 -- 13.3.1 Aspect Specifications --
7496 -----------------------------------
7498 -- We modify the RM grammar here, the RM grammar is:
7500 -- ASPECT_SPECIFICATION ::=
7501 -- with ASPECT_MARK [=> ASPECT_DEFINITION] {,
7502 -- ASPECT_MARK [=> ASPECT_DEFINITION] }
7504 -- ASPECT_MARK ::= aspect_IDENTIFIER['Class]
7506 -- ASPECT_DEFINITION ::= NAME | EXPRESSION
7508 -- That's inconvenient, since there is no non-terminal name for a single
7509 -- entry in the list of aspects. So we use this grammar instead:
7511 -- ASPECT_SPECIFICATIONS ::=
7512 -- with ASPECT_SPECIFICATION {, ASPECT_SPECIFICATION}
7514 -- ASPECT_SPECIFICATION =>
7515 -- ASPECT_MARK [=> ASPECT_DEFINITION]
7517 -- ASPECT_MARK ::= aspect_IDENTIFIER['Class]
7519 -- ASPECT_DEFINITION ::= NAME | EXPRESSION
7521 -- Note that for Annotate, the ASPECT_DEFINITION is a pure positional
7522 -- aggregate with the elements of the aggregate corresponding to the
7523 -- successive arguments of the corresponding pragma.
7525 -- See separate package Aspects for details on the incorporation of
7526 -- these nodes into the tree, and how aspect specifications for a given
7527 -- declaration node are associated with that node.
7529 -- N_Aspect_Specification
7530 -- Sloc points to aspect identifier
7531 -- Identifier aspect identifier
7532 -- Aspect_Rep_Item
7533 -- Expression (set to Empty if none)
7534 -- Entity entity to which the aspect applies
7535 -- Next_Rep_Item
7536 -- Class_Present Set if 'Class present
7537 -- Is_Ignored
7538 -- Is_Checked
7539 -- Is_Delayed_Aspect
7540 -- Is_Disabled
7541 -- Is_Boolean_Aspect
7542 -- Split_PPC Set if split pre/post attribute
7543 -- Aspect_On_Partial_View
7545 -- Note: Aspect_Specification is an Ada 2012 feature
7547 -- Note: The Identifier serves to identify the aspect involved (it
7548 -- is the aspect whose name corresponds to the Chars field). This
7549 -- means that the other fields of this identifier are unused, and
7550 -- in particular we use the Entity field of this identifier to save
7551 -- a copy of the expression for visibility analysis, see spec of
7552 -- Sem_Ch13 for full details of this usage.
7554 -- In the case of aspects of the form xxx'Class, the aspect identifier
7555 -- is for xxx, and Class_Present is set to True.
7557 -- Note: When a Pre or Post aspect specification is processed, it is
7558 -- broken into AND THEN sections. The left most section has Split_PPC
7559 -- set to False, indicating that it is the original specification (e.g.
7560 -- for posting errors). For the other sections, Split_PPC is set True.
7562 ---------------------------------------------
7563 -- 13.4 Enumeration representation clause --
7564 ---------------------------------------------
7566 -- ENUMERATION_REPRESENTATION_CLAUSE ::=
7567 -- for first_subtype_LOCAL_NAME use ENUMERATION_AGGREGATE;
7569 -- In Ada 83, the name must be a direct name
7571 -- N_Enumeration_Representation_Clause
7572 -- Sloc points to FOR
7573 -- Identifier direct name
7574 -- Array_Aggregate
7575 -- Next_Rep_Item
7577 ---------------------------------
7578 -- 13.4 Enumeration aggregate --
7579 ---------------------------------
7581 -- ENUMERATION_AGGREGATE ::= ARRAY_AGGREGATE
7583 ------------------------------------------
7584 -- 13.5.1 Record representation clause --
7585 ------------------------------------------
7587 -- RECORD_REPRESENTATION_CLAUSE ::=
7588 -- for first_subtype_LOCAL_NAME use
7589 -- record [MOD_CLAUSE]
7590 -- {COMPONENT_CLAUSE}
7591 -- end record;
7593 -- Gigi restriction: Mod_Clause is always Empty (if present it is
7594 -- replaced by a corresponding Alignment attribute definition clause).
7596 -- Note: Component_Clauses can include pragmas
7598 -- N_Record_Representation_Clause
7599 -- Sloc points to FOR
7600 -- Identifier direct name
7601 -- Mod_Clause (set to Empty if no mod clause present)
7602 -- Component_Clauses
7603 -- Next_Rep_Item
7605 ------------------------------
7606 -- 13.5.1 Component clause --
7607 ------------------------------
7609 -- COMPONENT_CLAUSE ::=
7610 -- component_LOCAL_NAME at POSITION
7611 -- range FIRST_BIT .. LAST_BIT;
7613 -- N_Component_Clause
7614 -- Sloc points to AT
7615 -- Component_Name points to Name or Attribute_Reference
7616 -- Position
7617 -- First_Bit
7618 -- Last_Bit
7620 ----------------------
7621 -- 13.5.1 Position --
7622 ----------------------
7624 -- POSITION ::= static_EXPRESSION
7626 -----------------------
7627 -- 13.5.1 First_Bit --
7628 -----------------------
7630 -- FIRST_BIT ::= static_SIMPLE_EXPRESSION
7632 ----------------------
7633 -- 13.5.1 Last_Bit --
7634 ----------------------
7636 -- LAST_BIT ::= static_SIMPLE_EXPRESSION
7638 --------------------------
7639 -- 13.8 Code statement --
7640 --------------------------
7642 -- CODE_STATEMENT ::= QUALIFIED_EXPRESSION;
7644 -- Note: in GNAT, the qualified expression has the form
7646 -- Asm_Insn'(Asm (...));
7648 -- See package System.Machine_Code in file s-maccod.ads for details on
7649 -- the allowed parameters to Asm. There are two ways this node can
7650 -- arise, as a code statement, in which case the expression is the
7651 -- qualified expression, or as a result of the expansion of an intrinsic
7652 -- call to the Asm or Asm_Input procedure.
7654 -- N_Code_Statement
7655 -- Sloc points to first token of the expression
7656 -- Expression
7658 -- Note: package Exp_Code contains an abstract functional interface
7659 -- for use by Gigi in accessing the data from N_Code_Statement nodes.
7661 ------------------------
7662 -- 13.12 Restriction --
7663 ------------------------
7665 -- RESTRICTION ::=
7666 -- restriction_IDENTIFIER
7667 -- | restriction_parameter_IDENTIFIER => EXPRESSION
7669 -- There is no explicit node for restrictions. Instead the restriction
7670 -- appears in normal pragma syntax as a pragma argument association,
7671 -- which has the same syntactic form.
7673 --------------------------
7674 -- B.2 Shift Operators --
7675 --------------------------
7677 -- Calls to the intrinsic shift functions are converted to one of
7678 -- the following shift nodes, which have the form of normal binary
7679 -- operator names. Note that for a given shift operation, one node
7680 -- covers all possible types, as for normal operators.
7682 -- Note: it is perfectly permissible for the expander to generate
7683 -- shift operation nodes directly, in which case they will be analyzed
7684 -- and parsed in the usual manner.
7686 -- Sprint syntax: shift-function-name!(expr, count)
7688 -- Note: the Left_Opnd field holds the first argument (the value to
7689 -- be shifted). The Right_Opnd field holds the second argument (the
7690 -- shift count). The Chars field is the name of the intrinsic function.
7692 -- N_Op_Rotate_Left
7693 -- Sloc points to the function name
7694 -- plus fields for binary operator
7695 -- plus fields for expression
7696 -- Shift_Count_OK
7698 -- N_Op_Rotate_Right
7699 -- Sloc points to the function name
7700 -- plus fields for binary operator
7701 -- plus fields for expression
7702 -- Shift_Count_OK
7704 -- N_Op_Shift_Left
7705 -- Sloc points to the function name
7706 -- plus fields for binary operator
7707 -- plus fields for expression
7708 -- Shift_Count_OK
7710 -- N_Op_Shift_Right_Arithmetic
7711 -- Sloc points to the function name
7712 -- plus fields for binary operator
7713 -- plus fields for expression
7714 -- Shift_Count_OK
7716 -- N_Op_Shift_Right
7717 -- Sloc points to the function name
7718 -- plus fields for binary operator
7719 -- plus fields for expression
7720 -- Shift_Count_OK
7722 -- Note: N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic
7723 -- never appear in the expanded tree if Modify_Tree_For_C mode is set.
7725 -- Note: For N_Op_Shift_Left and N_Op_Shift_Right, the right operand is
7726 -- always less than the word size if Modify_Tree_For_C mode is set.
7728 --------------------------
7729 -- Obsolescent Features --
7730 --------------------------
7732 -- The syntax descriptions and tree nodes for obsolescent features are
7733 -- grouped together, corresponding to their location in appendix I in
7734 -- the RM. However, parsing and semantic analysis for these constructs
7735 -- is located in an appropriate chapter (see individual notes).
7737 ---------------------------
7738 -- J.3 Delta Constraint --
7739 ---------------------------
7741 -- Note: the parse routine for this construct is located in section
7742 -- 3.5.9 of Par-Ch3, and semantic analysis is in Sem_Ch3, which is
7743 -- where delta constraint logically belongs.
7745 -- DELTA_CONSTRAINT ::= DELTA static_EXPRESSION [RANGE_CONSTRAINT]
7747 -- N_Delta_Constraint
7748 -- Sloc points to DELTA
7749 -- Delta_Expression
7750 -- Range_Constraint (set to Empty if not present)
7752 --------------------
7753 -- J.7 At Clause --
7754 --------------------
7756 -- AT_CLAUSE ::= for DIRECT_NAME use at EXPRESSION;
7758 -- Note: the parse routine for this construct is located in Par-Ch13,
7759 -- and the semantic analysis is in Sem_Ch13, where at clause logically
7760 -- belongs if it were not obsolescent.
7762 -- Note: in Ada 83 the expression must be a simple expression
7764 -- Gigi restriction: This node never appears, it is rewritten as an
7765 -- address attribute definition clause.
7767 -- N_At_Clause
7768 -- Sloc points to FOR
7769 -- Identifier
7770 -- Expression
7772 ---------------------
7773 -- J.8 Mod clause --
7774 ---------------------
7776 -- MOD_CLAUSE ::= at mod static_EXPRESSION;
7778 -- Note: the parse routine for this construct is located in Par-Ch13,
7779 -- and the semantic analysis is in Sem_Ch13, where mod clause logically
7780 -- belongs if it were not obsolescent.
7782 -- Note: in Ada 83, the expression must be a simple expression
7784 -- Gigi restriction: this node never appears. It is replaced
7785 -- by a corresponding Alignment attribute definition clause.
7787 -- Note: pragmas can appear before and after the MOD_CLAUSE since
7788 -- its name has "clause" in it. This is rather strange, but is quite
7789 -- definitely specified. The pragmas before are collected in the
7790 -- Pragmas_Before field of the mod clause node itself, and pragmas
7791 -- after are simply swallowed up in the list of component clauses.
7793 -- N_Mod_Clause
7794 -- Sloc points to AT
7795 -- Expression
7796 -- Pragmas_Before Pragmas before mod clause (No_List if none)
7798 --------------------
7799 -- Semantic Nodes --
7800 --------------------
7802 -- These semantic nodes are used to hold additional semantic information.
7803 -- They are inserted into the tree as a result of semantic processing.
7804 -- Although there are no legitimate source syntax constructions that
7805 -- correspond directly to these nodes, we need a source syntax for the
7806 -- reconstructed tree printed by Sprint, and the node descriptions here
7807 -- show this syntax.
7809 -----------------
7810 -- Call_Marker --
7811 -----------------
7813 -- This node is created during the analysis/resolution of entry calls,
7814 -- requeues, and subprogram calls. It performs several functions:
7816 -- * Call markers provide a uniform model for handling calls by the
7817 -- ABE mechanism, regardless of whether expansion took place.
7819 -- * The call marker captures the target of the related call along
7820 -- with other attributes which are either unavailabe or expensive
7821 -- to recompute once analysis, resolution, and expansion are over.
7823 -- * The call marker aids the ABE Processing phase by signaling the
7824 -- presence of a call in case the original call was transformed by
7825 -- expansion.
7827 -- * The call marker acts as a reference point for the insertion of
7828 -- run-time conditional ABE checks or guaranteed ABE failures.
7830 -- Sprint syntax: #target#
7832 -- The Sprint syntax shown above is not enabled by default
7834 -- N_Call_Marker
7835 -- Sloc points to Sloc of original call
7836 -- Target
7837 -- Is_Elaboration_Checks_OK_Node
7838 -- Is_SPARK_Mode_On_Node
7839 -- Is_Elaboration_Warnings_OK_Node
7840 -- Is_Source_Call
7841 -- Is_Declaration_Level_Node
7842 -- Is_Dispatching_Call
7843 -- Is_Preelaborable_Call
7844 -- Is_Known_Guaranteed_ABE
7846 ------------------------
7847 -- Compound Statement --
7848 ------------------------
7850 -- This node is created by the analyzer/expander to handle some
7851 -- expansion cases where a sequence of actions needs to be captured
7852 -- within a single node (which acts as a container and allows the
7853 -- entire list of actions to be moved around as a whole) appearing
7854 -- in a sequence of statements.
7856 -- This is the statement counterpart to the expression node
7857 -- N_Expression_With_Actions.
7859 -- The required semantics is that the set of actions is executed in
7860 -- the order in which it appears, as though they appeared by themselves
7861 -- in the enclosing list of declarations or statements. Unlike what
7862 -- happens when using an N_Block_Statement, no new scope is introduced.
7864 -- Note: for the time being, this is used only as a transient
7865 -- representation during expansion, and all compound statement nodes
7866 -- must be exploded back to their constituent statements before handing
7867 -- the tree to the back end.
7869 -- Sprint syntax: do
7870 -- action;
7871 -- action;
7872 -- ...
7873 -- action;
7874 -- end;
7876 -- N_Compound_Statement
7877 -- Actions
7879 --------------
7880 -- Contract --
7881 --------------
7883 -- This node is used to hold the various parts of an entry, subprogram
7884 -- [body] or package [body] contract, in particular:
7885 -- Abstract states declared by a package declaration
7886 -- Contract cases that apply to a subprogram
7887 -- Dependency relations of inputs and output of a subprogram
7888 -- Global annotations classifying data as input or output
7889 -- Initialization sequences for a package declaration
7890 -- Pre- and postconditions that apply to a subprogram
7892 -- The node appears in an entry and [generic] subprogram [body] entity.
7894 -- Sprint syntax: <none> as the node should not appear in the tree, but
7895 -- only attached to an entry or [generic] subprogram
7896 -- entity.
7898 -- N_Contract
7899 -- Sloc points to the subprogram's name
7900 -- Pre_Post_Conditions (set to Empty if none)
7901 -- Contract_Test_Cases (set to Empty if none)
7902 -- Classifications (set to Empty if none)
7903 -- Is_Expanded_Contract
7905 -- Pre_Post_Conditions contains a collection of pragmas that correspond
7906 -- to pre- and postconditions associated with an entry or a subprogram
7907 -- [body or stub]. The pragmas can either come from source or be the
7908 -- byproduct of aspect expansion. Currently the following pragmas appear
7909 -- in this list:
7910 -- Post
7911 -- Postcondition
7912 -- Pre
7913 -- Precondition
7914 -- Refined_Post
7915 -- The ordering in the list is in LIFO fashion.
7917 -- Note that there might be multiple preconditions or postconditions
7918 -- in this list, either because they come from separate pragmas in the
7919 -- source, or because a Pre (resp. Post) aspect specification has been
7920 -- broken into AND THEN sections. See Split_PPC for details.
7922 -- In GNATprove mode, the inherited classwide pre- and postconditions
7923 -- (suitably specialized for the specific type of the overriding
7924 -- operation) are also in this list.
7926 -- Contract_Test_Cases contains a collection of pragmas that correspond
7927 -- to aspects/pragmas Contract_Cases, Test_Case and Subprogram_Variant.
7928 -- The ordering in the list is in LIFO fashion.
7930 -- Classifications contains pragmas that either declare, categorize, or
7931 -- establish dependencies between subprogram or package inputs and
7932 -- outputs. Currently the following pragmas appear in this list:
7933 -- Abstract_States
7934 -- Async_Readers
7935 -- Async_Writers
7936 -- Constant_After_Elaboration
7937 -- Depends
7938 -- Effective_Reads
7939 -- Effective_Writes
7940 -- Extensions_Visible
7941 -- Global
7942 -- Initial_Condition
7943 -- Initializes
7944 -- Part_Of
7945 -- Refined_Depends
7946 -- Refined_Global
7947 -- Refined_States
7948 -- Volatile_Function
7949 -- The ordering is in LIFO fashion.
7951 -------------------
7952 -- Expanded Name --
7953 -------------------
7955 -- The N_Expanded_Name node is used to represent a selected component
7956 -- name that has been resolved to an expanded name. The semantic phase
7957 -- replaces N_Selected_Component nodes that represent names by the use
7958 -- of this node, leaving the N_Selected_Component node used only when
7959 -- the prefix is a record or protected type.
7961 -- The fields of the N_Expanded_Name node are laid out identically
7962 -- to those of the N_Selected_Component node, allowing conversion of
7963 -- an expanded name node to a selected component node to be done
7964 -- easily, see Sinfo.CN.Change_Selected_Component_To_Expanded_Name.
7966 -- There is no special sprint syntax for an expanded name
7968 -- N_Expanded_Name
7969 -- Sloc points to the period
7970 -- Chars copy of Chars field of selector name
7971 -- Prefix
7972 -- Selector_Name
7973 -- Entity
7974 -- Associated_Node
7975 -- Is_Elaboration_Checks_OK_Node
7976 -- Is_SPARK_Mode_On_Node
7977 -- Is_Elaboration_Warnings_OK_Node
7978 -- Has_Private_View (set in generic units)
7979 -- Redundant_Use
7980 -- Atomic_Sync_Required
7981 -- plus fields for expression
7983 -----------------------------
7984 -- Expression With Actions --
7985 -----------------------------
7987 -- This node is created by the analyzer/expander to handle some
7988 -- expansion cases, notably short-circuit forms where there are
7989 -- actions associated with the right-hand side operand.
7991 -- The N_Expression_With_Actions node represents an expression with
7992 -- an associated set of actions (which are executable statements and
7993 -- declarations, as might occur in a handled statement sequence).
7995 -- The required semantics is that the set of actions is executed in
7996 -- the order in which it appears just before the expression is
7997 -- evaluated (and these actions must only be executed if the value
7998 -- of the expression is evaluated). The node is considered to be
7999 -- a subexpression, whose value is the value of the Expression after
8000 -- executing all the actions.
8002 -- If the actions contain declarations, then these declarations may
8003 -- be referenced within the expression.
8005 -- (AI12-0236-1): In Ada 2022, for a declare_expression, the parser
8006 -- generates an N_Expression_With_Actions. Declare_expressions have
8007 -- various restrictions, which we do not enforce on
8008 -- N_Expression_With_Actions nodes that are generated by the
8009 -- expander. The two cases can be distinguished by looking at
8010 -- Comes_From_Source.
8012 -- ???Perhaps we should change the name of this node to
8013 -- N_Declare_Expression, and perhaps we should change the Sprint syntax
8014 -- to match the RM syntax for declare_expression.
8016 -- Sprint syntax: do
8017 -- action;
8018 -- action;
8019 -- ...
8020 -- action;
8021 -- in expression end
8023 -- N_Expression_With_Actions
8024 -- Actions
8025 -- Expression
8026 -- plus fields for expression
8028 -- Note: In the final generated tree presented to the code generator,
8029 -- the actions list is always non-null, since there is no point in this
8030 -- node if the actions are Empty. During semantic analysis there are
8031 -- cases where it is convenient to temporarily generate an empty actions
8032 -- list. This arises in cases where we create such an empty actions
8033 -- list, and it may or may not end up being a place where additional
8034 -- actions are inserted. The expander removes such empty cases after
8035 -- the expression of the node is fully analyzed and expanded, at which
8036 -- point it is safe to remove it, since no more actions can be inserted.
8038 -- Note: In Modify_Tree_For_C, we never generate any declarations in
8039 -- the action list, which can contain only non-declarative statements.
8041 --------------------
8042 -- Free Statement --
8043 --------------------
8045 -- The N_Free_Statement node is generated as a result of a call to an
8046 -- instantiation of Unchecked_Deallocation. The instantiation of this
8047 -- generic is handled specially and generates this node directly.
8049 -- Sprint syntax: free expression
8051 -- N_Free_Statement
8052 -- Sloc is copied from the unchecked deallocation call
8053 -- Expression argument to unchecked deallocation call
8054 -- Storage_Pool
8055 -- Procedure_To_Call
8056 -- Actual_Designated_Subtype
8058 -- Note: in the case where a debug source file is generated, the Sloc
8059 -- for this node points to the FREE keyword in the Sprint file output.
8061 -------------------
8062 -- Freeze Entity --
8063 -------------------
8065 -- This node marks the point in a declarative part at which an entity
8066 -- declared therein becomes frozen. The expander places initialization
8067 -- procedures for types at those points. Gigi uses the freezing point
8068 -- to elaborate entities that may depend on previous private types.
8070 -- See the section in Einfo "Delayed Freezing and Elaboration" for
8071 -- a full description of the use of this node.
8073 -- The Entity field points back to the entity for the type (whose
8074 -- Freeze_Node field points back to this freeze node).
8076 -- The Actions field contains a list of declarations and statements
8077 -- generated by the expander which are associated with the freeze
8078 -- node, and are elaborated as though the freeze node were replaced
8079 -- by this sequence of actions.
8081 -- Note: the Sloc field in the freeze node references a construct
8082 -- associated with the freezing point. This is used for posting
8083 -- messages in some error/warning situations, e.g. the case where
8084 -- a primitive operation of a tagged type is declared too late.
8086 -- Sprint syntax: freeze entity-name [
8087 -- freeze actions
8088 -- ]
8090 -- N_Freeze_Entity
8091 -- Sloc points near freeze point (see above special note)
8092 -- Entity
8093 -- Access_Types_To_Process (set to No_Elist if none)
8094 -- TSS_Elist (set to No_Elist if no associated TSS's)
8095 -- Actions (set to No_List if no freeze actions)
8096 -- First_Subtype_Link (set to Empty if no link)
8098 -- The Actions field holds actions associated with the freeze. These
8099 -- actions are elaborated at the point where the type is frozen.
8101 -- Note: in the case where a debug source file is generated, the Sloc
8102 -- for this node points to the FREEZE keyword in the Sprint file output.
8104 ---------------------------
8105 -- Freeze Generic Entity --
8106 ---------------------------
8108 -- The freeze point of an entity indicates the point at which the
8109 -- information needed to generate code for the entity is complete.
8110 -- The freeze node for an entity triggers expander activities, such as
8111 -- build initialization procedures, and backend activities, such as
8112 -- completing the elaboration of packages.
8114 -- For entities declared within a generic unit, for which no code is
8115 -- generated, the freeze point is not equally meaningful. However, in
8116 -- Ada 2012 several semantic checks on declarations must be delayed to
8117 -- the freeze point, and we need to include such a mark in the tree to
8118 -- trigger these checks. The Freeze_Generic_Entity node plays no other
8119 -- role, and is ignored by the expander and the back-end.
8121 -- Sprint syntax: freeze_generic entity-name
8123 -- N_Freeze_Generic_Entity
8124 -- Sloc points near freeze point
8125 -- Entity
8127 --------------------------------
8128 -- Implicit Label Declaration --
8129 --------------------------------
8131 -- An implicit label declaration is created for every occurrence of a
8132 -- label on a statement or a label on a block or loop. It is chained
8133 -- in the declarations of the innermost enclosing block as specified
8134 -- in RM section 5.1 (3).
8136 -- The Defining_Identifier is the actual identifier for the statement
8137 -- identifier. Note that the occurrence of the label is a reference, NOT
8138 -- the defining occurrence. The defining occurrence occurs at the head
8139 -- of the innermost enclosing block, and is represented by this node.
8141 -- Note: from the grammar, this might better be called an implicit
8142 -- statement identifier declaration, but the term we choose seems
8143 -- friendlier, since at least informally statement identifiers are
8144 -- called labels in both cases (i.e. when used in labels, and when
8145 -- used as the identifiers of blocks and loops).
8147 -- Note: although this is logically a semantic node, since it does not
8148 -- correspond directly to a source syntax construction, these nodes are
8149 -- actually created by the parser in a post pass done just after parsing
8150 -- is complete, before semantic analysis is started (see Par.Labl).
8152 -- Sprint syntax: labelname : label;
8154 -- N_Implicit_Label_Declaration
8155 -- Sloc points to the << token for a statement identifier, or to the
8156 -- LOOP, DECLARE, or BEGIN token for a loop or block identifier
8157 -- Defining_Identifier
8158 -- Label_Construct
8160 -- Note: in the case where a debug source file is generated, the Sloc
8161 -- for this node points to the label name in the generated declaration.
8163 ---------------------
8164 -- Itype Reference --
8165 ---------------------
8167 -- This node is used to create a reference to an Itype. The only purpose
8168 -- is to make sure the Itype is defined if this is the first reference.
8170 -- A typical use of this node is when an Itype is to be referenced in
8171 -- two branches of an IF statement. In this case it is important that
8172 -- the first use of the Itype not be inside the conditional, since then
8173 -- it might not be defined if the other branch of the IF is taken, in
8174 -- the case where the definition generates elaboration code.
8176 -- The Itype field points to the referenced Itype
8178 -- Sprint syntax: reference itype-name
8180 -- N_Itype_Reference
8181 -- Sloc points to the node generating the reference
8182 -- Itype
8184 -- Note: in the case where a debug source file is generated, the Sloc
8185 -- for this node points to the REFERENCE keyword in the file output.
8187 ---------------------
8188 -- Raise xxx Error --
8189 ---------------------
8191 -- One of these nodes is created during semantic analysis to replace
8192 -- a node for an expression that is determined to definitely raise
8193 -- the corresponding exception.
8195 -- The N_Raise_xxx_Error node may also stand alone in place
8196 -- of a declaration or statement, in which case it simply causes
8197 -- the exception to be raised (i.e. it is equivalent to a raise
8198 -- statement that raises the corresponding exception). This use
8199 -- is distinguished by the fact that the Etype in this case is
8200 -- Standard_Void_Type; in the subexpression case, the Etype is the
8201 -- same as the type of the subexpression which it replaces.
8203 -- If Condition is empty, then the raise is unconditional. If the
8204 -- Condition field is non-empty, it is a boolean expression which is
8205 -- first evaluated, and the exception is raised only if the value of the
8206 -- expression is True. In the unconditional case, the creation of this
8207 -- node is usually accompanied by a warning message (unless it appears
8208 -- within the right operand of a short-circuit form whose left argument
8209 -- is static and decisively eliminates elaboration of the raise
8210 -- operation). The condition field can ONLY be present when the node is
8211 -- used as a statement form; it must NOT be present in the case where
8212 -- the node appears within an expression.
8214 -- The exception is generated with a message that contains the
8215 -- file name and line number, and then appended text. The Reason
8216 -- code shows the text to be added. The Reason code is an element
8217 -- of the type Types.RT_Exception_Code, and indicates both the
8218 -- message to be added, and the exception to be raised (which must
8219 -- match the node type). The value is stored by storing a Uint which
8220 -- is the Pos value of the enumeration element in this type.
8222 -- Gigi restriction: This expander ensures that the type of the
8223 -- Condition field is always Standard.Boolean, even if the type
8224 -- in the source is some non-standard boolean type.
8226 -- Sprint syntax: [xxx_error "msg"]
8227 -- or: [xxx_error when condition "msg"]
8229 -- N_Raise_Constraint_Error
8230 -- Sloc references related construct
8231 -- Condition (set to Empty if no condition)
8232 -- Reason
8233 -- plus fields for expression
8235 -- N_Raise_Program_Error
8236 -- Sloc references related construct
8237 -- Condition (set to Empty if no condition)
8238 -- Reason
8239 -- plus fields for expression
8241 -- N_Raise_Storage_Error
8242 -- Sloc references related construct
8243 -- Condition (set to Empty if no condition)
8244 -- Reason
8245 -- plus fields for expression
8247 -- Note: Sloc is copied from the expression generating the exception.
8248 -- In the case where a debug source file is generated, the Sloc for
8249 -- this node points to the left bracket in the Sprint file output.
8251 -- Note: the back end may be required to translate these nodes into
8252 -- appropriate goto statements. See description of N_Push/Pop_xxx_Label.
8254 ---------------------------------------------
8255 -- Optimization of Exception Raise to Goto --
8256 ---------------------------------------------
8258 -- In some cases, the front end will determine that any exception raised
8259 -- by the back end for a certain exception should be transformed into a
8260 -- goto statement.
8262 -- There are three kinds of exceptions raised by the back end (note that
8263 -- for this purpose we consider gigi to be part of the back end in the
8264 -- gcc case):
8266 -- 1. Exceptions resulting from N_Raise_xxx_Error nodes
8267 -- 2. Exceptions from checks triggered by Do_xxx_Check flags
8268 -- 3. Other cases not specifically marked by the front end
8270 -- Normally all such exceptions are translated into calls to the proper
8271 -- Rcheck_xx procedure, where xx encodes both the exception to be raised
8272 -- and the exception message.
8274 -- The front end may determine that for a particular sequence of code,
8275 -- exceptions in any of these three categories for a particular builtin
8276 -- exception should result in a goto, rather than a call to Rcheck_xx.
8277 -- The exact sequence to be generated is:
8279 -- Local_Raise (exception'Identity);
8280 -- goto Label
8282 -- The front end marks such a sequence of code by bracketing it with
8283 -- push and pop nodes:
8285 -- N_Push_xxx_Label (referencing the label)
8286 -- ...
8287 -- (code where transformation is expected for exception xxx)
8288 -- ...
8289 -- N_Pop_xxx_Label
8291 -- The use of push/pop reflects the fact that such regions can properly
8292 -- nest, and one special case is a subregion in which no transformation
8293 -- is allowed. Such a region is marked by a N_Push_xxx_Label node whose
8294 -- Exception_Label field is Empty.
8296 -- N_Push_Constraint_Error_Label
8297 -- Sloc references first statement in region covered
8298 -- Exception_Label
8300 -- N_Push_Program_Error_Label
8301 -- Sloc references first statement in region covered
8302 -- Exception_Label
8304 -- N_Push_Storage_Error_Label
8305 -- Sloc references first statement in region covered
8306 -- Exception_Label
8308 -- N_Pop_Constraint_Error_Label
8309 -- Sloc references last statement in region covered
8311 -- N_Pop_Program_Error_Label
8312 -- Sloc references last statement in region covered
8314 -- N_Pop_Storage_Error_Label
8315 -- Sloc references last statement in region covered
8317 ---------------
8318 -- Reference --
8319 ---------------
8321 -- For a number of purposes, we need to construct references to objects.
8322 -- These references are subsequently treated as normal access values.
8323 -- An example is the construction of the parameter block passed to a
8324 -- task entry. The N_Reference node is provided for this purpose. It is
8325 -- similar in effect to the use of the Unrestricted_Access attribute,
8326 -- and like Unrestricted_Access can be applied to objects which would
8327 -- not be valid prefixes for the Unchecked_Access attribute (e.g.
8328 -- objects which are not aliased, and slices). In addition it can be
8329 -- applied to composite type values as well as objects, including string
8330 -- values and aggregates.
8332 -- Note: we use the Prefix field for this expression so that the
8333 -- resulting node can be treated using common code with the attribute
8334 -- nodes for the 'Access and related attributes. Logically it would make
8335 -- more sense to call it an Expression field, but then we would have to
8336 -- special case the treatment of the N_Reference node.
8338 -- Note: evaluating a N_Reference node is guaranteed to yield a non-null
8339 -- value at run time. Therefore, it is valid to set Is_Known_Non_Null on
8340 -- a temporary initialized to a N_Reference node in order to eliminate
8341 -- superfluous access checks.
8343 -- Sprint syntax: prefix'reference
8345 -- N_Reference
8346 -- Sloc is copied from the expression
8347 -- Prefix
8348 -- plus fields for expression
8350 -- Note: in the case where a debug source file is generated, the Sloc
8351 -- for this node points to the quote in the Sprint file output.
8353 ----------------
8354 -- SCIL Nodes --
8355 ----------------
8357 -- SCIL nodes are special nodes added to the tree when the CodePeer mode
8358 -- is active. They are only generated if SCIL generation is enabled.
8359 -- A standard tree-walk will not encounter these nodes even if they
8360 -- are present; these nodes are only accessible via the function
8361 -- SCIL_LL.Get_SCIL_Node. These nodes have no associated dynamic
8362 -- semantics.
8364 -- Sprint syntax: [ <node kind> ]
8365 -- No semantic field values are displayed.
8367 -- N_SCIL_Dispatch_Table_Tag_Init
8368 -- Sloc references a node for a tag initialization
8369 -- SCIL_Entity
8371 -- An N_SCIL_Dispatch_Table_Tag_Init node may be associated (via
8372 -- Get_SCIL_Node) with the N_Object_Declaration node corresponding to
8373 -- the declaration of the dispatch table for a tagged type.
8375 -- N_SCIL_Dispatching_Call
8376 -- Sloc references the node of a dispatching call
8377 -- SCIL_Target_Prim
8378 -- SCIL_Entity
8379 -- SCIL_Controlling_Tag
8381 -- An N_Scil_Dispatching call node may be associated (via Get_SCIL_Node)
8382 -- with the N_Procedure_Call_Statement or N_Function_Call node (or a
8383 -- rewriting thereof) corresponding to a dispatching call.
8385 -- N_SCIL_Membership_Test
8386 -- Sloc references the node of a membership test
8387 -- SCIL_Tag_Value
8388 -- SCIL_Entity
8390 -- An N_Scil_Membership_Test node may be associated (via Get_SCIL_Node)
8391 -- with the N_In node (or a rewriting thereof) corresponding to a
8392 -- classwide membership test.
8394 --------------------------
8395 -- Unchecked Expression --
8396 --------------------------
8398 -- An unchecked expression is one that must be analyzed and resolved
8399 -- with all checks off, regardless of the current setting of scope
8400 -- suppress flags.
8402 -- Sprint syntax: `(expression)
8404 -- Note: this node is always removed from the tree (and replaced by
8405 -- its constituent expression) on completion of analysis, so it only
8406 -- appears in intermediate trees, and will never be seen by Gigi.
8408 -- N_Unchecked_Expression
8409 -- Sloc is a copy of the Sloc of the expression
8410 -- Expression
8411 -- plus fields for expression
8413 -- Note: in the case where a debug source file is generated, the Sloc
8414 -- for this node points to the back quote in the Sprint file output.
8416 -------------------------------
8417 -- Unchecked Type Conversion --
8418 -------------------------------
8420 -- An unchecked type conversion node represents the semantic action
8421 -- corresponding to a call to an instantiation of Unchecked_Conversion.
8422 -- It is generated as a result of actual use of Unchecked_Conversion
8423 -- and also by the expander.
8425 -- Unchecked type conversion nodes should be created by calling
8426 -- Tbuild.Unchecked_Convert_To, rather than by directly calling
8427 -- Nmake.Make_Unchecked_Type_Conversion.
8429 -- Note: an unchecked type conversion is a variable as far as the
8430 -- semantics are concerned, which is convenient for the expander.
8431 -- This does not change what Ada source programs are legal, since
8432 -- clearly a function call to an instantiation of Unchecked_Conversion
8433 -- is not a variable in any case.
8435 -- Sprint syntax: subtype-mark!(expression)
8437 -- N_Unchecked_Type_Conversion
8438 -- Sloc points to related node in source
8439 -- Subtype_Mark
8440 -- Expression
8441 -- Kill_Range_Check
8442 -- No_Truncation
8443 -- plus fields for expression
8445 -- Note: in the case where a debug source file is generated, the Sloc
8446 -- for this node points to the exclamation in the Sprint file output.
8448 -----------------------------------
8449 -- Validate_Unchecked_Conversion --
8450 -----------------------------------
8452 -- The front end does most of the validation of unchecked conversion,
8453 -- including checking sizes (this is done after the back end is called
8454 -- to take advantage of back-annotation of calculated sizes).
8456 -- The front end also deals with specific cases that are not allowed
8457 -- e.g. involving unconstrained array types.
8459 -- For the case of the standard gigi backend, this means that all
8460 -- checks are done in the front end.
8462 -- However, in the case of specialized back-ends, in particular the JVM
8463 -- backend in the past, additional requirements and restrictions may
8464 -- apply to unchecked conversion, and these are most conveniently
8465 -- performed in the specialized back-end.
8467 -- To accommodate this requirement, for such back ends, the following
8468 -- special node is generated recording an unchecked conversion that
8469 -- needs to be validated. The back end should post an appropriate
8470 -- error message if the unchecked conversion is invalid or warrants
8471 -- a special warning message.
8473 -- Source_Type and Target_Type point to the entities for the two
8474 -- types involved in the unchecked conversion instantiation that
8475 -- is to be validated.
8477 -- Sprint syntax: validate Unchecked_Conversion (source, target);
8479 -- N_Validate_Unchecked_Conversion
8480 -- Sloc points to instantiation (location for warning message)
8481 -- Source_Type
8482 -- Target_Type
8484 -- Note: in the case where a debug source file is generated, the Sloc
8485 -- for this node points to the VALIDATE keyword in the file output.
8487 -------------------------------
8488 -- Variable_Reference_Marker --
8489 -------------------------------
8491 -- This node is created during the analysis of direct or expanded names,
8492 -- and the resolution of entry and subprogram calls. It performs several
8493 -- functions:
8495 -- * Variable reference markers provide a uniform model for handling
8496 -- variable references by the ABE mechanism, regardless of whether
8497 -- expansion took place.
8499 -- * The variable reference marker captures the entity of the variable
8500 -- being read or written.
8502 -- * The variable reference markers aid the ABE Processing phase by
8503 -- signaling the presence of a call in case the original variable
8504 -- reference was transformed by expansion.
8506 -- Sprint syntax: r#target# -- for a read
8507 -- rw#target# -- for a read/write
8508 -- w#target# -- for a write
8510 -- The Sprint syntax shown above is not enabled by default
8512 -- N_Variable_Reference_Marker
8513 -- Sloc points to Sloc of original variable reference
8514 -- Target
8515 -- Is_Elaboration_Checks_OK_Node
8516 -- Is_SPARK_Mode_On_Node
8517 -- Is_Elaboration_Warnings_OK_Node
8518 -- Is_Read
8519 -- Is_Write
8521 -----------
8522 -- Empty --
8523 -----------
8525 -- Used as the contents of the Nkind field of the dummy Empty node and in
8526 -- some other situations to indicate an uninitialized value.
8528 -- N_Empty
8529 -- Chars is set to No_Name
8531 -----------
8532 -- Error --
8533 -----------
8535 -- Used as the contents of the Nkind field of the dummy Error node.
8536 -- Has an Etype field, which gets set to Any_Type later on, to help
8537 -- error recovery (Error_Posted is also set in the Error node).
8539 -- N_Error
8540 -- Chars is set to Error_Name
8541 -- Etype
8543 end Sinfo;