PR27116, Spelling errors found by Debian style checker
[official-gcc.git] / gcc / ada / sinfo.ads
blob57fd704475c36e649a723837a5b095467efe2d76
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S I N F O --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2023, 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_Check_Or_Contract
86 -- This flag is present in all N_If_Statement nodes and
87 -- gets set when an N_If_Statement is generated as part of
88 -- the expansion of a Check, Assert, or contract-related
89 -- pragma.
91 -- Comes_From_Source
92 -- This flag is present in all nodes. It is set if the
93 -- node is built by the scanner or parser, and clear if
94 -- the node is built by the analyzer or expander. It
95 -- indicates that the node corresponds to a construct
96 -- that appears in the original source program.
98 -- Analyzed This flag is present in all nodes. It is set when
99 -- a node is analyzed, and is used to avoid analyzing
100 -- the same node twice. Analysis includes expansion if
101 -- expansion is active, so in this case if the flag is
102 -- set it means the node has been analyzed and expanded.
104 -- Error_Posted This flag is present in all nodes. It is set when
105 -- an error message is posted which is associated with
106 -- the flagged node. This is used to avoid posting more
107 -- than one message on the same node.
109 -- Link For a node, points to the Parent. For a list, points
110 -- to the list header. Note that in the latter case, a
111 -- client cannot modify the link field. This field is
112 -- private to the Atree package (but is also modified
113 -- by the Nlists package).
115 -- The following additional fields are common to all entities (that is,
116 -- nodes whose Nkind is in N_Entity):
118 -- Ekind Entity type.
120 -- Convention Entity convention (Convention_Id value)
122 --------------------------------
123 -- Implicit Nodes in the Tree --
124 --------------------------------
126 -- Generally the structure of the tree very closely follows the grammar as
127 -- defined in the RM. However, certain nodes are omitted to save space and
128 -- simplify semantic processing. Two general classes of such omitted nodes
129 -- are as follows:
131 -- If the only possibilities for a non-terminal are one or more other
132 -- non-terminals (i.e. the rule is a "skinny" rule), then usually the
133 -- corresponding node is omitted from the tree, and the target construct
134 -- appears directly. For example, a real type definition is either
135 -- floating point definition or a fixed point definition. No explicit node
136 -- appears for real type definition. Instead either the floating point
137 -- definition or fixed point definition appears directly.
139 -- If a non-terminal corresponds to a list of some other non-terminal
140 -- (possibly with separating punctuation), then usually it is omitted from
141 -- the tree, and a list of components appears instead. For example,
142 -- sequence of statements does not appear explicitly in the tree. Instead
143 -- a list of statements appears directly.
145 -- Some additional cases of omitted nodes occur and are documented
146 -- individually. In particular, many nodes are omitted in the tree
147 -- generated for an expression.
149 -------------------------------------------
150 -- Handling of Defining Identifier Lists --
151 -------------------------------------------
153 -- In several declarative forms in the syntax, lists of defining
154 -- identifiers appear (object declarations, component declarations, number
155 -- declarations etc.)
157 -- The semantics of such statements are equivalent to a series of identical
158 -- declarations of single defining identifiers (except that conformance
159 -- checks require the same grouping of identifiers in the parameter case).
161 -- To simplify semantic processing, the parser breaks down such multiple
162 -- declaration cases into sequences of single declarations, duplicating
163 -- type and initialization information as required. The flags More_Ids and
164 -- Prev_Ids are used to record the original form of the source in the case
165 -- where the original source used a list of names, More_Ids being set on
166 -- all but the last name and Prev_Ids being set on all but the first name.
167 -- These flags are used to reconstruct the original source (e.g. in the
168 -- Sprint package), and also are included in the conformance checks, but
169 -- otherwise have no semantic significance.
171 -- Note: the reason that we use More_Ids and Prev_Ids rather than
172 -- First_Name and Last_Name flags is so that the flags are off in the
173 -- normal one identifier case, which minimizes tree print output.
175 -----------------------
176 -- Use of Node Lists --
177 -----------------------
179 -- With a few exceptions, if a construction of the form {non-terminal}
180 -- appears in the tree, lists are used in the corresponding tree node (see
181 -- package Nlists for handling of node lists). In this case a field of the
182 -- parent node points to a list of nodes for the non-terminal. The field
183 -- name for such fields has a plural name which always ends in "s". For
184 -- example, a case statement has a field Alternatives pointing to list of
185 -- case statement alternative nodes.
187 -- Only fields pointing to lists have names ending in "s", so generally the
188 -- structure is strongly typed, fields not ending in s point to single
189 -- nodes, and fields ending in s point to lists.
191 -- The following example shows how a traversal of a list is written. We
192 -- suppose here that Stmt points to a N_Case_Statement node which has a
193 -- list field called Alternatives:
195 -- Alt := First (Alternatives (Stmt));
196 -- while Present (Alt) loop
197 -- ..
198 -- -- processing for case statement alternative Alt
199 -- ..
200 -- Alt := Next (Alt);
201 -- end loop;
203 -- The Present function tests for Empty, which in this case signals the end
204 -- of the list. First returns Empty immediately if the list is empty.
205 -- Present is defined in Atree; First and Next are defined in Nlists.
207 -- The exceptions to this rule occur with {DEFINING_IDENTIFIERS} in all
208 -- contexts, which is handled as described in the previous section, and
209 -- with {,library_unit_NAME} in the N_With_Clause node, which is handled
210 -- using the First_Name and Last_Name flags, as further detailed in the
211 -- description of the N_With_Clause node.
213 -------------
214 -- Pragmas --
215 -------------
217 -- Pragmas can appear in many different context, but are not included in
218 -- the grammar. Still they must appear in the tree, so they can be properly
219 -- processed.
221 -- Two approaches are used. In some cases, an extra field is defined in an
222 -- appropriate node that contains a list of pragmas appearing in the
223 -- expected context. For example pragmas can appear before an
224 -- Accept_Alternative in a Selective_Accept_Statement, and these pragmas
225 -- appear in the Pragmas_Before field of the N_Accept_Alternative node.
227 -- The other approach is to simply allow pragmas to appear in syntactic
228 -- lists where the grammar (of course) does not include the possibility.
229 -- For example, the Variants field of an N_Variant_Part node points to a
230 -- list that can contain both N_Pragma and N_Variant nodes.
232 -- To make processing easier in the latter case, the Nlists package
233 -- provides a set of routines (First_Non_Pragma, Last_Non_Pragma,
234 -- Next_Non_Pragma, Prev_Non_Pragma) that allow such lists to be handled
235 -- ignoring all pragmas.
237 -- In the case of the variants list, we can either write:
239 -- Variant := First (Variants (N));
240 -- while Present (Variant) loop
241 -- ...
242 -- Variant := Next (Variant);
243 -- end loop;
245 -- or
247 -- Variant := First_Non_Pragma (Variants (N));
248 -- while Present (Variant) loop
249 -- ...
250 -- Variant := Next_Non_Pragma (Variant);
251 -- end loop;
253 -- In the first form of the loop, Variant can either be an N_Pragma or an
254 -- N_Variant node. In the second form, Variant can only be N_Variant since
255 -- all pragmas are skipped.
257 ---------------------
258 -- Optional Fields --
259 ---------------------
261 -- Fields which correspond to a section of the syntax enclosed in square
262 -- brackets are generally omitted (and the corresponding field set to Empty
263 -- for a node, or No_List for a list). The documentation of such fields
264 -- notes these cases. One exception to this rule occurs in the case of
265 -- possibly empty statement sequences (such as the sequence of statements
266 -- in an entry call alternative). Such cases appear in the syntax rules as
267 -- [SEQUENCE_OF_STATEMENTS] and the fields corresponding to such optional
268 -- statement sequences always contain an empty list (not No_List) if no
269 -- statements are present.
271 -- Note: the utility program that constructs the body and spec of the Nmake
272 -- package relies on the format of the comments to determine if a field
273 -- should have a default value in the corresponding make routine. The rule
274 -- is that if the first line of the description of the field contains the
275 -- string "(set to xxx if", then a default value of xxx is provided for
276 -- this field in the corresponding Make_yyy routine.
278 -----------------------------------
279 -- Note on Body/Spec Terminology --
280 -----------------------------------
282 -- In informal discussions about Ada, it is customary to refer to package
283 -- and subprogram specs and bodies. However, this is not technically
284 -- correct, what is normally referred to as a spec or specification is in
285 -- fact a package declaration or subprogram declaration. We are careful in
286 -- GNAT to use the correct terminology and in particular, the full word
287 -- specification is never used as an incorrect substitute for declaration.
288 -- The structure and terminology used in the tree also reflects the grammar
289 -- and thus uses declaration and specification in the technically correct
290 -- manner.
292 -- However, there are contexts in which the informal terminology is useful.
293 -- We have the word "body" to refer to the Interp_Etype declared by the
294 -- declaration of a unit body, and in some contexts we need similar term to
295 -- refer to the entity declared by the package or subprogram declaration,
296 -- and simply using declaration can be confusing since the body also has a
297 -- declaration.
299 -- An example of such a context is the link between the package body and
300 -- its declaration. With_Declaration is confusing, since the package body
301 -- itself is a declaration.
303 -- To deal with this problem, we reserve the informal term Spec, i.e. the
304 -- popular abbreviation used in this context, to refer to the entity
305 -- declared by the package or subprogram declaration. So in the above
306 -- example case, the field in the body is called With_Spec.
308 -- Another important context for the use of the word Spec is in error
309 -- messages, where a hyper-correct use of declaration would be confusing to
310 -- a typical Ada programmer, and even for an expert programmer can cause
311 -- confusion since the body has a declaration as well.
313 -- So, to summarize:
315 -- Declaration always refers to the syntactic entity that is called
316 -- a declaration. In particular, subprogram declaration
317 -- and package declaration are used to describe the
318 -- syntactic entity that includes the semicolon.
320 -- Specification always refers to the syntactic entity that is called
321 -- a specification. In particular, the terms procedure
322 -- specification, function specification, package
323 -- specification, subprogram specification always refer
324 -- to the syntactic entity that has no semicolon.
326 -- Spec is an informal term, used to refer to the entity
327 -- that is declared by a task declaration, protected
328 -- declaration, generic declaration, subprogram
329 -- declaration or package declaration.
331 -- This convention is followed throughout the GNAT documentation
332 -- both internal and external, and in all error message text.
334 ------------------------
335 -- Internal Use Nodes --
336 ------------------------
338 -- These are Node_Kind settings used in the internal implementation which
339 -- are not logically part of the specification.
341 -- N_Unused_At_Start
342 -- Completely unused entry at the start of the enumeration type. This
343 -- is inserted so that no legitimate value is zero, which helps to get
344 -- better debugging behavior, since zero is a likely uninitialized value).
346 -- N_Unused_At_End
347 -- Completely unused entry at the end of the enumeration type. This is
348 -- handy so that arrays with Node_Kind as the index type have an extra
349 -- entry at the end (see for example the use of the Pchar_Pos_Array in
350 -- Treepr, where the extra entry provides the limit value when dealing with
351 -- the last used entry in the array).
353 -----------------------------------------
354 -- Note on the settings of Sloc fields --
355 -----------------------------------------
357 -- The Sloc field of nodes that come from the source is set by the parser.
358 -- For internal nodes, and nodes generated during expansion the Sloc is
359 -- usually set in the call to the constructor for the node. In general the
360 -- Sloc value chosen for an internal node is the Sloc of the source node
361 -- whose processing is responsible for the expansion. For example, the Sloc
362 -- of an inherited primitive operation is the Sloc of the corresponding
363 -- derived type declaration.
365 -- For the nodes of a generic instantiation, the Sloc value is encoded to
366 -- represent both the original Sloc in the generic unit, and the Sloc of
367 -- the instantiation itself. See Sinput.ads for details.
369 -- Subprogram instances create two callable entities: one is the visible
370 -- subprogram instance, and the other is an anonymous subprogram nested
371 -- within a wrapper package that contains the renamings for the actuals.
372 -- Both of these entities have the Sloc of the defining entity in the
373 -- instantiation node. This simplified for instance in the past some ASIS
374 -- queries.
376 -----------------------
377 -- Field Definitions --
378 -----------------------
380 -- In the following node definitions, all fields, both syntactic and
381 -- semantic, are documented. The one exception is in the case of entities
382 -- (defining identifiers, character literals, and operator symbols), where
383 -- the usage of the fields depends on the entity kind. Entity fields are
384 -- fully documented in the separate package Einfo.
386 -- In the node definitions, three common sets of fields are abbreviated to
387 -- save both space in the documentation, and also space in the string
388 -- (defined in Tree_Print_Strings) used to print trees. The following
389 -- abbreviations are used:
391 -- "plus fields for binary operator"
392 -- Chars Name_Id for the operator
393 -- Left_Opnd left operand expression
394 -- Right_Opnd right operand expression
395 -- Entity defining entity for operator
396 -- Associated_Node for generic processing
397 -- Do_Overflow_Check set if overflow check needed
398 -- Has_Private_View set in generic units
399 -- Has_Secondary_Private_View set in generic units
401 -- "plus fields for unary operator"
402 -- Chars Name_Id for the operator
403 -- Right_Opnd right operand expression
404 -- Entity defining entity for operator
405 -- Associated_Node for generic processing
406 -- Do_Overflow_Check set if overflow check needed
407 -- Has_Private_View set in generic units
408 -- Has_Secondary_Private_View set in generic units
410 -- "plus fields for expression"
411 -- Paren_Count number of parentheses levels
412 -- Etype type of the expression
413 -- Is_Overloaded >1 type interpretation exists
414 -- Is_Static_Expression set for static expression
415 -- Raises_Constraint_Error evaluation raises CE
416 -- Must_Not_Freeze set if must not freeze
417 -- Do_Range_Check set if a range check needed
418 -- Has_Dynamic_Length_Check set if length check inserted
419 -- Assignment_OK set if modification is OK
420 -- Is_Controlling_Actual set for controlling argument
422 -- Note: see under (EXPRESSION) for further details on the use of
423 -- the Paren_Count field to record the number of parentheses levels.
425 -- Node_Kind is the type used in the Nkind field to indicate the node kind.
426 -- The actual definition of this type is given later (the reason for this
427 -- is that we want the descriptions ordered by logical chapter in the RM,
428 -- but the type definition is reordered to facilitate the definition of
429 -- some subtype ranges. The individual descriptions of the nodes show how
430 -- the various fields are used in each node kind, as well as providing
431 -- logical names for the fields. Functions and procedures are provided for
432 -- accessing and setting these fields using these logical names.
434 -----------------------
435 -- Gigi Restrictions --
436 -----------------------
438 -- The tree passed to Gigi is more restricted than the general tree form.
439 -- For example, as a result of expansion, most of the tasking nodes can
440 -- never appear. For each node to which either a complete or partial
441 -- restriction applies, a note entitled "Gigi restriction" appears which
442 -- documents the restriction.
444 -- Note that most of these restrictions apply only to trees generated when
445 -- code is being generated, since they involve expander actions that
446 -- destroy the tree.
448 ----------------
449 -- Ghost Mode --
450 ----------------
452 -- The SPARK RM 6.9 defines two classes of constructs - Ghost entities and
453 -- Ghost statements. The intent of the feature is to treat Ghost constructs
454 -- as non-existent when Ghost assertion policy Ignore is in effect.
456 -- The corresponding nodes which map to Ghost constructs are:
458 -- Ghost entities
459 -- Declaration nodes
460 -- N_Package_Body
461 -- N_Subprogram_Body
463 -- Ghost statements
464 -- N_Assignment_Statement
465 -- N_Procedure_Call_Statement
466 -- N_Pragma
468 -- In addition, the compiler treats instantiations as Ghost entities
470 -- To achieve the removal of ignored Ghost constructs, the compiler relies
471 -- on global variables Ghost_Mode and Ignored_Ghost_Region, which comprise
472 -- a mechanism called "Ghost regions".
474 -- The values of Ghost_Mode are as follows:
476 -- 1. Check - All static semantics as defined in SPARK RM 6.9 are in
477 -- effect. The Ghost region has mode Check.
479 -- 2. Ignore - Same as Check, ignored Ghost code is not present in ALI
480 -- files, object files, and the final executable. The Ghost region
481 -- has mode Ignore.
483 -- 3. None - No Ghost region is in effect
485 -- The value of Ignored_Ghost_Region captures the node which initiates an
486 -- ignored Ghost region.
488 -- A Ghost region is a compiler operating mode, similar to Check_Syntax,
489 -- however a region is much more finely grained and depends on the policy
490 -- in effect. The region starts prior to the analysis of a Ghost construct
491 -- and ends immediately after its expansion. The region is established as
492 -- follows:
494 -- 1. Declarations - Prior to analysis, if the declaration is subject to
495 -- pragma Ghost.
497 -- 2. Renaming declarations - Same as 1) or when the renamed entity is
498 -- Ghost.
500 -- 3. Completing declarations - Same as 1) or when the declaration is
501 -- partially analyzed and the declaration completes a Ghost entity.
503 -- 4. N_Package_Body, N_Subprogram_Body - Same as 1) or when the body is
504 -- partially analyzed and completes a Ghost entity.
506 -- 5. N_Assignment_Statement - After the left hand side is analyzed and
507 -- references a Ghost entity.
509 -- 6. N_Procedure_Call_Statement - After the name is analyzed and denotes
510 -- a Ghost procedure.
512 -- 7. N_Pragma - During analysis, when the related entity is Ghost or the
513 -- pragma encloses a Ghost entity.
515 -- 8. Instantiations - Save as 1) or when the instantiation is partially
516 -- analyzed and the generic template is Ghost.
518 -- The following routines install a new Ghost region:
520 -- Install_Ghost_Region
521 -- Mark_And_Set_Ghost_xxx
522 -- Set_Ghost_Mode
524 -- The following routine ends a Ghost region:
526 -- Restore_Ghost_Region
528 -- A region may be reinstalled similarly to scopes for decoupled expansion
529 -- such as the generation of dispatch tables or the creation of a predicate
530 -- function.
532 -- If the mode of a Ghost region is Ignore, any newly created nodes as well
533 -- as source entities are marked as ignored Ghost. In addition, the marking
534 -- process signals all enclosing scopes that an ignored Ghost node resides
535 -- within. The compilation unit where the node resides is also added to an
536 -- auxiliary table for post processing.
538 -- After the analysis and expansion of all compilation units takes place
539 -- as well as the instantiation of all inlined [generic] bodies, the GNAT
540 -- driver initiates a separate pass which removes all ignored Ghost nodes
541 -- from all units stored in the auxiliary table.
543 --------------------
544 -- GNATprove Mode --
545 --------------------
547 -- When a file is compiled in GNATprove mode (-gnatd.F), a very light
548 -- expansion is performed and the analysis must generate a tree in a
549 -- form that meets additional requirements.
551 -- This light expansion does two transformations of the tree that cannot
552 -- be postponed till after semantic analysis:
554 -- 1. Replace object renamings by renamed object. This requires the
555 -- introduction of temporaries at the point of the renaming, which
556 -- must be properly analyzed.
558 -- 2. Fully qualify entity names. This is needed to generate suitable
559 -- local effects and call-graphs in ALI files, with the completely
560 -- qualified names (in particular the suffix to distinguish homonyms).
562 -- The tree after this light expansion should be fully analyzed
563 -- semantically, which sometimes requires the insertion of semantic
564 -- preanalysis, for example for subprogram contracts and pragma
565 -- check/assert. In particular, all expressions must have their proper
566 -- type, and semantic links should be set between tree nodes (partial to
567 -- full view, etc.). Some kinds of nodes should be either absent, or can be
568 -- ignored by the formal verification backend:
570 -- N_Object_Renaming_Declaration: can be ignored safely
571 -- N_Expression_Function: absent (rewritten)
572 -- N_Expression_With_Actions: absent (not generated)
574 -- SPARK cross-references are generated from the regular cross-references
575 -- (used for browsing and code understanding) and additional references
576 -- collected during semantic analysis, in particular on all dereferences.
577 -- These SPARK cross-references are output in a separate section of ALI
578 -- files, as described in spark_xrefs.adb. They are the basis for the
579 -- computation of data dependences in GNATprove. This implies that all
580 -- cross-references should be generated in this mode, even those that would
581 -- not make sense from a user point-of-view, and that cross-references that
582 -- do not lead to data dependences for subprograms can be safely ignored.
584 -- GNATprove relies on the following front end behaviors:
586 -- 1. The first declarations in the list of visible declarations of
587 -- a package declaration for a generic instance, up to the first
588 -- declaration which comes from source, should correspond to
589 -- the "mappings nodes" between formal and actual generic parameters.
591 -- 2. In addition pragma Debug statements are removed from the tree
592 -- (rewritten to NULL stmt), since they should be ignored in formal
593 -- verification.
595 -- 3. An error is also issued for missing subunits, similar to the
596 -- warning issued when generating code, to avoid formal verification
597 -- of a partial unit.
599 -- 4. Unconstrained types are not replaced by constrained types whose
600 -- bounds are generated from an expression: Expand_Subtype_From_Expr
601 -- should be a no-op.
603 -- 5. Errors (instead of warnings) are issued on compile-time-known
604 -- constraint errors even though such cases do not correspond to
605 -- illegalities in the Ada RM (this is simply another case where
606 -- GNATprove implements a subset of the full language).
608 -- However, there are a few exceptions to this rule for cases where
609 -- we want to allow the GNATprove analysis to proceed (e.g. range
610 -- checks on empty ranges, which typically appear in deactivated
611 -- code in a particular configuration).
613 -- 6. Subtypes should match in the AST, even after a generic is
614 -- instantiated. In particular, GNATprove relies on the fact that,
615 -- on a selected component, the type of the selected component is
616 -- the type of the corresponding component in the prefix of the
617 -- selected component.
619 -- Note that, in some cases, we know that this rule is broken by the
620 -- frontend. In particular, if the selected component is a packed
621 -- array depending on a discriminant of a unconstrained formal object
622 -- parameter of a generic.
624 ----------------
625 -- SPARK Mode --
626 ----------------
628 -- The SPARK RM 1.6.5 defines a mode of operation called "SPARK mode" which
629 -- starts a scope where the SPARK language semantics are either On, Off, or
630 -- Auto, where Auto leaves the choice to the tools. A SPARK mode may be
631 -- specified by means of an aspect or a pragma.
633 -- The following entities may be subject to a SPARK mode. Entities marked
634 -- with * may possess two different SPARK modes.
636 -- E_Entry
637 -- E_Entry_Family
638 -- E_Function
639 -- E_Generic_Function
640 -- E_Generic_Package *
641 -- E_Generic_Procedure
642 -- E_Operator
643 -- E_Package *
644 -- E_Package_Body *
645 -- E_Procedure
646 -- E_Protected_Body
647 -- E_Protected_Subtype
648 -- E_Protected_Type *
649 -- E_Subprogram_Body
650 -- E_Task_Body
651 -- E_Task_Subtype
652 -- E_Task_Type *
653 -- E_Variable
655 -- In order to manage SPARK scopes, the compiler relies on global variables
656 -- SPARK_Mode and SPARK_Mode_Pragma and a mechanism called "SPARK regions."
657 -- Routines Install_SPARK_Mode and Set_SPARK_Mode create a new SPARK region
658 -- and routine Restore_SPARK_Mode ends a SPARK region. A region may be
659 -- reinstalled similarly to scopes.
661 -----------------------
662 -- Check Flag Fields --
663 -----------------------
665 -- The following flag fields appear in expression nodes:
667 -- Do_Division_Check
668 -- Do_Overflow_Check
669 -- Do_Range_Check
671 -- These three flags are always set by the front end during semantic
672 -- analysis, on expression nodes that may trigger the corresponding
673 -- check. The front end then inserts or not the check during expansion. In
674 -- particular, these flags should also be correctly set in GNATprove mode.
675 -- As a special case, the front end does not insert a Do_Division_Check
676 -- flag on float exponentiation expressions, for the case where the value
677 -- is 0.0 and the exponent is negative, although this case does lead to a
678 -- division check failure. As another special case, the front end does not
679 -- insert a Do_Range_Check on an allocator where the designated type is
680 -- scalar, and the designated type is more constrained than the type of the
681 -- initialized allocator value or the type of the default value for an
682 -- uninitialized allocator.
684 -- Note that the expander always takes care of the Do_Range_Check case, so
685 -- this flag will never be set in the expanded tree passed to the back end.
686 -- For the other two flags, the check can be generated either by the back
687 -- end or by the front end, depending on the setting of a target parameter.
689 -- Note that this accounts for all nodes that trigger the corresponding
690 -- checks, except for range checks on subtype_indications, which may be
691 -- required to check that a range_constraint is compatible with the given
692 -- subtype (RM 3.2.2(11)).
694 -- The following flag fields appear in various nodes:
696 -- Do_Discriminant_Check
697 -- Do_Length_Check
698 -- Do_Storage_Check
700 -- These flags are used in some specific cases by the front end, either
701 -- during semantic analysis or during expansion, and cannot be expected
702 -- to be set on all nodes that trigger the corresponding check.
704 ------------------------
705 -- Common Flag Fields --
706 ------------------------
708 -- The following flag fields appear in all nodes:
710 -- Analyzed
711 -- This flag is used to indicate that a node (and all its children) have
712 -- been analyzed. It is used to avoid reanalysis of a node that has
713 -- already been analyzed, both for efficiency and functional correctness
714 -- reasons.
716 -- Comes_From_Source
717 -- This flag is set if the node comes directly from an explicit construct
718 -- in the source. It is normally on for any nodes built by the scanner or
719 -- parser from the source program, with the exception that in a few cases
720 -- the parser adds nodes to normalize the representation (in particular,
721 -- a null statement is added to a package body if there is no begin/end
722 -- initialization section).
724 -- Most nodes inserted by the analyzer or expander are not considered
725 -- as coming from source, so the flag is off for such nodes. In a few
726 -- cases, the expander constructs nodes closely equivalent to nodes
727 -- from the source program (e.g. the allocator built for build-in-place
728 -- case), and the Comes_From_Source flag is deliberately set.
730 -- Error_Posted
731 -- This flag is used to avoid multiple error messages being posted on or
732 -- referring to the same node. This flag is set if an error message
733 -- refers to a node or is posted on its source location, and has the
734 -- effect of inhibiting further messages involving this same node.
736 -----------------------
737 -- Modify_Tree_For_C --
738 -----------------------
740 -- If the flag Opt.Modify_Tree_For_C is set True, then the tree is modified
741 -- in ways that help match the semantics better with C, easing the task of
742 -- interfacing to C code generators (other than GCC, where the work is done
743 -- in gigi, and there is no point in changing that), and also making life
744 -- easier for Cprint in generating C source code.
746 -- The current modifications implemented are as follows:
748 -- N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic nodes
749 -- are eliminated from the tree (since these operations do not exist in
750 -- C), and the operations are rewritten in terms of logical shifts and
751 -- other logical operations that do exist in C. See Exp_Ch4 expansion
752 -- routines for these operators for details of the transformations made.
754 -- The right operand of N_Op_Shift_Right and N_Op_Shift_Left is always
755 -- less than the word size (since other values are not well-defined in
756 -- C). This is done using an explicit test if necessary.
758 -- Min and Max attributes are expanded into equivalent if expressions,
759 -- dealing properly with side effect issues.
761 -- Mod for signed integer types is expanded into equivalent expressions
762 -- using Rem (which is % in C) and other C-available operators.
764 -- Functions returning bounded arrays are transformed into procedures
765 -- with an extra out parameter, and the calls updated accordingly.
767 -- Aggregates are only kept unexpanded for object declarations, otherwise
768 -- they are systematically expanded into loops (for arrays) and
769 -- individual assignments (for records).
771 -- Unconstrained array types are handled by means of fat pointers.
773 -- Postconditions are inlined by the frontend since their body may have
774 -- references to itypes defined in the enclosing subprogram.
776 ------------------------------------
777 -- Description of Semantic Fields --
778 ------------------------------------
780 -- The meaning of the syntactic fields is generally clear from their names
781 -- without any further description, since the names are chosen to
782 -- correspond very closely to the syntax in the reference manual. This
783 -- section describes the usage of the semantic fields, which are used to
784 -- contain additional information determined during semantic analysis.
786 -- Accept_Handler_Records
787 -- This field is present only in an N_Accept_Alternative node. It is used
788 -- to temporarily hold the exception handler records from an accept
789 -- statement in a selective accept. These exception handlers will
790 -- eventually be placed in the Handler_Records list of the procedure
791 -- built for this accept (see Expand_N_Selective_Accept procedure in
792 -- Exp_Ch9 for further details).
794 -- Access_Types_To_Process
795 -- Present in N_Freeze_Entity nodes for Incomplete or private types.
796 -- Contains the list of access types which may require specific treatment
797 -- when the nature of the type completion is completely known. An example
798 -- of such treatment is the generation of the associated_final_chain.
800 -- Actions
801 -- This field contains a sequence of actions that are associated with the
802 -- node holding the field. See the individual node types for details of
803 -- how this field is used, as well as the description of the specific use
804 -- for a particular node type.
806 -- Activation_Chain_Entity
807 -- This is used in tree nodes representing task activators (blocks,
808 -- subprogram bodies, package declarations, and task bodies). It is
809 -- initially Empty, and then gets set to point to the entity for the
810 -- declared Activation_Chain variable when the first task is declared.
811 -- When tasks are declared in the corresponding declarative region this
812 -- entity is located by name (its name is always _Chain) and the declared
813 -- tasks are added to the chain. Note that N_Extended_Return_Statement
814 -- does not have this attribute, although it does have an activation
815 -- chain. This chain is used to store the tasks temporarily, and is not
816 -- used for activating them. On successful completion of the return
817 -- statement, the tasks are moved to the caller's chain, and the caller
818 -- activates them.
820 -- Acts_As_Spec
821 -- A flag set in the N_Subprogram_Body node for a subprogram body which
822 -- is acting as its own spec. In the case of a library-level subprogram
823 -- the flag is set as well on the parent compilation unit node.
825 -- Actual_Designated_Subtype
826 -- Present in N_Free_Statement and N_Explicit_Dereference nodes. If gigi
827 -- needs to know the dynamic constrained subtype of the designated
828 -- object, this attribute is set to that subtype. This is done for
829 -- N_Free_Statements for access-to-classwide types and access-to-
830 -- unconstrained packed array types. For N_Explicit_Dereference,
831 -- this is done in two circumstances: 1) when the designated type is
832 -- an unconstrained packed array and the dereference is the prefix of
833 -- a 'Size attribute reference, or 2) when the dereference node is
834 -- created for the expansion of an allocator with a subtype_indication
835 -- and the designated subtype is an unconstrained composite type.
837 -- Address_Warning_Posted
838 -- Present in N_Attribute_Definition nodes. Set to indicate that we have
839 -- posted a warning for the address clause regarding size or alignment
840 -- issues. Used to inhibit multiple redundant messages.
842 -- Aggregate_Bounds
843 -- Present in array N_Aggregate nodes. If the bounds of the aggregate are
844 -- known at compile time, this field points to an N_Range node with those
845 -- bounds. Otherwise Empty.
847 -- All_Others
848 -- Present in an N_Others_Choice node. This flag is set for an others
849 -- exception where all exceptions are to be caught, even those that are
850 -- not normally handled (in particular the tasking abort signal). This
851 -- is used for translation of the at end handler into a normal exception
852 -- handler.
854 -- Aspect_On_Partial_View
855 -- Present on an N_Aspect_Specification node. For an aspect that applies
856 -- to a type entity, indicates whether the specification appears on the
857 -- partial view of a private type or extension. Undefined for aspects
858 -- that apply to other entities.
860 -- Aspect_Rep_Item
861 -- Present in N_Aspect_Specification nodes. Points to the corresponding
862 -- pragma/attribute definition node used to process the aspect.
864 -- Assignment_OK
865 -- This flag is set in a subexpression node for an object, indicating
866 -- that the associated object can be modified, even if this would not
867 -- normally be permissible (either by direct assignment, or by being
868 -- passed as an out or in-out parameter). This is used by the expander
869 -- for a number of purposes, including initialization of constants and
870 -- limited type objects (such as tasks), setting discriminant fields,
871 -- setting tag values, etc. N_Object_Declaration nodes also have this
872 -- flag defined. Here it is used to indicate that an initialization
873 -- expression is valid, even where it would normally not be allowed
874 -- (e.g. where the type involved is limited). It is also used to stop
875 -- a Force_Evaluation call for an unchecked conversion, but this usage
876 -- is unclear and not documented ???
878 -- Associated_Node
879 -- Present in nodes that can denote an entity: identifiers, character
880 -- literals, operator symbols, expanded names, operator nodes, and
881 -- attribute reference nodes (all these nodes have an Entity field).
882 -- This field is also present in N_Aggregate, N_Selected_Component, and
883 -- N_Extension_Aggregate nodes. This field is used in generic processing
884 -- to create links between the generic template and the generic copy.
885 -- See Sem_Ch12.Get_Associated_Node for full details. Note that this
886 -- field overlaps Entity, which is fine, since, as explained in Sem_Ch12,
887 -- the normal function of Entity is not required at the point where the
888 -- Associated_Node is set. Note also, that in generic templates, this
889 -- means that the Entity field does not necessarily point to an Entity.
890 -- Since the back end is expected to ignore generic templates, this is
891 -- harmless.
893 -- Atomic_Sync_Required
894 -- This flag is set on a node for which atomic synchronization is
895 -- required for the corresponding reference or modification.
897 -- At_End_Proc
898 -- This field is present in N_Handled_Sequence_Of_Statements,
899 -- N_Package_Body, N_Subprogram_Body, N_Task_Body, N_Block_Statement,
900 -- and N_Entry_Body.
901 -- It contains an identifier reference for the cleanup procedure to be
902 -- called. See description of N_Handled_Sequence_Of_Statements node
903 -- for further details.
905 -- Backwards_OK
906 -- A flag present in the N_Assignment_Statement node. It is used only
907 -- if the type being assigned is an array type, and is set if analysis
908 -- determines that it is definitely safe to do the copy backwards, i.e.
909 -- starting at the highest addressed element. This is the case if either
910 -- the operands do not overlap, or they may overlap, but if they do,
911 -- then the left operand is at a higher address than the right operand.
913 -- Note: If neither of the flags Forwards_OK or Backwards_OK is set, it
914 -- means that the front end could not determine that either direction is
915 -- definitely safe, and a runtime check may be required if the backend
916 -- cannot figure it out. If both flags Forwards_OK and Backwards_OK are
917 -- set, it means that the front end can assure no overlap of operands.
919 -- Body_To_Inline
920 -- Present in subprogram declarations. Denotes analyzed but unexpanded
921 -- body of subprogram, to be used when inlining calls. Present when the
922 -- subprogram has an Inline pragma and inlining is enabled. If the
923 -- declaration is completed by a renaming_as_body, and the renamed entity
924 -- is a subprogram, the Body_To_Inline is the name of that entity, which
925 -- is used directly in later calls to the original subprogram.
927 -- Body_Required
928 -- A flag that appears in the N_Compilation_Unit node indicating that
929 -- the corresponding unit requires a body. For the package case, this
930 -- indicates that a completion is required. In Ada 95, if the flag is not
931 -- set for the package case, then a body may not be present. In Ada 83,
932 -- if the flag is not set for the package case, then body is optional.
933 -- For a subprogram declaration, the flag is set except in the case where
934 -- a pragma Import or Interface applies, in which case no body is
935 -- permitted (in Ada 83 or Ada 95).
937 -- Cannot_Be_Superflat
938 -- This flag is present in N_Range nodes. It is set if the range is of a
939 -- discrete type and cannot be superflat, i.e. it is guaranteed that the
940 -- inequality High_Bound >= Low_Bound - 1 is true. At the time of this
941 -- writing, it is only used by the code generator to streamline things.
943 -- Cleanup_Actions
944 -- Present in block statements created for transient blocks, contains
945 -- additional cleanup actions carried over from the transient scope.
947 -- Check_Address_Alignment
948 -- A flag present in N_Attribute_Definition clause for a 'Address
949 -- attribute definition. This flag is set if a dynamic check should be
950 -- generated at the freeze point for the entity to which this address
951 -- clause applies. The reason that we need this flag is that we want to
952 -- check for range checks being suppressed at the point where the
953 -- attribute definition clause is given, rather than testing this at the
954 -- freeze point.
956 -- Comes_From_Extended_Return_Statement
957 -- Present in N_Simple_Return_Statement nodes. True if this node was
958 -- constructed as part of the N_Extended_Return_Statement expansion.
960 -- Comes_From_Iterator
961 -- Present in N_Object_Renaming_Declaration nodes. True if this node was
962 -- was constructed as part of the expansion of an iterator
963 -- specification.
965 -- Compile_Time_Known_Aggregate
966 -- Present in N_Aggregate nodes. Set for aggregates which can be fully
967 -- evaluated at compile time without raising constraint error. Such
968 -- aggregates can be passed as is to the back end without any expansion.
969 -- See Exp_Aggr for specific conditions under which this flag gets set.
971 -- Componentwise_Assignment
972 -- Present in N_Assignment_Statement nodes. Set for a record assignment
973 -- where all that needs doing is to expand it into component-by-component
974 -- assignments. This is used internally for the case of tagged types with
975 -- rep clauses, where we need to avoid recursion (we don't want to try to
976 -- generate a call to the primitive operation, because this is the case
977 -- where we are compiling the primitive operation). Note that when we are
978 -- expanding component assignments in this case, we never assign the _tag
979 -- field, but we recursively assign components of the parent type.
981 -- Condition_Actions
982 -- This field appears in else-if nodes and in the iteration scheme node
983 -- for while loops. This field is only used during semantic processing to
984 -- temporarily hold actions inserted into the tree. In the tree passed
985 -- to gigi, the condition actions field is always set to No_List. For
986 -- details on how this field is used, see the routine Insert_Actions in
987 -- package Exp_Util, and also the expansion routines for the relevant
988 -- nodes.
990 -- Context_Pending
991 -- This field appears in Compilation_Unit nodes, to indicate that the
992 -- context of the unit is being compiled. Used to detect circularities
993 -- that are not otherwise detected by the loading mechanism. Such
994 -- circularities can occur in the presence of limited and non-limited
995 -- with_clauses that mention the same units.
997 -- Controlling_Argument
998 -- This field is set in procedure and function call nodes if the call
999 -- is a dispatching call (it is Empty for a non-dispatching call). It
1000 -- indicates the source of the call's controlling tag. For procedure
1001 -- calls, the Controlling_Argument is one of the actuals. For function
1002 -- that has a dispatching result, it is an entity in the context of the
1003 -- call that can provide a tag, or else it is the tag of the root type
1004 -- of the class. It can also specify a tag directly rather than being a
1005 -- tagged object. The latter is needed by the implementations of AI-239
1006 -- and AI-260.
1008 -- Conversion_OK
1009 -- A flag set on type conversion nodes to indicate that the conversion
1010 -- is to be considered as being valid, even though it is the case that
1011 -- the conversion is not valid Ada. This is used for attributes Enum_Rep,
1012 -- Pos, Val, Fixed_Value and Integer_Value, for internal conversions done
1013 -- for fixed-point operations, and for certain conversions for calls to
1014 -- initialization procedures. If Conversion_OK is set, then Etype must be
1015 -- set (the analyzer assumes that Etype has been set). For the case of
1016 -- fixed-point operands, it also indicates that the conversion is to be
1017 -- direct conversion of the underlying integer result, with no regard to
1018 -- the small operand.
1020 -- Corresponding_Aspect
1021 -- Present in N_Pragma node. Used to point back to the source aspect from
1022 -- the corresponding pragma. This field is Empty for source pragmas.
1024 -- Corresponding_Body
1025 -- This field is set in subprogram declarations, package declarations,
1026 -- entry declarations of protected types, and in generic units. It points
1027 -- to the defining entity for the corresponding body (NOT the node for
1028 -- the body itself).
1030 -- Corresponding_Entry_Body
1031 -- Defined in N_Subprogram_Body. Set for subprogram bodies that implement
1032 -- a protected type entry; points to the body for the entry.
1034 -- Corresponding_Formal_Spec
1035 -- This field is set in subprogram renaming declarations, where it points
1036 -- to the defining entity for a formal subprogram in the case where the
1037 -- renaming corresponds to a generic formal subprogram association in an
1038 -- instantiation. The field is Empty if the renaming does not correspond
1039 -- to such a formal association.
1041 -- Corresponding_Generic_Association
1042 -- This field is defined for object declarations and object renaming
1043 -- declarations. It is set for the declarations within an instance that
1044 -- map generic formals to their actuals. If set, the field points either
1045 -- to a copy of a default expression for an actual of mode IN or to a
1046 -- generic_association which is the original parent of the expression or
1047 -- name appearing in the declaration. This simplifies GNATprove queries.
1049 -- Corresponding_Integer_Value
1050 -- This field is set in real literals of fixed-point types (it is not
1051 -- used for floating-point types). It contains the integer value used
1052 -- to represent the fixed-point value. It is also set on the universal
1053 -- real literals used to represent bounds of fixed-point base types
1054 -- and their first named subtypes.
1056 -- Corresponding_Spec
1057 -- This field is set in subprogram, package, task, entry and protected
1058 -- body nodes where it points to the defining entity in the corresponding
1059 -- spec. The attribute is also set in N_With_Clause nodes where it points
1060 -- to the defining entity for the with'ed spec, and in a subprogram
1061 -- renaming declaration when it is a Renaming_As_Body. The field is Empty
1062 -- if there is no corresponding spec, as in the case of a subprogram body
1063 -- that serves as its own spec.
1065 -- In Ada 2012, Corresponding_Spec is set on expression functions that
1066 -- complete a subprogram declaration.
1068 -- Corresponding_Spec_Of_Stub
1069 -- This field is present in subprogram, package, task, and protected body
1070 -- stubs where it points to the corresponding spec of the stub. Due to
1071 -- clashes in the structure of nodes, we cannot use Corresponding_Spec.
1073 -- Corresponding_Stub
1074 -- This field is present in an N_Subunit node. It holds the node in
1075 -- the parent unit that is the stub declaration for the subunit. It is
1076 -- set when analysis of the stub forces loading of the proper body. If
1077 -- expansion of the proper body creates new declarative nodes, they are
1078 -- inserted at the point of the corresponding_stub.
1080 -- Dcheck_Function
1081 -- This field is present in an N_Variant node, It references the entity
1082 -- for the discriminant checking function for the variant.
1084 -- Default_Expression
1085 -- This field is Empty if there is no default expression. If there is a
1086 -- simple default expression (one with no side effects), then this field
1087 -- simply contains a copy of the Expression field (both point to the tree
1088 -- for the default expression). Default_Expression is used for
1089 -- conformance checking.
1091 -- Default_Storage_Pool
1092 -- This field is present in N_Compilation_Unit_Aux nodes. It is set to a
1093 -- copy of Opt.Default_Pool at the end of the compilation unit. See
1094 -- package Opt for details. This is used for inheriting the
1095 -- Default_Storage_Pool in child units.
1097 -- Discr_Check_Funcs_Built
1098 -- This flag is present in N_Full_Type_Declaration nodes. It is set when
1099 -- discriminant checking functions are constructed. The purpose is to
1100 -- avoid attempting to set these functions more than once.
1102 -- Do_Discriminant_Check
1103 -- This flag is set on N_Selected_Component nodes to indicate that a
1104 -- discriminant check is required using the discriminant check routine
1105 -- associated with the selector. The actual check is generated by the
1106 -- expander when processing selected components. In the case of
1107 -- Unchecked_Union, the flag is also set, but no discriminant check
1108 -- routine is associated with the selector, and the expander does not
1109 -- generate a check. This flag is also present in assignment statements
1110 -- (and set if the assignment requires a discriminant check), and in type
1111 -- conversion nodes (and set if the conversion requires a check).
1113 -- Do_Division_Check
1114 -- This flag is set on a division operator (/ mod rem) to indicate that
1115 -- a zero divide check is required. The actual check is either dealt with
1116 -- by the back end if Backend_Divide_Checks is set to true, or by the
1117 -- front end itself if it is set to false.
1119 -- Do_Length_Check
1120 -- This flag is set in an N_Assignment_Statement, N_Op_And, N_Op_Or,
1121 -- N_Op_Xor, or N_Type_Conversion node to indicate that a length check
1122 -- is required. It is not determined who deals with this flag (???).
1124 -- Do_Overflow_Check
1125 -- This flag is set on an operator where an overflow check is required on
1126 -- the operation. The actual check is either dealt with by the back end
1127 -- if Backend_Overflow_Checks is set to true, or by the front end itself
1128 -- if it is set to false. The other cases where this flag is used is on a
1129 -- Type_Conversion node as well on if and case expression nodes.
1130 -- For a type conversion, it means that the conversion is from one base
1131 -- type to another, and the value may not fit in the target base type.
1132 -- See also the description of Do_Range_Check for this case. This flag is
1133 -- also set on if and case expression nodes if we are operating in either
1134 -- MINIMIZED or ELIMINATED overflow checking mode (to make sure that we
1135 -- properly process overflow checking for dependent expressions).
1137 -- Do_Range_Check
1138 -- This flag is set on an expression which appears in a context where a
1139 -- range check is required. The target type is clear from the context.
1140 -- The contexts in which this flag can appear are the following:
1142 -- Right side of an assignment. In this case the target type is taken
1143 -- from the left side of the assignment, which is referenced by the
1144 -- Name of the N_Assignment_Statement node.
1146 -- Subscript expressions in an indexed component. In this case the
1147 -- target type is determined from the type of the array, which is
1148 -- referenced by the Prefix of the N_Indexed_Component node.
1150 -- Argument expression for a parameter, appearing either directly in
1151 -- the Parameter_Associations list of a call or as the Expression of an
1152 -- N_Parameter_Association node that appears in this list. In either
1153 -- case, the check is against the type of the formal. Note that the
1154 -- flag is relevant only in IN and IN OUT parameters, and will be
1155 -- ignored for OUT parameters, where no check is required in the call,
1156 -- and if a check is required on the return, it is generated explicitly
1157 -- with a type conversion.
1159 -- Initialization expression for the initial value in an object
1160 -- declaration. In this case the Do_Range_Check flag is set on
1161 -- the initialization expression, and the check is against the
1162 -- range of the type of the object being declared. This includes the
1163 -- cases of expressions providing default discriminant values, and
1164 -- expressions used to initialize record components.
1166 -- The expression of a type conversion. In this case the range check is
1167 -- against the target type of the conversion. See also the use of
1168 -- Do_Overflow_Check on a type conversion. The distinction is that the
1169 -- overflow check protects against a value that is outside the range of
1170 -- the target base type, whereas a range check checks that the
1171 -- resulting value (which is a value of the base type of the target
1172 -- type), satisfies the range constraint of the target type.
1174 -- Note: when a range check is required in contexts other than those
1175 -- listed above (e.g. in a return statement), an additional type
1176 -- conversion node is introduced to represent the required check.
1178 -- Do_Storage_Check
1179 -- This flag is set in an N_Allocator node to indicate that a storage
1180 -- check is required for the allocation, or in an N_Subprogram_Body node
1181 -- to indicate that a stack check is required in the subprogram prologue.
1182 -- The N_Allocator case is handled by the routine that expands the call
1183 -- to the runtime routine. The N_Subprogram_Body case is handled by the
1184 -- backend, and all the semantics does is set the flag.
1186 -- Elaborate_Present
1187 -- This flag is set in the N_With_Clause node to indicate that pragma
1188 -- Elaborate pragma appears for the with'ed units.
1190 -- Elaborate_All_Desirable
1191 -- This flag is set in the N_With_Clause mode to indicate that the static
1192 -- elaboration processing has determined that an Elaborate_All pragma is
1193 -- desirable for correct elaboration for this unit.
1195 -- Elaborate_All_Present
1196 -- This flag is set in the N_With_Clause node to indicate that a
1197 -- pragma Elaborate_All pragma appears for the with'ed units.
1199 -- Elaborate_Desirable
1200 -- This flag is set in the N_With_Clause mode to indicate that the static
1201 -- elaboration processing has determined that an Elaborate pragma is
1202 -- desirable for correct elaboration for this unit.
1204 -- Else_Actions
1205 -- This field is present in if expression nodes. During code
1206 -- expansion we use the Insert_Actions procedure (in Exp_Util) to insert
1207 -- actions at an appropriate place in the tree to get elaborated at the
1208 -- right time. For if expressions, we have to be sure that the actions
1209 -- for the Else branch are only elaborated if the condition is False.
1210 -- The Else_Actions field is used as a temporary parking place for
1211 -- these actions. The final tree is always rewritten to eliminate the
1212 -- need for this field, so in the tree passed to Gigi, this field is
1213 -- always set to No_List.
1215 -- Enclosing_Variant
1216 -- This field is present in the N_Variant node and identifies the Node_Id
1217 -- corresponding to the immediately enclosing variant when the variant is
1218 -- nested, and N_Empty otherwise. Set during semantic processing of the
1219 -- variant part of a record type.
1221 -- Entity
1222 -- Appears in all direct names (identifiers, character literals, and
1223 -- operator symbols), as well as expanded names, and attributes that
1224 -- denote entities, such as 'Class. Points to entity for corresponding
1225 -- defining occurrence. Set after name resolution. For identifiers in a
1226 -- WITH list, the corresponding defining occurrence is in a separately
1227 -- compiled file, and Entity must be set by the library Load procedure.
1229 -- Note: During name resolution, the value in Entity may be temporarily
1230 -- incorrect (e.g. during overload resolution, Entity is initially set to
1231 -- the first possible correct interpretation, and then later modified if
1232 -- necessary to contain the correct value after resolution).
1234 -- Note: This field overlaps Associated_Node, which is used during
1235 -- generic processing (see Sem_Ch12 for details). Note also that in
1236 -- generic templates, this means that the Entity field does not always
1237 -- point to an Entity. Since the back end is expected to ignore generic
1238 -- templates, this is harmless.
1240 -- Note: This field also appears in N_Attribute_Definition_Clause nodes.
1241 -- It is used only for stream attributes definition clauses. In this
1242 -- case, it denotes a (possibly dummy) subprogram entity that is declared
1243 -- conceptually at the point of the clause. Thus the visibility of the
1244 -- attribute definition clause (in the sense of 8.3(23) as amended by
1245 -- AI-195) can be checked by testing the visibility of that subprogram.
1247 -- Note: Normally the Entity field of an identifier points to the entity
1248 -- for the corresponding defining identifier, and hence the Chars field
1249 -- of an identifier will match the Chars field of the entity. However,
1250 -- there is no requirement that these match, and there are obscure cases
1251 -- of generated code where they do not match.
1253 -- Note: Ada 2012 aspect specifications require additional links between
1254 -- identifiers and various attributes. These attributes can be of
1255 -- arbitrary types, and the entity field of identifiers that denote
1256 -- aspects must be used to store arbitrary expressions for later semantic
1257 -- checks. See section on aspect specifications for details.
1259 -- Entity_Or_Associated_Node
1260 -- A synonym for both Entity and Associated_Node. Used by convention in
1261 -- the code when referencing this field in cases where it is not known
1262 -- whether the field contains an Entity or an Associated_Node.
1264 -- Etype
1265 -- Appears in all expression nodes, all direct names, and all entities.
1266 -- Points to the entity for the related type. Set after type resolution.
1267 -- Normally this is the actual subtype of the expression. However, in
1268 -- certain contexts such as the right side of an assignment, subscripts,
1269 -- arguments to calls, returned value in a function, initial value etc.
1270 -- it is the desired target type. In the event that this is different
1271 -- from the actual type, the Do_Range_Check flag will be set if a range
1272 -- check is required. Note: if the Is_Overloaded flag is set, then Etype
1273 -- points to an essentially arbitrary choice from the possible set of
1274 -- types.
1276 -- Exception_Junk
1277 -- This flag is set in a various nodes appearing in a statement sequence
1278 -- to indicate that the corresponding node is an artifact of the
1279 -- generated code for exception handling, and should be ignored when
1280 -- analyzing the control flow of the relevant sequence of statements
1281 -- (e.g. to check that it does not end with a bad return statement).
1283 -- Exception_Label
1284 -- Appears in N_Push_xxx_Label nodes. Points to the entity of the label
1285 -- to be used for transforming the corresponding exception into a goto,
1286 -- or contains Empty, if this exception is not to be transformed. Also
1287 -- appears in N_Exception_Handler nodes, where, if set, it indicates
1288 -- that there may be a local raise for the handler, so that expansion
1289 -- to allow a goto is required (and this field contains the label for
1290 -- this goto). See Exp_Ch11.Expand_Local_Exception_Handlers for details.
1292 -- Expansion_Delayed
1293 -- Set on aggregates and extension aggregates that need a top-down rather
1294 -- than bottom-up expansion. Typically aggregate expansion happens bottom
1295 -- up. For nested aggregates the expansion is delayed until the enclosing
1296 -- aggregate itself is expanded, e.g. in the context of a declaration. To
1297 -- delay it we set this flag. This is done to avoid creating a temporary
1298 -- for each level of a nested aggregate, and also to prevent the
1299 -- premature generation of constraint checks. This is also a requirement
1300 -- if we want to generate the proper attachment to the internal
1301 -- finalization lists (for record with controlled components). Top down
1302 -- expansion of aggregates is also used for in-place array aggregate
1303 -- assignment or initialization. When the full context is known, the
1304 -- target of the assignment or initialization is used to generate the
1305 -- left-hand side of individual assignment to each subcomponent.
1307 -- Expression_Copy
1308 -- Present in N_Pragma_Argument_Association nodes. Contains a copy of the
1309 -- original expression. This field is best used to store pragma-dependent
1310 -- modifications performed on the original expression such as replacement
1311 -- of the current type instance or substitutions of primitives.
1313 -- First_Inlined_Subprogram
1314 -- Present in the N_Compilation_Unit node for the main program. Points
1315 -- to a chain of entities for subprograms that are to be inlined. The
1316 -- Next_Inlined_Subprogram field of these entities is used as a link
1317 -- pointer with Empty marking the end of the list. This field is Empty
1318 -- if there are no inlined subprograms or inlining is not active.
1320 -- First_Named_Actual
1321 -- Present in procedure call statement and function call nodes, and also
1322 -- in Intrinsic nodes. Set during semantic analysis to point to the first
1323 -- named parameter where parameters are ordered by declaration order (as
1324 -- opposed to the actual order in the call which may be different due to
1325 -- named associations). Note: this field points to the explicit actual
1326 -- parameter itself, not the N_Parameter_Association node (its parent).
1328 -- First_Subtype_Link
1329 -- Present in N_Freeze_Entity node for an anonymous base type that is
1330 -- implicitly created by the declaration of a first subtype. It points
1331 -- to the entity for the first subtype.
1333 -- Float_Truncate
1334 -- A flag present in type conversion nodes. It is used for floating-point
1335 -- to fixed-point or integer conversions, where truncation is required
1336 -- rather than rounding.
1338 -- Forwards_OK
1339 -- A flag present in the N_Assignment_Statement node. It is used only
1340 -- if the type being assigned is an array type, and is set if analysis
1341 -- determines that it is definitely safe to do the copy forwards, i.e.
1342 -- starting at the lowest addressed element. This is the case if either
1343 -- the operands do not overlap, or they may overlap, but if they do,
1344 -- then the left operand is at a lower address than the right operand.
1346 -- Note: If neither of the flags Forwards_OK or Backwards_OK is set, it
1347 -- means that the front end could not determine that either direction is
1348 -- definitely safe, and a runtime check may be required if the backend
1349 -- cannot figure it out. If both flags Forwards_OK and Backwards_OK are
1350 -- set, it means that the front end can assure no overlap of operands.
1352 -- For_Special_Return_Object
1353 -- Present in N_Allocator nodes. True if the allocator is generated for
1354 -- the initialization of a special return object.
1356 -- From_Aspect_Specification
1357 -- Processing of aspect specifications typically results in insertion in
1358 -- the tree of corresponding pragma or attribute definition clause nodes.
1359 -- These generated nodes have the From_Aspect_Specification flag set to
1360 -- indicate that they came from aspect specifications originally.
1362 -- From_At_Mod
1363 -- This flag is set on the attribute definition clause node that is
1364 -- generated by a transformation of an at mod phrase in a record
1365 -- representation clause. This is used to give slightly different (Ada 83
1366 -- compatible) semantics to such a clause, namely it is used to specify a
1367 -- minimum acceptable alignment for the base type and all subtypes. In
1368 -- Ada 95 terms, the actual alignment of the base type and all subtypes
1369 -- must be a multiple of the given value, and the representation clause
1370 -- is considered to be type specific instead of subtype specific.
1372 -- From_Conditional_Expression
1373 -- This flag is set on if and case statements generated by the expansion
1374 -- of if and case expressions respectively. The flag is used to suppress
1375 -- any finalization of controlled objects found within these statements.
1377 -- From_Default
1378 -- This flag is set on the subprogram renaming declaration created in an
1379 -- instance for a formal subprogram, when the formal is declared with a
1380 -- box, and there is no explicit actual. If the flag is present, the
1381 -- declaration is treated as an implicit reference to the formal in the
1382 -- ali file.
1384 -- Generalized_Indexing
1385 -- Present in N_Indexed_Component nodes. Set for Indexed_Component nodes
1386 -- that are Ada 2012 container indexing operations. The value of the
1387 -- attribute is a function call (possibly dereferenced) that corresponds
1388 -- to the proper expansion of the source indexing operation. Before
1389 -- expansion, the source node is rewritten as the resolved generalized
1390 -- indexing.
1392 -- Generic_Parent
1393 -- Generic_Parent is defined on declaration nodes that are instances. The
1394 -- value of Generic_Parent is the generic entity from which the instance
1395 -- is obtained.
1397 -- Generic_Parent_Type
1398 -- Generic_Parent_Type is defined on Subtype_Declaration nodes for the
1399 -- actuals of formal private and derived types. Within the instance, the
1400 -- operations on the actual are those inherited from the parent. For a
1401 -- formal private type, the parent type is the generic type itself. The
1402 -- Generic_Parent_Type is also used in an instance to determine whether a
1403 -- private operation overrides an inherited one.
1405 -- Handler_List_Entry
1406 -- This field is present in N_Object_Declaration nodes. It is set only
1407 -- for the Handler_Record entry generated for an exception in zero cost
1408 -- exception handling mode. It references the corresponding item in the
1409 -- handler list, and is used to delete this entry if the corresponding
1410 -- handler is deleted during optimization. For further details on why
1411 -- this is required, see Exp_Ch11.Remove_Handler_Entries.
1413 -- Has_Dereference_Action
1414 -- This flag is present in N_Explicit_Dereference nodes. It is set to
1415 -- indicate that the expansion has aready produced a call to primitive
1416 -- Dereference of a System.Checked_Pools.Checked_Pool implementation.
1417 -- Such dereference actions are produced for debugging purposes.
1419 -- Has_Dynamic_Length_Check
1420 -- This flag is present in all expression nodes. It is set to indicate
1421 -- that one of the routines in unit Checks has generated a length check
1422 -- action which has been inserted at the flagged node. This is used to
1423 -- avoid the generation of duplicate checks.
1425 -- Has_Local_Raise
1426 -- Present in exception handler nodes. Set if the handler can be entered
1427 -- via a local raise that gets transformed to a goto statement. This will
1428 -- always be set if Local_Raise_Statements is non-empty, but can also be
1429 -- set as a result of generation of N_Raise_xxx nodes, or flags set in
1430 -- nodes requiring generation of back end checks.
1432 -- Has_No_Elaboration_Code
1433 -- A flag that appears in the N_Compilation_Unit node to indicate whether
1434 -- or not elaboration code is present for this unit. It is initially set
1435 -- true for subprogram specs and bodies and for all generic units and
1436 -- false for non-generic package specs and bodies. Gigi may set the flag
1437 -- in the non-generic package case if it determines that no elaboration
1438 -- code is generated. Note that this flag is not related to the
1439 -- Is_Preelaborated status, there can be preelaborated packages that
1440 -- generate elaboration code, and non-preelaborated packages which do
1441 -- not generate elaboration code.
1443 -- Has_Pragma_Suppress_All
1444 -- This flag is set in an N_Compilation_Unit node if the Suppress_All
1445 -- pragma appears anywhere in the unit. This accommodates the rather
1446 -- strange placement rules of other compilers (DEC permits it at the
1447 -- end of a unit, and Rational allows it as a program unit pragma). We
1448 -- allow it anywhere at all, and consider it equivalent to a pragma
1449 -- Suppress (All_Checks) appearing at the start of the configuration
1450 -- pragmas for the unit.
1452 -- Has_Private_View
1453 -- A flag present in generic nodes that have an entity, to indicate that
1454 -- the node has a private type. Used to exchange private and full
1455 -- declarations if the visibility at instantiation is different from the
1456 -- visibility at generic definition.
1458 -- Has_Relative_Deadline_Pragma
1459 -- A flag present in N_Subprogram_Body and N_Task_Definition nodes to
1460 -- flag the presence of a pragma Relative_Deadline.
1462 -- Has_Secondary_Private_View
1463 -- A flag present in generic nodes that have an entity, to indicate that
1464 -- the node is either of an access type whose Designated_Type is private
1465 -- or of an array type whose Component_Type is private. Used to exchange
1466 -- private and full declarations if the visibility at instantiation is
1467 -- different from the visibility at generic definition.
1469 -- Has_Self_Reference
1470 -- Present in N_Aggregate and N_Extension_Aggregate. Indicates that one
1471 -- of the expressions contains an access attribute reference to the
1472 -- enclosing type. Such a self-reference can only appear in default-
1473 -- initialized aggregate for a record type.
1475 -- Has_SP_Choice
1476 -- Present in all nodes containing a Discrete_Choices field (N_Variant,
1477 -- N_Case_Expression_Alternative, N_Case_Statement_Alternative). Set to
1478 -- True if the Discrete_Choices list has at least one occurrence of a
1479 -- statically predicated subtype.
1481 -- Has_Storage_Size_Pragma
1482 -- A flag present in an N_Task_Definition node to flag the presence of a
1483 -- Storage_Size pragma.
1485 -- Has_Target_Names
1486 -- Present in assignment statements. Indicates that the RHS contains
1487 -- target names (see AI12-0125-3) and must be expanded accordingly.
1489 -- Has_Wide_Character
1490 -- Present in string literals, set if any wide character (i.e. character
1491 -- code outside the Character range but within Wide_Character range)
1492 -- appears in the string. Used to implement pragma preference rules.
1494 -- Has_Wide_Wide_Character
1495 -- Present in string literals, set if any wide character (i.e. character
1496 -- code outside the Wide_Character range) appears in the string. Used to
1497 -- implement pragma preference rules.
1499 -- Header_Size_Added
1500 -- Present in N_Attribute_Reference nodes, set only for attribute
1501 -- Max_Size_In_Storage_Elements. The flag indicates that the size of the
1502 -- hidden list header used by the runtime finalization support has been
1503 -- added to the size of the prefix. The flag also prevents the infinite
1504 -- expansion of the same attribute in the said context.
1506 -- Hidden_By_Use_Clause
1507 -- An entity list present in use clauses that appear within
1508 -- instantiations. For the resolution of local entities, entities
1509 -- introduced by these use clauses have priority over global ones,
1510 -- and outer entities must be explicitly hidden/restored on exit.
1512 -- Implicit_With
1513 -- Present in N_With_Clause nodes. The flag indicates that the clause
1514 -- does not comes from source and introduces an implicit dependency on
1515 -- a particular unit. Such implicit with clauses are generated by:
1517 -- * ABE mechanism - The static elaboration model of both the default
1518 -- and the legacy ABE mechanism use with clauses to encode implicit
1519 -- Elaborate[_All] pragmas.
1521 -- * Analysis - A with clause for child unit A.B.C is equivalent to
1522 -- a series of clauses that with A, A.B, and A.B.C. Manipulation of
1523 -- contexts utilizes implicit with clauses to emulate the visibility
1524 -- of a particular unit.
1526 -- * RTSfind - The compiler generates code which references entities
1527 -- from the runtime.
1529 -- Import_Interface_Present
1530 -- This flag is set in an Interface or Import pragma if a matching
1531 -- pragma of the other kind is also present. This is used to avoid
1532 -- generating some unwanted error messages.
1534 -- Includes_Infinities
1535 -- This flag is present in N_Range nodes. It is set for the range of
1536 -- unconstrained float types defined in Standard, which include not only
1537 -- the given range of values, but also legitimately can include infinite
1538 -- values. This flag is false for any float type for which an explicit
1539 -- range is given by the programmer, even if that range is identical to
1540 -- the range for Float.
1542 -- Incomplete_View
1543 -- Present in full type declarations that are completions of incomplete
1544 -- type declarations. Denotes the corresponding incomplete view declared
1545 -- by the incomplete declaration.
1547 -- Inherited_Discriminant
1548 -- This flag is present in N_Component_Association nodes. It indicates
1549 -- that a given component association in an extension aggregate is the
1550 -- value obtained from a constraint on an ancestor. Used to prevent
1551 -- double expansion when the aggregate has expansion delayed.
1553 -- Instance_Spec
1554 -- This field is present in generic instantiation nodes, and also in
1555 -- formal package declaration nodes (formal package declarations are
1556 -- treated in a manner very similar to package instantiations). It points
1557 -- to the node for the spec of the instance, inserted as part of the
1558 -- semantic processing for instantiations in Sem_Ch12.
1560 -- Is_Abort_Block
1561 -- Present in N_Block_Statement nodes. True if the block protects a list
1562 -- of statements with an Abort_Defer / Abort_Undefer_Direct pair.
1564 -- Is_Accessibility_Actual
1565 -- Present in N_Parameter_Association nodes. True if the parameter is
1566 -- an extra actual that carries the accessibility level of the actual
1567 -- for an access parameter, in a function that dispatches on result and
1568 -- is called in a dispatching context. Used to prevent a formal/actual
1569 -- mismatch when the call is rewritten as a dispatching call.
1571 -- Is_Analyzed_Pragma
1572 -- Present in N_Pragma nodes. Set for delayed pragmas that require a two
1573 -- step analysis. The initial step is performed by routine Analyze_Pragma
1574 -- and verifies the overall legality of the pragma. The second step takes
1575 -- place in the various Analyze_xxx_In_Decl_Part routines which perform
1576 -- full analysis. The flag prevents the reanalysis of a delayed pragma.
1578 -- Is_Asynchronous_Call_Block
1579 -- A flag set in a Block_Statement node to indicate that it is the
1580 -- expansion of an asynchronous entry call. Such a block needs cleanup
1581 -- handler to assure that the call is cancelled.
1583 -- Is_Boolean_Aspect
1584 -- Present in N_Aspect_Specification node. Set if the aspect is for a
1585 -- boolean aspect (i.e. Aspect_Id is in Boolean_Aspect subtype).
1587 -- Is_Checked
1588 -- Present in N_Aspect_Specification and N_Pragma nodes. Set for an
1589 -- assertion aspect or pragma, or check pragma for an assertion, that
1590 -- is to be checked at run time. If either Is_Checked or Is_Ignored
1591 -- is set (they cannot both be set), then this means that the status of
1592 -- the pragma has been checked at the appropriate point and should not
1593 -- be further modified (in some cases these flags are copied when a
1594 -- pragma is rewritten).
1596 -- Is_Checked_Ghost_Pragma
1597 -- This flag is present in N_Pragma nodes. It is set when the pragma is
1598 -- related to a checked Ghost entity or encloses a checked Ghost entity.
1599 -- This flag has no relation to Is_Checked.
1601 -- Is_Component_Left_Opnd
1602 -- Is_Component_Right_Opnd
1603 -- Present in concatenation nodes, to indicate that the corresponding
1604 -- operand is of the component type of the result. Used in resolving
1605 -- concatenation nodes in instances.
1607 -- Is_Controlling_Actual
1608 -- This flag is set on an expression that is a controlling argument in
1609 -- a dispatching call. It is off in all other cases. See Sem_Disp for
1610 -- details of its use.
1612 -- Is_Declaration_Level_Node
1613 -- Present in call marker and instantiation nodes. Set when the constuct
1614 -- appears within the declarations of a block statement, an entry body,
1615 -- a subprogram body, or a task body. The flag aids the ABE Processing
1616 -- phase to catch certain forms of guaranteed ABEs.
1618 -- Is_Delayed_Aspect
1619 -- Present in N_Pragma and N_Attribute_Definition_Clause nodes which
1620 -- come from aspect specifications, where the evaluation of the aspect
1621 -- must be delayed to the freeze point. This flag is also set True in
1622 -- the corresponding N_Aspect_Specification node.
1624 -- Is_Disabled
1625 -- A flag set in an N_Aspect_Specification or N_Pragma node if there was
1626 -- a Check_Policy or Assertion_Policy (or in the case of a Debug_Pragma)
1627 -- a Debug_Policy pragma that resulted in totally disabling the flagged
1628 -- aspect or policy as a result of using the GNAT-defined policy DISABLE.
1629 -- If this flag is set, the aspect or policy is not analyzed for semantic
1630 -- correctness, so any expressions etc will not be marked as analyzed.
1632 -- Is_Dispatching_Call
1633 -- Present in call marker nodes. Set when the related call which prompted
1634 -- the creation of the marker is dispatching.
1636 -- Is_Dynamic_Coextension
1637 -- Present in allocator nodes, to indicate that this is an allocator
1638 -- for an access discriminant of a dynamically allocated object. The
1639 -- coextension must be deallocated and finalized at the same time as
1640 -- the enclosing object. The partner flag Is_Static_Coextension must
1641 -- be cleared before setting this flag to True.
1643 -- Is_Effective_Use_Clause
1644 -- Present in both N_Use_Type_Clause and N_Use_Package_Clause to indicate
1645 -- a use clause is "used" in the current source.
1647 -- Is_Elaboration_Checks_OK_Node
1648 -- Present in the following nodes:
1650 -- assignment statement
1651 -- attribute reference
1652 -- call marker
1653 -- entry call statement
1654 -- expanded name
1655 -- function call
1656 -- function instantiation
1657 -- identifier
1658 -- package instantiation
1659 -- procedure call statement
1660 -- procedure instantiation
1661 -- requeue statement
1662 -- variable reference marker
1664 -- Set when the node appears within a context which allows the generation
1665 -- of run-time ABE checks. This flag determines whether the ABE
1666 -- Processing phase generates conditional ABE checks and guaranteed ABE
1667 -- 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_Enum_Array_Aggregate
1700 -- A flag set on an aggregate created internally while building the
1701 -- images tables for enumerations.
1703 -- Is_Expanded_Build_In_Place_Call
1704 -- This flag is set in an N_Function_Call node to indicate that the extra
1705 -- actuals to support a build-in-place style of call have been added to
1706 -- the call.
1708 -- Is_Expanded_Contract
1709 -- Present in N_Contract nodes. Set if the contract has already undergone
1710 -- expansion activities.
1712 -- Is_Finalization_Wrapper
1713 -- This flag is present in N_Block_Statement nodes. It is set when the
1714 -- block acts as a wrapper of a handled construct which has controlled
1715 -- objects. The wrapper prevents interference between exception handlers
1716 -- and At_End handlers.
1718 -- Is_Generic_Contract_Pragma
1719 -- This flag is present in N_Pragma nodes. It is set when the pragma is
1720 -- a source construct, applies to a generic unit or its body, and denotes
1721 -- one of the following contract-related annotations:
1722 -- Abstract_State
1723 -- Always_Terminates
1724 -- Contract_Cases
1725 -- Depends
1726 -- Exceptional_Cases
1727 -- Extensions_Visible
1728 -- Global
1729 -- Initial_Condition
1730 -- Initializes
1731 -- Post
1732 -- Post_Class
1733 -- Postcondition
1734 -- Pre
1735 -- Pre_Class
1736 -- Precondition
1737 -- Refined_Depends
1738 -- Refined_Global
1739 -- Refined_Post
1740 -- Refined_State
1741 -- Subprogram_Variant
1742 -- Test_Case
1744 -- Is_Homogeneous_Aggregate
1745 -- A flag set on an Ada 2022 aggregate that uses square brackets as
1746 -- delimiters, and thus denotes an array or container aggregate, or
1747 -- the prefix of a reduction attribute.
1749 -- Is_Ignored
1750 -- A flag set in an N_Aspect_Specification or N_Pragma node if there was
1751 -- a Check_Policy or Assertion_Policy (or in the case of a Debug_Pragma)
1752 -- a Debug_Policy pragma that specified a policy of IGNORE, DISABLE, or
1753 -- OFF, for the pragma/aspect. If there was a Policy pragma specifying
1754 -- a Policy of ON or CHECK, then this flag is reset. If no Policy pragma
1755 -- gives a policy for the aspect or pragma, then there are two cases. For
1756 -- an assertion aspect or pragma (one of the assertion kinds allowed in
1757 -- an Assertion_Policy pragma), then Is_Ignored is set if assertions are
1758 -- ignored because of the absence of a -gnata switch. For any other
1759 -- aspects or pragmas, the flag is off. If this flag is set, the
1760 -- aspect/pragma is fully analyzed and checked for other syntactic
1761 -- and semantic errors, but it does not have any semantic effect.
1763 -- Is_Ignored_Ghost_Pragma
1764 -- This flag is present in N_Pragma nodes. It is set when the pragma is
1765 -- related to an ignored Ghost entity or encloses ignored Ghost entity.
1766 -- This flag has no relation to Is_Ignored.
1768 -- Is_In_Discriminant_Check
1769 -- This flag is present in a selected component, and is used to indicate
1770 -- that the reference occurs within a discriminant check. The
1771 -- significance is that optimizations based on assuming that the
1772 -- discriminant check has a correct value cannot be performed in this
1773 -- case (or the discriminant check may be optimized away).
1775 -- Is_Inherited_Pragma
1776 -- This flag is set in an N_Pragma node that appears in a N_Contract node
1777 -- to indicate that the pragma has been inherited from a parent context.
1779 -- Is_Initialization_Block
1780 -- Defined in block nodes. Set when the block statement was created by
1781 -- the finalization machinery to wrap initialization statements. This
1782 -- flag aids the ABE Processing phase to suppress the diagnostics of
1783 -- finalization actions in initialization contexts.
1785 -- Is_Known_Guaranteed_ABE
1786 -- NOTE: this flag is shared between the legacy ABE mechanism and the
1787 -- default ABE mechanism.
1789 -- Present in the following nodes:
1791 -- call marker
1792 -- formal package declaration
1793 -- function call
1794 -- function instantiation
1795 -- package instantiation
1796 -- procedure call statement
1797 -- procedure instantiation
1799 -- Set when the elaboration or evaluation of the scenario results in
1800 -- a guaranteed ABE. The flag is used to suppress the instantiation of
1801 -- generic bodies because gigi cannot handle certain forms of premature
1802 -- instantiation, as well as to prevent the reexamination of the node by
1803 -- the ABE Processing phase.
1805 -- Is_Machine_Number
1806 -- This flag is set in an N_Real_Literal node to indicate that the value
1807 -- is a machine number. This avoids some unnecessary cases of converting
1808 -- real literals to machine numbers.
1810 -- Is_Null_Loop
1811 -- This flag is set in an N_Loop_Statement node if the corresponding loop
1812 -- can be determined to be null at compile time. This is used to remove
1813 -- the loop entirely at expansion time.
1815 -- Is_Overloaded
1816 -- A flag present in all expression nodes. Used temporarily during
1817 -- overloading determination. The setting of this flag is not relevant
1818 -- once overloading analysis is complete.
1820 -- Is_Parenthesis_Aggregate
1821 -- A flag set on an aggregate that uses parentheses as delimiters
1823 -- Is_Power_Of_2_For_Shift
1824 -- A flag present only in N_Op_Expon nodes. It is set when the
1825 -- exponentiation is of the form 2 ** N, where the type of N is an
1826 -- unsigned integral subtype whose size does not exceed the size of
1827 -- Standard_Integer (i.e. a type that can be safely converted to
1828 -- Natural), and the exponentiation appears as the right operand of an
1829 -- integer multiplication or an integer division where the dividend is
1830 -- unsigned. It is also required that overflow checking is off for both
1831 -- the exponentiation and the multiply/divide node. If this set of
1832 -- conditions holds, and the flag is set, then the division or
1833 -- multiplication can be (and is) converted to a shift.
1835 -- Is_Preelaborable_Call
1836 -- Present in call marker nodes. Set when the related call is non-static
1837 -- but preelaborable.
1839 -- Is_Prefixed_Call
1840 -- This flag is set in a selected component within a generic unit, if
1841 -- it resolves to a prefixed call to a primitive operation. The flag
1842 -- is used to prevent accidental overloadings in an instance, when a
1843 -- primitive operation and a private record component may be homographs.
1845 -- Is_Protected_Subprogram_Body
1846 -- A flag set in a Subprogram_Body block to indicate that it is the
1847 -- implementation of a protected subprogram. Such a body needs cleanup
1848 -- handler to make sure that the associated protected object is unlocked
1849 -- when the subprogram completes.
1851 -- Is_Qualified_Universal_Literal
1852 -- Present in N_Qualified_Expression nodes. Set when the qualification is
1853 -- converting a universal literal to a specific type. Such qualifiers aid
1854 -- the resolution of accidental overloading of binary or unary operators
1855 -- which may occur in instances.
1857 -- Is_Read
1858 -- Present in variable reference markers. Set when the original variable
1859 -- reference constitutes a read of the variable.
1861 -- Is_Source_Call
1862 -- Present in call marker nodes. Set when the related call came from
1863 -- source.
1865 -- Is_SPARK_Mode_On_Node
1866 -- Present in the following nodes:
1868 -- assignment statement
1869 -- attribute reference
1870 -- call marker
1871 -- entry call statement
1872 -- expanded name
1873 -- function call
1874 -- function instantiation
1875 -- identifier
1876 -- package instantiation
1877 -- procedure call statement
1878 -- procedure instantiation
1879 -- requeue statement
1880 -- variable reference marker
1882 -- Set when the node appears within a context subject to SPARK_Mode On.
1883 -- This flag determines when the SPARK model of elaboration be activated
1884 -- by the ABE Processing phase.
1886 -- Is_Static_Coextension
1887 -- Present in N_Allocator nodes. Set if the allocator is a coextension
1888 -- of an object allocated on the stack rather than the heap. The partner
1889 -- flag Is_Dynamic_Coextension must be cleared before setting this flag
1890 -- to True.
1892 -- Is_Static_Expression
1893 -- Indicates that an expression is a static expression according to the
1894 -- rules in RM-4.9. See Sem_Eval for details.
1896 -- Is_Subprogram_Descriptor
1897 -- Present in N_Object_Declaration, and set only for the object
1898 -- declaration generated for a subprogram descriptor in fast exception
1899 -- mode. See Exp_Ch11 for details of use.
1901 -- Is_Task_Allocation_Block
1902 -- A flag set in a Block_Statement node to indicate that it is the
1903 -- expansion of a task allocator, or the allocator of an object
1904 -- containing tasks. Such a block requires a cleanup handler to call
1905 -- Expunge_Unactivated_Tasks to complete any tasks that have been
1906 -- allocated but not activated when the allocator completes abnormally.
1908 -- Is_Task_Body_Procedure
1909 -- This flag is set on N_Subprogram_Declaration and N_Subprogram_Body
1910 -- nodes which emulate the body of a task unit.
1912 -- Is_Task_Master
1913 -- A flag set in a Subprogram_Body, Block_Statement, or Task_Body node to
1914 -- indicate that the construct is a task master (i.e. has declared tasks
1915 -- or declares an access to a task type).
1917 -- Is_Write
1918 -- Present in variable reference markers. Set when the original variable
1919 -- reference constitutes a write of the variable.
1921 -- Iterator_Filter
1922 -- Present in N_Loop_Parameter_Specification and N_Iterator_Specification
1923 -- nodes for Ada 2022. It is used to store the condition present in the
1924 -- eponymous Ada 2022 construct.
1926 -- Itype
1927 -- Used in N_Itype_Reference node to reference an itype for which it is
1928 -- important to ensure that it is defined. See description of this node
1929 -- for further details.
1931 -- Kill_Range_Check
1932 -- Used in an N_Unchecked_Type_Conversion node to indicate that the
1933 -- result should not be subjected to range checks. This is used for the
1934 -- implementation of Normalize_Scalars.
1936 -- Label_Construct
1937 -- Used in an N_Implicit_Label_Declaration node. Refers to an N_Label,
1938 -- N_Block_Statement or N_Loop_Statement node to which the label
1939 -- declaration applies. The field is left empty for the special labels
1940 -- generated as part of expanding raise statements with a local exception
1941 -- handler.
1943 -- Library_Unit
1944 -- In a stub node, Library_Unit points to the compilation unit node of
1945 -- the corresponding subunit.
1947 -- In a with clause node, Library_Unit points to the spec of the with'ed
1948 -- unit.
1950 -- In a compilation unit node, the usage depends on the unit type:
1952 -- For a library unit body, Library_Unit points to the compilation unit
1953 -- node of the corresponding spec, unless it's a subprogram body with
1954 -- Acts_As_Spec set, in which case it points to itself.
1956 -- For a spec, Library_Unit points to the compilation unit node of the
1957 -- corresponding body, if present. The body will be present if the spec
1958 -- is or contains generics that we needed to instantiate. Similarly, the
1959 -- body will be present if we needed it for inlining purposes. Thus, if
1960 -- we have a spec/body pair, both of which are present, they point to
1961 -- each other via Library_Unit.
1963 -- For a subunit, Library_Unit points to the compilation unit node of
1964 -- the parent body.
1965 -- ??? not (always) true, in (at least some, maybe all?) cases it points
1966 -- to the corresponding spec for the parent body.
1968 -- Note that this field is not used to hold the parent pointer for child
1969 -- unit (which might in any case need to use it for some other purpose as
1970 -- described above). Instead for a child unit, implicit with's are
1971 -- generated for all parents.
1973 -- Local_Raise_Statements
1974 -- This field is present in exception handler nodes. It is set to
1975 -- No_Elist in the normal case. If there is at least one raise statement
1976 -- which can potentially be handled as a local raise, then this field
1977 -- points to a list of raise nodes, which are calls to a routine to raise
1978 -- an exception. These are raise nodes which can be optimized into gotos
1979 -- if the handler turns out to meet the conditions which permit this
1980 -- transformation. Note that this does NOT include instances of the
1981 -- N_Raise_xxx_Error nodes since the transformation of these nodes is
1982 -- handled by the back end (using the N_Push/N_Pop mechanism).
1984 -- Loop_Actions
1985 -- A list present in Component_Association nodes in array aggregates.
1986 -- Used to collect actions that must be executed within the loop because
1987 -- they may need to be evaluated anew each time through.
1989 -- Limited_View_Installed
1990 -- Present in With_Clauses and in package specifications. If set on
1991 -- with_clause, it indicates that this clause has created the current
1992 -- limited view of the designated package. On a package specification, it
1993 -- indicates that the limited view has already been created because the
1994 -- package is mentioned in a limited_with_clause in the closure of the
1995 -- unit being compiled.
1997 -- Local_Raise_Not_OK
1998 -- Present in N_Exception_Handler nodes. Set if the handler contains
1999 -- a construct (reraise statement, or call to subprogram in package
2000 -- GNAT.Current_Exception) that makes the handler unsuitable as a target
2001 -- for a local raise (one that could otherwise be converted to a goto).
2003 -- Must_Be_Byte_Aligned
2004 -- This flag is present in N_Attribute_Reference nodes. It can be set
2005 -- only for the Address and Unrestricted_Access attributes. If set it
2006 -- means that the object for which the address/access is given must be on
2007 -- a byte (more accurately a storage unit) boundary. If necessary, a copy
2008 -- of the object is to be made before taking the address (this copy is in
2009 -- the current scope on the stack frame). This is used for certain cases
2010 -- of code generated by the expander that passes parameters by address.
2012 -- The reason the copy is not made by the front end is that the back end
2013 -- has more information about type layout and may be able to (but is not
2014 -- guaranteed to) prevent making unnecessary copies.
2016 -- Must_Not_Freeze
2017 -- A flag present in all expression nodes. Normally expressions cause
2018 -- freezing as described in the RM. If this flag is set, then this is
2019 -- inhibited. This is used by the analyzer and expander to label nodes
2020 -- that are created by semantic analysis or expansion and which must not
2021 -- cause freezing even though they normally would. This flag is also
2022 -- present in an N_Subtype_Indication node, since we also use these in
2023 -- calls to Freeze_Expression.
2025 -- Next_Entity
2026 -- Present in defining identifiers, defining character literals, and
2027 -- defining operator symbols (i.e. in all entities). The entities of a
2028 -- scope are chained, and this field is used as the forward pointer for
2029 -- this list. See Einfo for further details.
2031 -- Next_Exit_Statement
2032 -- Present in N_Exit_Statement nodes. The exit statements for a loop are
2033 -- chained (in reverse order of appearance) from the First_Exit_Statement
2034 -- field of the E_Loop entity for the loop. Next_Exit_Statement points to
2035 -- the next entry on this chain (Empty = end of list).
2037 -- Next_Implicit_With
2038 -- Present in N_With_Clause. Part of a chain of with_clauses generated
2039 -- in rtsfind to indicate implicit dependencies on predefined units. Used
2040 -- to prevent multiple with_clauses for the same unit in a given context.
2041 -- A postorder traversal of the tree whose nodes are units and whose
2042 -- links are with_clauses defines the order in which CodePeer must
2043 -- examine a compiled unit and its full context. This ordering ensures
2044 -- that any subprogram call is examined after the subprogram declaration
2045 -- has been seen.
2047 -- Next_Named_Actual
2048 -- Present in parameter association nodes. Set during semantic analysis
2049 -- to point to the next named parameter, where parameters are ordered by
2050 -- declaration order (as opposed to the actual order in the call, which
2051 -- may be different due to named associations). Not that this field
2052 -- points to the explicit actual parameter itself, not to the
2053 -- N_Parameter_Association node (its parent).
2055 -- Next_Pragma
2056 -- Present in N_Pragma nodes. Used to create a linked list of pragma
2057 -- nodes. Currently used for two purposes:
2059 -- Create a list of linked Check_Policy pragmas. The head of this list
2060 -- is stored in Opt.Check_Policy_List (which has further details).
2062 -- Used by processing for Pre/Postcondition pragmas to store a list of
2063 -- pragmas associated with the spec of a subprogram (see Sem_Prag for
2064 -- details).
2066 -- Used by processing for pragma SPARK_Mode to store multiple pragmas
2067 -- the apply to the same construct. These are visible/private mode for
2068 -- a package spec and declarative/statement mode for package body.
2070 -- Next_Rep_Item
2071 -- Present in pragma nodes, attribute definition nodes, enumeration rep
2072 -- clauses, record rep clauses, aspect specification and null statement
2073 -- nodes. Used to link representation items that apply to an entity. See
2074 -- full description of First_Rep_Item field in Einfo for further details.
2076 -- Next_Use_Clause
2077 -- While use clauses are active during semantic processing, they are
2078 -- chained from the scope stack entry, using Next_Use_Clause as a link
2079 -- pointer, with Empty marking the end of the list. The head pointer is
2080 -- in the scope stack entry (First_Use_Clause). At the end of semantic
2081 -- processing (i.e. when Gigi sees the tree, the contents of this field
2082 -- is undefined and should not be read).
2084 -- No_Ctrl_Actions
2085 -- Present in N_Assignment_Statement to indicate that neither Finalize
2086 -- nor Adjust should take place on this assignment even though the LHS
2087 -- and RHS are controlled. Also to indicate that the primitive _assign
2088 -- should not be used for a tagged assignment. This flag is used in init
2089 -- proc and aggregate expansion where the generated assignments are
2090 -- initializations, not real assignments. Note that it also suppresses
2091 -- the creation of transient scopes around the N_Assignment_Statement,
2092 -- in other words it disables all controlled actions for the assignment.
2094 -- No_Elaboration_Check
2095 -- NOTE: this flag is relevant only for the legacy ABE mechanism and
2096 -- should not be used outside of that context.
2098 -- Present in N_Function_Call and N_Procedure_Call_Statement. Indicates
2099 -- that no elaboration check is needed on the call, because it appears in
2100 -- the context of a local Suppress pragma. This is used on calls within
2101 -- task bodies, where the actual elaboration checks are applied after
2102 -- analysis, when the local scope stack is not present.
2104 -- No_Entities_Ref_In_Spec
2105 -- Present in N_With_Clause nodes. Set if the with clause is on the
2106 -- package or subprogram spec where the main unit is the corresponding
2107 -- body, and no entities of the with'ed unit are referenced by the spec
2108 -- (an entity may still be referenced in the body, so this flag is used
2109 -- to generate the proper message (see Sem_Util.Check_Unused_Withs for
2110 -- full details).
2112 -- No_Finalize_Actions
2113 -- Present in N_Assignment_Statement to indicate that no Finalize should
2114 -- take place on this assignment even though the LHS is controlled. Also
2115 -- to indicate that the primitive _assign should not be used for a tagged
2116 -- assignment. This flag is only used in aggregates expansion where the
2117 -- generated assignments are initializations, not real assignments. Note
2118 -- that, unlike the No_Ctrl_Actions flag, it does *not* suppress the
2119 -- creation of transient scopes around the N_Assignment_Statement.
2121 -- No_Initialization
2122 -- Present in N_Object_Declaration and N_Allocator to indicate that the
2123 -- object must not be initialized (by Initialize or call to an init
2124 -- proc). This is needed for controlled aggregates. When the Object
2125 -- declaration has an expression, this flag means that this expression
2126 -- should not be taken into account (needed for in place initialization
2127 -- with aggregates, and for object with an address clause, which are
2128 -- initialized with an assignment at freeze time).
2130 -- No_Minimize_Eliminate
2131 -- This flag is present in membership operator nodes (N_In/N_Not_In).
2132 -- It is used to indicate that processing for extended overflow checking
2133 -- modes is not required (this is used to prevent infinite recursion).
2135 -- No_Truncation
2136 -- Present in N_Unchecked_Type_Conversion node. This flag has an effect
2137 -- only if the RM_Size of the source is greater than the RM_Size of the
2138 -- target for scalar operands. Normally in such a case we truncate some
2139 -- higher order bits of the source, and then sign/zero extend the result
2140 -- to form the output value. But if this flag is set, then we do not do
2141 -- any truncation, so for example, if an 8 bit input is converted to 5
2142 -- bit result which is in fact stored in 8 bits, then the high order
2143 -- three bits of the target result will be copied from the source. This
2144 -- is used for properly setting out of range values for use by pragmas
2145 -- Initialize_Scalars and Normalize_Scalars.
2147 -- Null_Excluding_Subtype
2148 -- Present in N_Access_To_Object_Definition. Indicates that the subtype
2149 -- indication carries a null-exclusion indicator, which is distinct from
2150 -- the null-exclusion indicator that may precede the access keyword.
2152 -- Original_Discriminant
2153 -- Present in identifiers. Used in references to discriminants that
2154 -- appear in generic units. Because the names of the discriminants may be
2155 -- different in an instance, we use this field to recover the position of
2156 -- the discriminant in the original type, and replace it with the
2157 -- discriminant at the same position in the instantiated type.
2159 -- Original_Entity
2160 -- Present in numeric literals. Used to denote the named number that has
2161 -- been constant-folded into the given literal. If literal is from
2162 -- source, or the result of some other constant-folding operation, then
2163 -- Original_Entity is empty. This field is needed to handle properly
2164 -- named numbers in generic units, where the Associated_Node field
2165 -- interferes with the Entity field, making it impossible to preserve the
2166 -- original entity at the point of instantiation.
2168 -- Others_Discrete_Choices
2169 -- When a case statement or variant is analyzed, the semantic checks
2170 -- determine the actual list of choices that correspond to an others
2171 -- choice. This list is materialized for later use by the expander and
2172 -- the Others_Discrete_Choices field of an N_Others_Choice node points to
2173 -- this materialized list of choices, which is in standard format for a
2174 -- list of discrete choices, except that of course it cannot contain an
2175 -- N_Others_Choice entry.
2177 -- Parent_Spec
2178 -- For a library unit that is a child unit spec (package or subprogram
2179 -- declaration, generic declaration or instantiation, or library level
2180 -- rename) this field points to the compilation unit node for the parent
2181 -- package specification. This field is Empty for library bodies (the
2182 -- parent spec in this case can be found from the corresponding spec).
2184 -- Parent_With
2185 -- Present in N_With_Clause nodes. The flag indicates that the clause
2186 -- was generated for an ancestor unit to provide proper visibility. A
2187 -- with clause for child unit A.B.C produces two implicit parent with
2188 -- clauses for A and A.B.
2190 -- Premature_Use
2191 -- Present in N_Incomplete_Type_Declaration node. Used for improved
2192 -- error diagnostics: if there is a premature usage of an incomplete
2193 -- type, a subsequently generated error message indicates the position
2194 -- of its full declaration.
2196 -- Present_Expr
2197 -- Present in an N_Variant node. This has a meaningful value only after
2198 -- Gigi has back annotated the tree with representation information. At
2199 -- this point, it contains a reference to a gcc expression that depends
2200 -- on the values of one or more discriminants. Given a set of
2201 -- discriminant values, this expression evaluates to False (zero) if
2202 -- variant is not present, and True (non-zero) if it is present. See
2203 -- unit Repinfo for further details on gigi back annotation. This field
2204 -- is used during back-annotation processing (for -gnatR -gnatc) to
2205 -- determine if a field is present or not.
2207 -- Prev_Use_Clause
2208 -- Present in both N_Use_Package_Clause and N_Use_Type_Clause. Used in
2209 -- detection of ineffective use clauses by allowing a chain of related
2210 -- clauses together to avoid traversing the current scope stack.
2212 -- Print_In_Hex
2213 -- Set on an N_Integer_Literal node to indicate that the value should be
2214 -- printed in hexadecimal in the sprint listing. Has no effect on
2215 -- legality or semantics of program, only on the displayed output. This
2216 -- is used to clarify output from the packed array cases.
2218 -- Procedure_To_Call
2219 -- Present in N_Allocator, N_Free_Statement, N_Simple_Return_Statement,
2220 -- and N_Extended_Return_Statement nodes. References the entity for the
2221 -- declaration of the procedure to be called to accomplish the required
2222 -- operation (i.e. for the Allocate procedure in the case of N_Allocator
2223 -- and N_Simple_Return_Statement and N_Extended_Return_Statement (for
2224 -- allocating the return value), and for the Deallocate procedure in the
2225 -- case of N_Free_Statement.
2227 -- Raises_Constraint_Error
2228 -- Set on an expression whose evaluation will definitely fail constraint
2229 -- error check. See Sem_Eval for details.
2231 -- Redundant_Use
2232 -- Present in nodes that can appear as an operand in a use clause or use
2233 -- type clause (identifiers, expanded names, attribute references). Set
2234 -- to indicate that a use is redundant (and therefore need not be undone
2235 -- on scope exit).
2237 -- Renaming_Exception
2238 -- Present in N_Exception_Declaration node. Used to point back to the
2239 -- exception renaming for an exception declared within a subprogram.
2240 -- What happens is that an exception declared in a subprogram is moved
2241 -- to the library level with a unique name, and the original exception
2242 -- becomes a renaming. This link from the library level exception to the
2243 -- renaming declaration allows registering of the proper exception name.
2245 -- Return_Statement_Entity
2246 -- Present in N_Simple_Return_Statement and N_Extended_Return_Statement.
2247 -- Points to an E_Return_Statement representing the return statement.
2249 -- Return_Object_Declarations
2250 -- Present in N_Extended_Return_Statement. Points to a list initially
2251 -- containing a single N_Object_Declaration representing the return
2252 -- object. We use a list (instead of just a pointer to the object decl)
2253 -- because Analyze wants to insert extra actions on this list, before the
2254 -- N_Object_Declaration, which always remains last on the list.
2256 -- Rounded_Result
2257 -- Present in N_Type_Conversion, N_Op_Divide, and N_Op_Multiply nodes.
2258 -- Used in the fixed-point cases to indicate that the result must be
2259 -- rounded as a result of the use of the 'Round attribute. Also used for
2260 -- integer N_Op_Divide nodes to indicate that the result should be
2261 -- rounded to the nearest integer (breaking ties away from zero), rather
2262 -- than truncated towards zero as usual. These rounded integer operations
2263 -- are the result of expansion of rounded fixed-point divide, conversion
2264 -- and multiplication operations.
2266 -- Save_Invocation_Graph_Of_Body
2267 -- Present in compilation unit nodes. Set when the elaboration mechanism
2268 -- must record all invocation constructs and invocation relations within
2269 -- the body of the compilation unit.
2271 -- SCIL_Entity
2272 -- Present in SCIL nodes. References the specific tagged type associated
2273 -- with the SCIL node (for an N_SCIL_Dispatching_Call node, this is
2274 -- the controlling type of the call; for an N_SCIL_Membership_Test node
2275 -- generated as part of testing membership in T'Class, this is T; for an
2276 -- N_SCIL_Dispatch_Table_Tag_Init node, this is the type being declared).
2278 -- SCIL_Controlling_Tag
2279 -- Present in N_SCIL_Dispatching_Call nodes. References the controlling
2280 -- tag of a dispatching call. This is usually an N_Selected_Component
2281 -- node (for a _tag component), but may be an N_Object_Declaration or
2282 -- N_Parameter_Specification node in some cases (e.g., for a call to
2283 -- a classwide streaming operation or a call to an instance of
2284 -- Ada.Tags.Generic_Dispatching_Constructor).
2286 -- SCIL_Tag_Value
2287 -- Present in N_SCIL_Membership_Test nodes. Used to reference the tag
2288 -- of the value that is being tested.
2290 -- SCIL_Target_Prim
2291 -- Present in N_SCIL_Dispatching_Call nodes. References the primitive
2292 -- operation named (statically) in a dispatching call.
2294 -- Scope
2295 -- Present in defining identifiers, defining character literals, and
2296 -- defining operator symbols (i.e. in all entities). The entities of a
2297 -- scope all use this field to reference the corresponding scope entity.
2298 -- See Einfo for further details.
2300 -- Shift_Count_OK
2301 -- A flag present in shift nodes to indicate that the shift count is
2302 -- known to be in range, i.e. is in the range from zero to word length
2303 -- minus one. If this flag is not set, then the shift count may be
2304 -- outside this range, i.e. larger than the word length, and the code
2305 -- must ensure that such shift counts give the appropriate result.
2307 -- Source_Type
2308 -- Used in an N_Validate_Unchecked_Conversion node to point to the
2309 -- source type entity for the unchecked conversion instantiation
2310 -- which gigi must do size validation for.
2312 -- Split_PPC
2313 -- When a Pre or Post aspect specification is processed, it is broken
2314 -- into AND THEN sections. The leftmost section has Split_PPC set to
2315 -- False, indicating that it is the original specification (e.g. for
2316 -- posting errors). For other sections, Split_PPC is set to True.
2317 -- This flag is set in both the N_Aspect_Specification node itself,
2318 -- and in the pragma which is generated from this node.
2320 -- Storage_Pool
2321 -- Present in N_Allocator, N_Free_Statement, N_Simple_Return_Statement,
2322 -- and N_Extended_Return_Statement nodes. References the entity for the
2323 -- storage pool to be used for the allocate or free call or for the
2324 -- allocation of the returned value from function. Empty indicates that
2325 -- the global default pool is to be used. Note that in the case
2326 -- of a return statement, this field is set only if the function returns
2327 -- value of a type whose size is not known at compile time on the
2328 -- secondary stack.
2330 -- Suppress_Assignment_Checks
2331 -- Used in generated N_Assignment_Statement nodes to suppress predicate
2332 -- and range checks in cases where the generated code knows that the
2333 -- value being assigned is in range and satisfies any predicate. Also
2334 -- can be set in N_Object_Declaration nodes, to similarly suppress any
2335 -- checks on the initializing value. In assignment statements it also
2336 -- suppresses access checks in the generated code for out- and in-out
2337 -- parameters in entry calls, as well as discriminant and length checks.
2339 -- Suppress_Loop_Warnings
2340 -- Used in N_Loop_Statement node to indicate that warnings within the
2341 -- body of the loop should be suppressed. This is set when the range
2342 -- of a FOR loop is known to be null, or is probably null (loop would
2343 -- only execute if invalid values are present).
2345 -- Target
2346 -- Present in call and variable reference marker nodes. References the
2347 -- entity of the original entity, operator, or subprogram being invoked,
2348 -- or the original variable being read or written.
2350 -- Target_Type
2351 -- Used in an N_Validate_Unchecked_Conversion node to point to the target
2352 -- type entity for the unchecked conversion instantiation which gigi must
2353 -- do size validation for.
2355 -- Then_Actions
2356 -- This field is present in if expression nodes. During code expansion
2357 -- we use the Insert_Actions procedure (in Exp_Util) to insert actions
2358 -- at an appropriate place in the tree to get elaborated at the right
2359 -- time. For if expressions, we have to be sure that the actions for
2360 -- for the Then branch are only elaborated if the condition is True.
2361 -- The Then_Actions field is used as a temporary parking place for
2362 -- these actions. The final tree is always rewritten to eliminate the
2363 -- need for this field, so in the tree passed to Gigi, this field is
2364 -- always set to No_List.
2366 -- TSS_Elist
2367 -- Present in N_Freeze_Entity nodes. Holds an element list containing
2368 -- entries for each TSS (type support subprogram) associated with the
2369 -- frozen type. The elements of the list are the entities for the
2370 -- subprograms (see package Exp_TSS for further details). Set to No_Elist
2371 -- if there are no type support subprograms for the type or if the freeze
2372 -- node is not for a type.
2374 -- Uneval_Old_Accept
2375 -- Present in N_Pragma nodes. Set True if Opt.Uneval_Old is set to 'A'
2376 -- (accept) at the point where the pragma is encountered (including the
2377 -- case of a pragma generated from an aspect specification). It is this
2378 -- setting that is relevant, rather than the setting at the point where
2379 -- a contract is finally analyzed after the delay till the freeze point.
2381 -- Uneval_Old_Warn
2382 -- Present in N_Pragma nodes. Set True if Opt.Uneval_Old is set to 'W'
2383 -- (warn) at the point where the pragma is encountered (including the
2384 -- case of a pragma generated from an aspect specification). It is this
2385 -- setting that is relevant, rather than the setting at the point where
2386 -- a contract is finally analyzed after the delay till the freeze point.
2388 -- Unreferenced_In_Spec
2389 -- Present in N_With_Clause nodes. Set if the with clause is on the
2390 -- package or subprogram spec where the main unit is the corresponding
2391 -- body, and is not referenced by the spec (it may still be referenced by
2392 -- the body, so this flag is used to generate the proper message (see
2393 -- Sem_Util.Check_Unused_Withs for details)
2395 -- Uninitialized_Variable
2396 -- Present in N_Formal_Private_Type_Definition and in N_Private_
2397 -- Extension_Declarations. Indicates that a variable in a generic unit
2398 -- whose type is a formal private or derived type is read without being
2399 -- initialized. Used to warn if the corresponding actual type is not
2400 -- a fully initialized type.
2402 -- Used_Operations
2403 -- Present in N_Use_Type_Clause nodes. Holds the list of operations that
2404 -- are made potentially use-visible by the clause. Simplifies processing
2405 -- on exit from the scope of the use_type_clause, in particular in the
2406 -- case of Use_All_Type, when those operations several scopes.
2408 -- Was_Attribute_Reference
2409 -- Present in N_Subprogram_Body. Set to True if the original source is an
2410 -- attribute reference which is an actual in a generic instantiation. The
2411 -- instantiation prologue renames these attributes, and expansion later
2412 -- converts them into subprogram bodies.
2414 -- Was_Expression_Function
2415 -- Present in N_Subprogram_Body. True if the original source had an
2416 -- N_Expression_Function, which was converted to the N_Subprogram_Body
2417 -- by Analyze_Expression_Function.
2419 -- Was_Originally_Stub
2420 -- This flag is set in the node for a proper body that replaces stub.
2421 -- During the analysis procedure, stubs in some situations get rewritten
2422 -- by the corresponding bodies, and we set this flag to remember that
2423 -- this happened. Note that it is not good enough to rely on the use of
2424 -- Original_Node here because of the case of nested instantiations where
2425 -- the substituted node can be copied.
2427 --------------------------------------------------
2428 -- Note on Use of End_Label and End_Span Fields --
2429 --------------------------------------------------
2431 -- Several constructs have end lines:
2433 -- Loop Statement end loop [loop_IDENTIFIER];
2434 -- Package Specification end [[PARENT_UNIT_NAME .] IDENTIFIER]
2435 -- Task Definition end [task_IDENTIFIER]
2436 -- Protected Definition end [protected_IDENTIFIER]
2437 -- Protected Body end [protected_IDENTIFIER]
2439 -- Block Statement end [block_IDENTIFIER];
2440 -- Subprogram Body end [DESIGNATOR];
2441 -- Package Body end [[PARENT_UNIT_NAME .] IDENTIFIER];
2442 -- Task Body end [task_IDENTIFIER];
2443 -- Accept Statement end [entry_IDENTIFIER]];
2444 -- Entry Body end [entry_IDENTIFIER];
2446 -- If Statement end if;
2447 -- Case Statement end case;
2449 -- Record Definition end record;
2450 -- Enumeration Definition );
2452 -- The End_Label and End_Span fields are used to mark the locations of
2453 -- these lines, and also keep track of the label in the case where a label
2454 -- is present.
2456 -- For the first group above, the End_Label field of the corresponding node
2457 -- is used to point to the label identifier. In the case where there is no
2458 -- label in the source, the parser supplies a dummy identifier (with
2459 -- Comes_From_Source set to False), and the Sloc of this dummy identifier
2460 -- marks the location of the token following the END token.
2462 -- For the second group, the use of End_Label is similar, but the End_Label
2463 -- is found in the N_Handled_Sequence_Of_Statements node. This is done
2464 -- simply because in some cases there is no room in the parent node.
2466 -- For the third group, there is never any label, and instead of using
2467 -- End_Label, we use the End_Span field which gives the location of the
2468 -- token following END, relative to the starting Sloc of the construct,
2469 -- i.e. add Sloc (Node) + End_Span (Node) to get the Sloc of the IF or CASE
2470 -- following the End_Label.
2472 -- The record definition case is handled specially, we treat it as though
2473 -- it required an optional label which is never present, and so the parser
2474 -- always builds a dummy identifier with Comes From Source set False. The
2475 -- reason we do this, rather than using End_Span in this case, is that we
2476 -- want to generate a cross-ref entry for the end of a record, since it
2477 -- represents a scope for name declaration purposes.
2479 -- The enumeration definition case is handled in an exactly similar manner,
2480 -- building a dummy identifier to get a cross-reference.
2482 -- Note: the reason we store the difference as a Uint, instead of storing
2483 -- the Source_Ptr value directly, is that Source_Ptr values cannot be
2484 -- distinguished from other types of values, and we count on all general
2485 -- use fields being self describing. To make things easier for clients,
2486 -- note that we provide function End_Location, and procedure
2487 -- Set_End_Location to allow access to the logical value (which is the
2488 -- Source_Ptr value for the end token).
2490 ---------------------
2491 -- Syntactic Nodes --
2492 ---------------------
2494 ---------------------
2495 -- 2.3 Identifier --
2496 ---------------------
2498 -- IDENTIFIER ::= IDENTIFIER_LETTER {[UNDERLINE] LETTER_OR_DIGIT}
2499 -- LETTER_OR_DIGIT ::= IDENTIFIER_LETTER | DIGIT
2501 -- An IDENTIFIER shall not be a reserved word
2503 -- In the Ada grammar identifiers are the bottom level tokens which have
2504 -- very few semantics. Actual program identifiers are direct names. If
2505 -- we were being 100% honest with the grammar, then we would have a node
2506 -- called N_Direct_Name which would point to an identifier. However,
2507 -- that's too many extra nodes, so we just use the N_Identifier node
2508 -- directly as a direct name, and it contains the expression fields and
2509 -- Entity field that correspond to its use as a direct name. In those
2510 -- few cases where identifiers appear in contexts where they are not
2511 -- direct names (pragmas, pragma argument associations, attribute
2512 -- references and attribute definition clauses), the Chars field of the
2513 -- node contains the Name_Id for the identifier name.
2515 -- Note: in GNAT, a reserved word can be treated as an identifier in two
2516 -- cases. First, an incorrect use of a reserved word as an identifier is
2517 -- diagnosed and then treated as a normal identifier. Second, an
2518 -- attribute designator of the form of a reserved word (access, delta,
2519 -- digits, range) is treated as an identifier.
2521 -- Note: The set of letters that is permitted in an identifier depends
2522 -- on the character set in use. See package Csets for full details.
2524 -- N_Identifier
2525 -- Sloc points to identifier
2526 -- Chars contains the Name_Id for the identifier
2527 -- Entity
2528 -- Associated_Node
2529 -- Original_Discriminant
2530 -- Is_Elaboration_Checks_OK_Node
2531 -- Is_SPARK_Mode_On_Node
2532 -- Is_Elaboration_Warnings_OK_Node
2533 -- Has_Private_View (set in generic units)
2534 -- Has_Secondary_Private_View (set in generic units)
2535 -- Redundant_Use
2536 -- Atomic_Sync_Required
2537 -- plus fields for expression
2539 --------------------------
2540 -- 2.4 Numeric Literal --
2541 --------------------------
2543 -- NUMERIC_LITERAL ::= DECIMAL_LITERAL | BASED_LITERAL
2545 ----------------------------
2546 -- 2.4.1 Decimal Literal --
2547 ----------------------------
2549 -- DECIMAL_LITERAL ::= NUMERAL [.NUMERAL] [EXPONENT]
2551 -- NUMERAL ::= DIGIT {[UNDERLINE] DIGIT}
2553 -- EXPONENT ::= E [+] NUMERAL | E - NUMERAL
2555 -- Decimal literals appear in the tree as either integer literal nodes
2556 -- or real literal nodes, depending on whether a period is present.
2558 -- Note: literal nodes appear as a result of direct use of literals
2559 -- in the source program, and also as the result of evaluating
2560 -- expressions at compile time. In the latter case, it is possible
2561 -- to construct real literals that have no syntactic representation
2562 -- using the standard literal format. Such literals are listed by
2563 -- Sprint using the notation [numerator / denominator].
2565 -- Note: the value of an integer literal node created by the front end
2566 -- is never outside the range of values of the base type. However, it
2567 -- can be the case that the created value is outside the range of the
2568 -- particular subtype. This happens in the case of integer overflows
2569 -- with checks suppressed.
2571 -- N_Integer_Literal
2572 -- Sloc points to literal
2573 -- Original_Entity If not Empty, holds Named_Number that
2574 -- has been constant-folded into its literal value.
2575 -- Intval contains integer value of literal
2576 -- Print_In_Hex
2577 -- plus fields for expression
2579 -- N_Real_Literal
2580 -- Sloc points to literal
2581 -- Original_Entity If not Empty, holds Named_Number that
2582 -- has been constant-folded into its literal value.
2583 -- Realval contains real value of literal
2584 -- Corresponding_Integer_Value
2585 -- Is_Machine_Number
2586 -- plus fields for expression
2588 --------------------------
2589 -- 2.4.2 Based Literal --
2590 --------------------------
2592 -- BASED_LITERAL ::=
2593 -- BASE # BASED_NUMERAL [.BASED_NUMERAL] # [EXPONENT]
2595 -- BASE ::= NUMERAL
2597 -- BASED_NUMERAL ::=
2598 -- EXTENDED_DIGIT {[UNDERLINE] EXTENDED_DIGIT}
2600 -- EXTENDED_DIGIT ::= DIGIT | A | B | C | D | E | F
2602 -- Based literals appear in the tree as either integer literal nodes
2603 -- or real literal nodes, depending on whether a period is present.
2605 ----------------------------
2606 -- 2.5 Character Literal --
2607 ----------------------------
2609 -- CHARACTER_LITERAL ::= ' GRAPHIC_CHARACTER '
2611 -- N_Character_Literal
2612 -- Sloc points to literal
2613 -- Chars contains the Name_Id for the identifier
2614 -- Char_Literal_Value contains the literal value
2615 -- Entity
2616 -- Associated_Node
2617 -- Has_Private_View (set in generic units)
2618 -- Has_Secondary_Private_View (set in generic units)
2619 -- plus fields for expression
2621 -- Note: the Entity field will be missing (set to Empty) for character
2622 -- literals whose type is Standard.Wide_Character or Standard.Character
2623 -- or a type derived from one of these two. In this case the character
2624 -- literal stands for its own coding. The reason we take this irregular
2625 -- short cut is to avoid the need to build lots of junk defining
2626 -- character literal nodes.
2628 -------------------------
2629 -- 2.6 String Literal --
2630 -------------------------
2632 -- STRING LITERAL ::= "{STRING_ELEMENT}"
2634 -- A STRING_ELEMENT is either a pair of quotation marks ("), or a
2635 -- single GRAPHIC_CHARACTER other than a quotation mark.
2637 -- Is_Folded_In_Parser is True if the parser created this literal by
2638 -- folding a sequence of "&" operators. For example, if the source code
2639 -- says "aaa" & "bbb" & "ccc", and this produces "aaabbbccc", the flag
2640 -- is set. This flag is needed because the parser doesn't know about
2641 -- visibility, so the folded result might be wrong, and semantic
2642 -- analysis needs to check for that.
2644 -- N_String_Literal
2645 -- Sloc points to literal
2646 -- Strval contains Id of string value
2647 -- Has_Wide_Character
2648 -- Has_Wide_Wide_Character
2649 -- Is_Folded_In_Parser
2650 -- plus fields for expression
2652 ---------------------------------------
2653 -- 2.6 Interpolated String Literal --
2654 ---------------------------------------
2656 -- INTERPOLATED_STRING_LITERAL ::=
2657 -- '{' "{INTERPOLATED_STRING_ELEMENT}" {
2658 -- "{INTERPOLATED_STRING_ELEMENT}" } '}'
2660 -- INTERPOLATED_STRING_ELEMENT ::=
2661 -- ESCAPED_CHARACTER | INTERPOLATED_EXPRESSION
2662 -- | non_quotation_mark_non_left_brace_GRAPHIC_CHARACTER
2664 -- ESCAPED_CHARACTER ::= '\GRAPHIC_CHARACTER'
2666 -- INTERPOLATED_EXPRESSION ::= '{' EXPRESSION '}'
2668 -- Most of these syntax rules are omitted as tree nodes to simplify
2669 -- semantic processing. The scanner handles escaped characters as part
2670 -- of processing an interpolated string literal, and the parser stores
2671 -- in the Expressions field of this node a list containing the sequence
2672 -- of string literals and the roots of the interpolated expressions.
2674 -- N_Interpolated_String_Literal
2675 -- Sloc points to literal
2676 -- Expressions
2677 -- plus fields for expression
2679 ------------------
2680 -- 2.7 Comment --
2681 ------------------
2683 -- A COMMENT starts with two adjacent hyphens and extends up to the
2684 -- end of the line. A COMMENT may appear on any line of a program.
2686 -- Comments are skipped by the scanner and do not appear in the tree.
2687 -- It is possible to reconstruct the position of comments with respect
2688 -- to the elements of the tree by using the source position (Sloc)
2689 -- pointers that appear in every tree node.
2691 -----------------
2692 -- 2.8 Pragma --
2693 -----------------
2695 -- PRAGMA ::= pragma IDENTIFIER
2696 -- [(PRAGMA_ARGUMENT_ASSOCIATION {, PRAGMA_ARGUMENT_ASSOCIATION})];
2698 -- Note that a pragma may appear in the tree anywhere a declaration
2699 -- or a statement may appear, as well as in some other situations
2700 -- which are explicitly documented.
2702 -- N_Pragma
2703 -- Sloc points to PRAGMA
2704 -- Next_Pragma
2705 -- Pragma_Argument_Associations (set to No_List if none)
2706 -- Corresponding_Aspect (set to Empty if not present)
2707 -- Pragma_Identifier
2708 -- Next_Rep_Item
2709 -- Is_Generic_Contract_Pragma
2710 -- Is_Checked_Ghost_Pragma
2711 -- Is_Inherited_Pragma
2712 -- Is_Analyzed_Pragma
2713 -- Class_Present set if from Aspect with 'Class
2714 -- Uneval_Old_Accept
2715 -- Is_Ignored_Ghost_Pragma
2716 -- Is_Ignored
2717 -- Is_Checked
2718 -- From_Aspect_Specification
2719 -- Is_Delayed_Aspect
2720 -- Is_Disabled
2721 -- Import_Interface_Present
2722 -- Split_PPC set if corresponding aspect had Split_PPC set
2723 -- Uneval_Old_Warn
2725 -- Note: we should have a section on what pragmas are passed on to
2726 -- the back end to be processed. This section should note that pragma
2727 -- Psect_Object is always converted to Common_Object, but there are
2728 -- undoubtedly many other similar notes required ???
2730 -- Note: utility functions Pragma_Name_Unmapped and Pragma_Name may be
2731 -- applied to pragma nodes to obtain the Chars or its mapped version.
2733 -- Note: if From_Aspect_Specification is set, then Sloc points to the
2734 -- aspect name, as does the Pragma_Identifier. In this case if the
2735 -- pragma has a local name argument (such as pragma Inline), it is
2736 -- resolved to point to the specific entity affected by the pragma.
2738 --------------------------------------
2739 -- 2.8 Pragma Argument Association --
2740 --------------------------------------
2742 -- PRAGMA_ARGUMENT_ASSOCIATION ::=
2743 -- [pragma_argument_IDENTIFIER =>] NAME
2744 -- | [pragma_argument_IDENTIFIER =>] EXPRESSION
2746 -- In Ada 2012, there are two more possibilities:
2748 -- PRAGMA_ARGUMENT_ASSOCIATION ::=
2749 -- [pragma_argument_ASPECT_MARK =>] NAME
2750 -- | [pragma_argument_ASPECT_MARK =>] EXPRESSION
2752 -- where the interesting allowed cases (which do not fit the syntax of
2753 -- the first alternative above) are
2755 -- ASPECT_MARK => Pre'Class |
2756 -- Post'Class |
2757 -- Type_Invariant'Class |
2758 -- Invariant'Class
2760 -- We allow this special usage in all Ada modes, but it would be a
2761 -- pain to allow these aspects to pervade the pragma syntax, and the
2762 -- representation of pragma nodes internally. So what we do is to
2763 -- replace these ASPECT_MARK forms with identifiers whose name is one
2764 -- of the special internal names _Pre, _Post, or _Type_Invariant.
2766 -- We do a similar replacement of these Aspect_Mark forms in the
2767 -- Expression of a pragma argument association for the cases of
2768 -- the first arguments of any Check pragmas and Check_Policy pragmas
2770 -- N_Pragma_Argument_Association
2771 -- Sloc points to first token in association
2772 -- Chars (set to No_Name if no pragma argument identifier)
2773 -- Expression_Copy
2774 -- Expression
2776 ------------------------
2777 -- 2.9 Reserved Word --
2778 ------------------------
2780 -- Reserved words are parsed by the scanner, and returned as the
2781 -- corresponding token types (e.g. PACKAGE is returned as Tok_Package)
2783 ----------------------------
2784 -- 3.1 Basic Declaration --
2785 ----------------------------
2787 -- BASIC_DECLARATION ::=
2788 -- TYPE_DECLARATION | SUBTYPE_DECLARATION
2789 -- | OBJECT_DECLARATION | NUMBER_DECLARATION
2790 -- | SUBPROGRAM_DECLARATION | ABSTRACT_SUBPROGRAM_DECLARATION
2791 -- | PACKAGE_DECLARATION | RENAMING_DECLARATION
2792 -- | EXCEPTION_DECLARATION | GENERIC_DECLARATION
2793 -- | GENERIC_INSTANTIATION
2795 -- Basic declaration also includes IMPLICIT_LABEL_DECLARATION
2796 -- see further description in section on semantic nodes.
2798 -- Also, in the tree that is constructed, a pragma may appear
2799 -- anywhere that a declaration may appear.
2801 ------------------------------
2802 -- 3.1 Defining Identifier --
2803 ------------------------------
2805 -- DEFINING_IDENTIFIER ::= IDENTIFIER
2807 -- A defining identifier is an entity, which has additional fields
2808 -- depending on the setting of the Ekind field. These additional
2809 -- fields are defined (and access subprograms declared) in package
2810 -- Einfo.
2812 -- Note: N_Defining_Identifier is an extended node whose fields are
2813 -- deliberately laid out to match the layout of fields in an ordinary
2814 -- N_Identifier node allowing for easy alteration of an identifier
2815 -- node into a defining identifier node. For details, see procedure
2816 -- Sinfo.CN.Change_Identifier_To_Defining_Identifier.
2818 -- N_Defining_Identifier
2819 -- Sloc points to identifier
2820 -- Chars contains the Name_Id for the identifier
2821 -- Next_Entity
2822 -- Scope
2823 -- Etype
2825 -----------------------------
2826 -- 3.2.1 Type Declaration --
2827 -----------------------------
2829 -- TYPE_DECLARATION ::=
2830 -- FULL_TYPE_DECLARATION
2831 -- | INCOMPLETE_TYPE_DECLARATION
2832 -- | PRIVATE_TYPE_DECLARATION
2833 -- | PRIVATE_EXTENSION_DECLARATION
2835 ----------------------------------
2836 -- 3.2.1 Full Type Declaration --
2837 ----------------------------------
2839 -- FULL_TYPE_DECLARATION ::=
2840 -- type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART]
2841 -- is TYPE_DEFINITION
2842 -- [ASPECT_SPECIFICATIONS];
2843 -- | TASK_TYPE_DECLARATION
2844 -- | PROTECTED_TYPE_DECLARATION
2846 -- The full type declaration node is used only for the first case. The
2847 -- second case (concurrent type declaration), is represented directly
2848 -- by a task type declaration or a protected type declaration.
2850 -- N_Full_Type_Declaration
2851 -- Sloc points to TYPE
2852 -- Defining_Identifier
2853 -- Incomplete_View
2854 -- Discriminant_Specifications (set to No_List if none)
2855 -- Type_Definition
2856 -- Discr_Check_Funcs_Built
2858 ----------------------------
2859 -- 3.2.1 Type Definition --
2860 ----------------------------
2862 -- TYPE_DEFINITION ::=
2863 -- ENUMERATION_TYPE_DEFINITION | INTEGER_TYPE_DEFINITION
2864 -- | REAL_TYPE_DEFINITION | ARRAY_TYPE_DEFINITION
2865 -- | RECORD_TYPE_DEFINITION | ACCESS_TYPE_DEFINITION
2866 -- | DERIVED_TYPE_DEFINITION | INTERFACE_TYPE_DEFINITION
2868 --------------------------------
2869 -- 3.2.2 Subtype Declaration --
2870 --------------------------------
2872 -- SUBTYPE_DECLARATION ::=
2873 -- subtype DEFINING_IDENTIFIER is [NULL_EXCLUSION] SUBTYPE_INDICATION
2874 -- [ASPECT_SPECIFICATIONS];
2876 -- The subtype indication field is set to Empty for subtypes
2877 -- declared in package Standard (Positive, Natural).
2879 -- N_Subtype_Declaration
2880 -- Sloc points to SUBTYPE
2881 -- Defining_Identifier
2882 -- Null_Exclusion_Present
2883 -- Subtype_Indication
2884 -- Generic_Parent_Type (for actual of formal private or derived type)
2885 -- Exception_Junk
2887 -------------------------------
2888 -- 3.2.2 Subtype Indication --
2889 -------------------------------
2891 -- SUBTYPE_INDICATION ::= SUBTYPE_MARK [CONSTRAINT]
2893 -- Note: if no constraint is present, the subtype indication appears
2894 -- directly in the tree as a subtype mark. The N_Subtype_Indication
2895 -- node is used only if a constraint is present.
2897 -- Note: [For Ada 2005 (AI-231)]: Because Ada 2005 extends this rule
2898 -- with the null-exclusion part (see AI-231), we had to introduce a new
2899 -- attribute in all the parents of subtype_indication nodes to indicate
2900 -- if the null-exclusion is present.
2902 -- Note: the reason that this node has expression fields is that a
2903 -- subtype indication can appear as an operand of a membership test.
2905 -- N_Subtype_Indication
2906 -- Sloc points to first token of subtype mark
2907 -- Subtype_Mark
2908 -- Constraint
2909 -- Etype
2910 -- Must_Not_Freeze
2912 -- Note: Depending on context, the Etype is either the entity of the
2913 -- Subtype_Mark field, or it is an itype constructed to reify the
2914 -- subtype indication. In particular, such itypes are created for a
2915 -- subtype indication that appears in an array type declaration. This
2916 -- simplifies constraint checking in indexed components.
2918 -- For subtype indications that appear in scalar type and subtype
2919 -- declarations, the Etype is the entity of the subtype mark.
2921 -------------------------
2922 -- 3.2.2 Subtype Mark --
2923 -------------------------
2925 -- SUBTYPE_MARK ::= subtype_NAME
2927 -----------------------
2928 -- 3.2.2 Constraint --
2929 -----------------------
2931 -- CONSTRAINT ::= SCALAR_CONSTRAINT | COMPOSITE_CONSTRAINT
2933 ------------------------------
2934 -- 3.2.2 Scalar Constraint --
2935 ------------------------------
2937 -- SCALAR_CONSTRAINT ::=
2938 -- RANGE_CONSTRAINT | DIGITS_CONSTRAINT | DELTA_CONSTRAINT
2940 ---------------------------------
2941 -- 3.2.2 Composite Constraint --
2942 ---------------------------------
2944 -- COMPOSITE_CONSTRAINT ::=
2945 -- INDEX_CONSTRAINT | DISCRIMINANT_CONSTRAINT
2947 -------------------------------
2948 -- 3.3.1 Object Declaration --
2949 -------------------------------
2951 -- OBJECT_DECLARATION ::=
2952 -- DEFINING_IDENTIFIER_LIST : [aliased] [constant]
2953 -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION]
2954 -- [ASPECT_SPECIFICATIONS];
2955 -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant]
2956 -- ACCESS_DEFINITION [:= EXPRESSION]
2957 -- [ASPECT_SPECIFICATIONS];
2958 -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant]
2959 -- ARRAY_TYPE_DEFINITION [:= EXPRESSION]
2960 -- [ASPECT_SPECIFICATIONS];
2961 -- | SINGLE_TASK_DECLARATION
2962 -- | SINGLE_PROTECTED_DECLARATION
2964 -- Note: aliased is not permitted in Ada 83 mode
2966 -- The N_Object_Declaration node is only for the first three cases.
2967 -- Single task declaration is handled by P_Task (9.1)
2968 -- Single protected declaration is handled by P_protected (9.5)
2970 -- Although the syntax allows multiple identifiers in the list, the
2971 -- semantics is as though successive declarations were given with
2972 -- identical type definition and expression components. To simplify
2973 -- semantic processing, the parser represents a multiple declaration
2974 -- case as a sequence of single declarations, using the More_Ids and
2975 -- Prev_Ids flags to preserve the original source form as described
2976 -- in the section on "Handling of Defining Identifier Lists".
2978 -- The flag Has_Init_Expression is set if an initializing expression
2979 -- is present. Normally it is set if and only if Expression contains
2980 -- a non-empty value, but there is an exception to this. When the
2981 -- initializing expression is an aggregate which requires explicit
2982 -- assignments, the Expression field gets set to Empty, but this flag
2983 -- is still set, so we don't forget we had an initializing expression.
2985 -- Note: if a range check is required for the initialization
2986 -- expression then the Do_Range_Check flag is set in the Expression,
2987 -- with the check being done against the type given by the object
2988 -- definition, which is also the Etype of the defining identifier.
2990 -- Note: the contents of the Expression field must be ignored (i.e.
2991 -- treated as though it were Empty) if No_Initialization is set True.
2993 -- Note: the back end places some restrictions on the form of the
2994 -- Expression field. If the object being declared is Atomic, then
2995 -- the Expression may not have the form of an aggregate (since this
2996 -- might cause the back end to generate separate assignments). In this
2997 -- case the front end must generate an extra temporary and initialize
2998 -- this temporary as required (the temporary itself is not atomic).
3000 -- Note: there is no node kind for object definition. Instead, the
3001 -- corresponding field holds a subtype indication, an array type
3002 -- definition, or (Ada 2005, AI-406) an access definition.
3004 -- N_Object_Declaration
3005 -- Sloc points to first identifier
3006 -- Defining_Identifier
3007 -- Aliased_Present
3008 -- Constant_Present set if CONSTANT appears
3009 -- Null_Exclusion_Present
3010 -- Object_Definition subtype indic./array type def./access def.
3011 -- Expression (set to Empty if not present)
3012 -- Handler_List_Entry
3013 -- Corresponding_Generic_Association
3014 -- More_Ids (set to False if no more identifiers in list)
3015 -- Prev_Ids (set to False if no previous identifiers in list)
3016 -- No_Initialization
3017 -- Assignment_OK
3018 -- Exception_Junk
3019 -- Is_Subprogram_Descriptor
3020 -- Has_Init_Expression
3021 -- Suppress_Assignment_Checks
3023 -------------------------------------
3024 -- 3.3.1 Defining Identifier List --
3025 -------------------------------------
3027 -- DEFINING_IDENTIFIER_LIST ::=
3028 -- DEFINING_IDENTIFIER {, DEFINING_IDENTIFIER}
3030 -------------------------------
3031 -- 3.3.2 Number Declaration --
3032 -------------------------------
3034 -- NUMBER_DECLARATION ::=
3035 -- DEFINING_IDENTIFIER_LIST : constant := static_EXPRESSION;
3037 -- Although the syntax allows multiple identifiers in the list, the
3038 -- semantics is as though successive declarations were given with
3039 -- identical expressions. To simplify semantic processing, the parser
3040 -- represents a multiple declaration case as a sequence of single
3041 -- declarations, using the More_Ids and Prev_Ids flags to preserve
3042 -- the original source form as described in the section on "Handling
3043 -- of Defining Identifier Lists".
3045 -- N_Number_Declaration
3046 -- Sloc points to first identifier
3047 -- Defining_Identifier
3048 -- Expression
3049 -- More_Ids (set to False if no more identifiers in list)
3050 -- Prev_Ids (set to False if no previous identifiers in list)
3052 ----------------------------------
3053 -- 3.4 Derived Type Definition --
3054 ----------------------------------
3056 -- DERIVED_TYPE_DEFINITION ::=
3057 -- [abstract] [limited] new [NULL_EXCLUSION] parent_SUBTYPE_INDICATION
3058 -- [[and INTERFACE_LIST] RECORD_EXTENSION_PART]
3060 -- Note: ABSTRACT, LIMITED, and record extension part are not permitted
3061 -- in Ada 83 mode.
3063 -- Note: a record extension part is required if ABSTRACT is present
3065 -- N_Derived_Type_Definition
3066 -- Sloc points to NEW
3067 -- Abstract_Present
3068 -- Null_Exclusion_Present (set to False if not present)
3069 -- Subtype_Indication
3070 -- Record_Extension_Part (set to Empty if not present)
3071 -- Limited_Present
3072 -- Task_Present set in task interfaces
3073 -- Protected_Present set in protected interfaces
3074 -- Synchronized_Present set in interfaces
3075 -- Interface_List (set to No_List if none)
3076 -- Interface_Present set in abstract interfaces
3078 -- Note: Task_Present, Protected_Present, Synchronized_Present,
3079 -- Interface_List, and Interface_Present are used for abstract
3080 -- interfaces (see comments for INTERFACE_TYPE_DEFINITION).
3082 ---------------------------
3083 -- 3.5 Range Constraint --
3084 ---------------------------
3086 -- RANGE_CONSTRAINT ::= range RANGE
3088 -- N_Range_Constraint
3089 -- Sloc points to RANGE
3090 -- Range_Expression
3092 ----------------
3093 -- 3.5 Range --
3094 ----------------
3096 -- RANGE ::=
3097 -- RANGE_ATTRIBUTE_REFERENCE
3098 -- | SIMPLE_EXPRESSION .. SIMPLE_EXPRESSION
3100 -- Note: the case of a range given as a range attribute reference
3101 -- appears directly in the tree as an attribute reference.
3103 -- Note: the field name for a reference to a range is Range_Expression
3104 -- rather than Range, because range is a reserved keyword in Ada.
3106 -- Note: the reason that this node has expression fields is that a
3107 -- range can appear as an operand of a membership test. The Etype
3108 -- field is the type of the range (we do NOT construct an implicit
3109 -- subtype to represent the range exactly).
3111 -- N_Range
3112 -- Sloc points to ..
3113 -- Low_Bound
3114 -- High_Bound
3115 -- Cannot_Be_Superflat
3116 -- Includes_Infinities
3117 -- plus fields for expression
3119 -- Note: if the range appears in a context, such as a subtype
3120 -- declaration, where range checks are required on one or both of
3121 -- the expression fields, then type conversion nodes are inserted
3122 -- to represent the required checks.
3124 ----------------------------------------
3125 -- 3.5.1 Enumeration Type Definition --
3126 ----------------------------------------
3128 -- ENUMERATION_TYPE_DEFINITION ::=
3129 -- (ENUMERATION_LITERAL_SPECIFICATION
3130 -- {, ENUMERATION_LITERAL_SPECIFICATION})
3132 -- Note: the Literals field in the node described below is null for
3133 -- the case of the standard types CHARACTER and WIDE_CHARACTER, for
3134 -- which special processing handles these types as special cases.
3136 -- N_Enumeration_Type_Definition
3137 -- Sloc points to left parenthesis
3138 -- Literals (Empty for CHARACTER or WIDE_CHARACTER)
3139 -- End_Label (set to Empty if internally generated record)
3141 ----------------------------------------------
3142 -- 3.5.1 Enumeration Literal Specification --
3143 ----------------------------------------------
3145 -- ENUMERATION_LITERAL_SPECIFICATION ::=
3146 -- DEFINING_IDENTIFIER | DEFINING_CHARACTER_LITERAL
3148 ---------------------------------------
3149 -- 3.5.1 Defining Character Literal --
3150 ---------------------------------------
3152 -- DEFINING_CHARACTER_LITERAL ::= CHARACTER_LITERAL
3154 -- A defining character literal is an entity, which has additional
3155 -- fields depending on the setting of the Ekind field. These
3156 -- additional fields are defined (and access subprograms declared)
3157 -- in package Einfo.
3159 -- Note: N_Defining_Character_Literal is an extended node whose fields
3160 -- are deliberately laid out to match layout of fields in an ordinary
3161 -- N_Character_Literal node, allowing for easy alteration of a character
3162 -- literal node into a defining character literal node. For details, see
3163 -- Sinfo.CN.Change_Character_Literal_To_Defining_Character_Literal.
3165 -- N_Defining_Character_Literal
3166 -- Sloc points to literal
3167 -- Chars contains the Name_Id for the identifier
3168 -- Next_Entity
3169 -- Scope
3170 -- Etype
3172 ------------------------------------
3173 -- 3.5.4 Integer Type Definition --
3174 ------------------------------------
3176 -- Note: there is an error in this rule in the latest version of the
3177 -- grammar, so we have retained the old rule pending clarification.
3179 -- INTEGER_TYPE_DEFINITION ::=
3180 -- SIGNED_INTEGER_TYPE_DEFINITION
3181 -- | MODULAR_TYPE_DEFINITION
3183 -------------------------------------------
3184 -- 3.5.4 Signed Integer Type Definition --
3185 -------------------------------------------
3187 -- SIGNED_INTEGER_TYPE_DEFINITION ::=
3188 -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION
3190 -- Note: the Low_Bound and High_Bound fields are set to Empty
3191 -- for integer types defined in package Standard.
3193 -- N_Signed_Integer_Type_Definition
3194 -- Sloc points to RANGE
3195 -- Low_Bound
3196 -- High_Bound
3198 ------------------------------------
3199 -- 3.5.4 Modular Type Definition --
3200 ------------------------------------
3202 -- MODULAR_TYPE_DEFINITION ::= mod static_EXPRESSION
3204 -- N_Modular_Type_Definition
3205 -- Sloc points to MOD
3206 -- Expression
3208 ---------------------------------
3209 -- 3.5.6 Real Type Definition --
3210 ---------------------------------
3212 -- REAL_TYPE_DEFINITION ::=
3213 -- FLOATING_POINT_DEFINITION | FIXED_POINT_DEFINITION
3215 --------------------------------------
3216 -- 3.5.7 Floating Point Definition --
3217 --------------------------------------
3219 -- FLOATING_POINT_DEFINITION ::=
3220 -- digits static_SIMPLE_EXPRESSION [REAL_RANGE_SPECIFICATION]
3222 -- Note: The Digits_Expression and Real_Range_Specifications fields
3223 -- are set to Empty for floating-point types declared in Standard.
3225 -- N_Floating_Point_Definition
3226 -- Sloc points to DIGITS
3227 -- Digits_Expression
3228 -- Real_Range_Specification (set to Empty if not present)
3230 -------------------------------------
3231 -- 3.5.7 Real Range Specification --
3232 -------------------------------------
3234 -- REAL_RANGE_SPECIFICATION ::=
3235 -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION
3237 -- N_Real_Range_Specification
3238 -- Sloc points to RANGE
3239 -- Low_Bound
3240 -- High_Bound
3242 -----------------------------------
3243 -- 3.5.9 Fixed Point Definition --
3244 -----------------------------------
3246 -- FIXED_POINT_DEFINITION ::=
3247 -- ORDINARY_FIXED_POINT_DEFINITION | DECIMAL_FIXED_POINT_DEFINITION
3249 --------------------------------------------
3250 -- 3.5.9 Ordinary Fixed Point Definition --
3251 --------------------------------------------
3253 -- ORDINARY_FIXED_POINT_DEFINITION ::=
3254 -- delta static_EXPRESSION REAL_RANGE_SPECIFICATION
3256 -- Note: In Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION
3258 -- N_Ordinary_Fixed_Point_Definition
3259 -- Sloc points to DELTA
3260 -- Delta_Expression
3261 -- Real_Range_Specification
3263 -------------------------------------------
3264 -- 3.5.9 Decimal Fixed Point Definition --
3265 -------------------------------------------
3267 -- DECIMAL_FIXED_POINT_DEFINITION ::=
3268 -- delta static_EXPRESSION
3269 -- digits static_EXPRESSION [REAL_RANGE_SPECIFICATION]
3271 -- Note: decimal types are not permitted in Ada 83 mode
3273 -- N_Decimal_Fixed_Point_Definition
3274 -- Sloc points to DELTA
3275 -- Delta_Expression
3276 -- Digits_Expression
3277 -- Real_Range_Specification (set to Empty if not present)
3279 ------------------------------
3280 -- 3.5.9 Digits Constraint --
3281 ------------------------------
3283 -- DIGITS_CONSTRAINT ::=
3284 -- digits static_EXPRESSION [RANGE_CONSTRAINT]
3286 -- Note: in Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION
3287 -- Note: in Ada 95, reduced accuracy subtypes are obsolescent
3289 -- N_Digits_Constraint
3290 -- Sloc points to DIGITS
3291 -- Digits_Expression
3292 -- Range_Constraint (set to Empty if not present)
3294 --------------------------------
3295 -- 3.6 Array Type Definition --
3296 --------------------------------
3298 -- ARRAY_TYPE_DEFINITION ::=
3299 -- UNCONSTRAINED_ARRAY_DEFINITION | CONSTRAINED_ARRAY_DEFINITION
3301 -----------------------------------------
3302 -- 3.6 Unconstrained Array Definition --
3303 -----------------------------------------
3305 -- UNCONSTRAINED_ARRAY_DEFINITION ::=
3306 -- array (INDEX_SUBTYPE_DEFINITION {, INDEX_SUBTYPE_DEFINITION}) of
3307 -- COMPONENT_DEFINITION
3309 -- Note: dimensionality of array is indicated by number of entries in
3310 -- the Subtype_Marks list, which has one entry for each dimension.
3312 -- N_Unconstrained_Array_Definition
3313 -- Sloc points to ARRAY
3314 -- Subtype_Marks
3315 -- Component_Definition
3317 -----------------------------------
3318 -- 3.6 Index Subtype Definition --
3319 -----------------------------------
3321 -- INDEX_SUBTYPE_DEFINITION ::= SUBTYPE_MARK range <>
3323 -- There is no explicit node in the tree for an index subtype
3324 -- definition since the N_Unconstrained_Array_Definition node
3325 -- incorporates the type marks which appear in this context.
3327 ---------------------------------------
3328 -- 3.6 Constrained Array Definition --
3329 ---------------------------------------
3331 -- CONSTRAINED_ARRAY_DEFINITION ::=
3332 -- array (DISCRETE_SUBTYPE_DEFINITION
3333 -- {, DISCRETE_SUBTYPE_DEFINITION})
3334 -- of COMPONENT_DEFINITION
3336 -- Note: dimensionality of array is indicated by number of entries
3337 -- in the Discrete_Subtype_Definitions list, which has one entry
3338 -- for each dimension.
3340 -- N_Constrained_Array_Definition
3341 -- Sloc points to ARRAY
3342 -- Discrete_Subtype_Definitions
3343 -- Component_Definition
3345 -- Note: although the language allows the full syntax for discrete
3346 -- subtype definitions (i.e. a discrete subtype indication or a range),
3347 -- in the generated tree, we always rewrite these as N_Range nodes.
3349 --------------------------------------
3350 -- 3.6 Discrete Subtype Definition --
3351 --------------------------------------
3353 -- DISCRETE_SUBTYPE_DEFINITION ::=
3354 -- discrete_SUBTYPE_INDICATION | RANGE
3356 -------------------------------
3357 -- 3.6 Component Definition --
3358 -------------------------------
3360 -- COMPONENT_DEFINITION ::=
3361 -- [aliased] [NULL_EXCLUSION] SUBTYPE_INDICATION | ACCESS_DEFINITION
3363 -- Note: although the syntax does not permit a component definition to
3364 -- be an anonymous array (and the parser will diagnose such an attempt
3365 -- with an appropriate message), it is possible for anonymous arrays
3366 -- to appear as component definitions. The semantics and back end handle
3367 -- this case properly, and the expander in fact generates such cases.
3368 -- Access_Definition is an optional field that gives support to
3369 -- Ada 2005 (AI-230). The parser generates nodes that have either the
3370 -- Subtype_Indication field or else the Access_Definition field.
3372 -- N_Component_Definition
3373 -- Sloc points to ALIASED, ACCESS, or to first token of subtype mark
3374 -- Aliased_Present
3375 -- Null_Exclusion_Present
3376 -- Subtype_Indication (set to Empty if not present)
3377 -- Access_Definition (set to Empty if not present)
3379 -----------------------------
3380 -- 3.6.1 Index Constraint --
3381 -----------------------------
3383 -- INDEX_CONSTRAINT ::= (DISCRETE_RANGE {, DISCRETE_RANGE})
3385 -- It is not in general possible to distinguish between discriminant
3386 -- constraints and index constraints at parse time, since a simple
3387 -- name could be either the subtype mark of a discrete range, or an
3388 -- expression in a discriminant association with no name. Either
3389 -- entry appears simply as the name, and the semantic parse must
3390 -- distinguish between the two cases. Thus we use a common tree
3391 -- node format for both of these constraint types.
3393 -- See Discriminant_Constraint for format of node
3395 ---------------------------
3396 -- 3.6.1 Discrete Range --
3397 ---------------------------
3399 -- DISCRETE_RANGE ::= discrete_SUBTYPE_INDICATION | RANGE
3401 ----------------------------
3402 -- 3.7 Discriminant Part --
3403 ----------------------------
3405 -- DISCRIMINANT_PART ::=
3406 -- UNKNOWN_DISCRIMINANT_PART | KNOWN_DISCRIMINANT_PART
3408 ------------------------------------
3409 -- 3.7 Unknown Discriminant Part --
3410 ------------------------------------
3412 -- UNKNOWN_DISCRIMINANT_PART ::= (<>)
3414 -- Note: unknown discriminant parts are not permitted in Ada 83 mode
3416 -- There is no explicit node in the tree for an unknown discriminant
3417 -- part. Instead the Unknown_Discriminants_Present flag is set in the
3418 -- parent node.
3420 ----------------------------------
3421 -- 3.7 Known Discriminant Part --
3422 ----------------------------------
3424 -- KNOWN_DISCRIMINANT_PART ::=
3425 -- (DISCRIMINANT_SPECIFICATION {; DISCRIMINANT_SPECIFICATION})
3427 -------------------------------------
3428 -- 3.7 Discriminant Specification --
3429 -------------------------------------
3431 -- DISCRIMINANT_SPECIFICATION ::=
3432 -- DEFINING_IDENTIFIER_LIST : [NULL_EXCLUSION] SUBTYPE_MARK
3433 -- [:= DEFAULT_EXPRESSION]
3434 -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION
3435 -- [:= DEFAULT_EXPRESSION]
3437 -- Although the syntax allows multiple identifiers in the list, the
3438 -- semantics is as though successive specifications were given with
3439 -- identical type definition and expression components. To simplify
3440 -- semantic processing, the parser represents a multiple declaration
3441 -- case as a sequence of single specifications, using the More_Ids and
3442 -- Prev_Ids flags to preserve the original source form as described
3443 -- in the section on "Handling of Defining Identifier Lists".
3445 -- N_Discriminant_Specification
3446 -- Sloc points to first identifier
3447 -- Defining_Identifier
3448 -- Null_Exclusion_Present
3449 -- Discriminant_Type subtype mark or access parameter definition
3450 -- Expression (set to Empty if no default expression)
3451 -- More_Ids (set to False if no more identifiers in list)
3452 -- Prev_Ids (set to False if no previous identifiers in list)
3454 -----------------------------
3455 -- 3.7 Default Expression --
3456 -----------------------------
3458 -- DEFAULT_EXPRESSION ::= EXPRESSION
3460 ------------------------------------
3461 -- 3.7.1 Discriminant Constraint --
3462 ------------------------------------
3464 -- DISCRIMINANT_CONSTRAINT ::=
3465 -- (DISCRIMINANT_ASSOCIATION {, DISCRIMINANT_ASSOCIATION})
3467 -- It is not in general possible to distinguish between discriminant
3468 -- constraints and index constraints at parse time, since a simple
3469 -- name could be either the subtype mark of a discrete range, or an
3470 -- expression in a discriminant association with no name. Either
3471 -- entry appears simply as the name, and the semantic parse must
3472 -- distinguish between the two cases. Thus we use a common tree
3473 -- node format for both of these constraint types.
3475 -- N_Index_Or_Discriminant_Constraint
3476 -- Sloc points to left paren
3477 -- Constraints points to list of discrete ranges or
3478 -- discriminant associations
3480 -------------------------------------
3481 -- 3.7.1 Discriminant Association --
3482 -------------------------------------
3484 -- DISCRIMINANT_ASSOCIATION ::=
3485 -- [discriminant_SELECTOR_NAME
3486 -- {| discriminant_SELECTOR_NAME} =>] EXPRESSION
3488 -- Note: a discriminant association that has no selector name list
3489 -- appears directly as an expression in the tree.
3491 -- N_Discriminant_Association
3492 -- Sloc points to first token of discriminant association
3493 -- Selector_Names (always non-empty, since if no selector
3494 -- names are present, this node is not used, see comment above)
3495 -- Expression
3497 ---------------------------------
3498 -- 3.8 Record Type Definition --
3499 ---------------------------------
3501 -- RECORD_TYPE_DEFINITION ::=
3502 -- [[abstract] tagged] [limited] RECORD_DEFINITION
3504 -- Note: ABSTRACT, TAGGED, LIMITED are not permitted in Ada 83 mode
3506 -- There is no explicit node in the tree for a record type definition.
3507 -- Instead the flags for Tagged_Present and Limited_Present appear in
3508 -- the N_Record_Definition node for a record definition appearing in
3509 -- the context of a record type definition.
3511 ----------------------------
3512 -- 3.8 Record Definition --
3513 ----------------------------
3515 -- RECORD_DEFINITION ::=
3516 -- record
3517 -- COMPONENT_LIST
3518 -- end record
3519 -- | null record
3521 -- Note: the Abstract_Present, Tagged_Present, and Limited_Present
3522 -- flags appear only for a record definition appearing in a record
3523 -- type definition.
3525 -- Note: the NULL RECORD case is not permitted in Ada 83
3527 -- N_Record_Definition
3528 -- Sloc points to RECORD or NULL
3529 -- End_Label (set to Empty if internally generated record)
3530 -- Abstract_Present
3531 -- Tagged_Present
3532 -- Limited_Present
3533 -- Component_List empty in null record case
3534 -- Null_Present set in null record case
3535 -- Task_Present set in task interfaces
3536 -- Protected_Present set in protected interfaces
3537 -- Synchronized_Present set in interfaces
3538 -- Interface_Present set in abstract interfaces
3539 -- Interface_List (set to No_List if none)
3541 -- Note: Task_Present, Protected_Present, Synchronized _Present,
3542 -- Interface_List and Interface_Present are used for abstract
3543 -- interfaces (see comments for INTERFACE_TYPE_DEFINITION).
3545 -------------------------
3546 -- 3.8 Component List --
3547 -------------------------
3549 -- COMPONENT_LIST ::=
3550 -- COMPONENT_ITEM {COMPONENT_ITEM}
3551 -- | {COMPONENT_ITEM} VARIANT_PART
3552 -- | null;
3554 -- N_Component_List
3555 -- Sloc points to first token of component list
3556 -- Component_Items
3557 -- Variant_Part (set to Empty if no variant part)
3558 -- Null_Present
3560 -------------------------
3561 -- 3.8 Component Item --
3562 -------------------------
3564 -- COMPONENT_ITEM ::= COMPONENT_DECLARATION | REPRESENTATION_CLAUSE
3566 -- Note: A component item can also be a pragma, and in the tree
3567 -- that is obtained after semantic processing, a component item
3568 -- can be an N_Null node resulting from a non-recognized pragma.
3570 --------------------------------
3571 -- 3.8 Component Declaration --
3572 --------------------------------
3574 -- COMPONENT_DECLARATION ::=
3575 -- DEFINING_IDENTIFIER_LIST : COMPONENT_DEFINITION
3576 -- [:= DEFAULT_EXPRESSION]
3577 -- [ASPECT_SPECIFICATIONS];
3579 -- Note: although the syntax does not permit a component definition to
3580 -- be an anonymous array (and the parser will diagnose such an attempt
3581 -- with an appropriate message), it is possible for anonymous arrays
3582 -- to appear as component definitions. The semantics and back end handle
3583 -- this case properly, and the expander in fact generates such cases.
3585 -- Although the syntax allows multiple identifiers in the list, the
3586 -- semantics is as though successive declarations were given with the
3587 -- same component definition and expression components. To simplify
3588 -- semantic processing, the parser represents a multiple declaration
3589 -- case as a sequence of single declarations, using the More_Ids and
3590 -- Prev_Ids flags to preserve the original source form as described
3591 -- in the section on "Handling of Defining Identifier Lists".
3593 -- N_Component_Declaration
3594 -- Sloc points to first identifier
3595 -- Defining_Identifier
3596 -- Component_Definition
3597 -- Expression (set to Empty if no default expression)
3598 -- More_Ids (set to False if no more identifiers in list)
3599 -- Prev_Ids (set to False if no previous identifiers in list)
3601 -------------------------
3602 -- 3.8.1 Variant Part --
3603 -------------------------
3605 -- VARIANT_PART ::=
3606 -- case discriminant_DIRECT_NAME is
3607 -- VARIANT {VARIANT}
3608 -- end case;
3610 -- Note: the variants list can contain pragmas as well as variants.
3611 -- In a properly formed program there is at least one variant.
3613 -- N_Variant_Part
3614 -- Sloc points to CASE
3615 -- Name
3616 -- Variants
3618 --------------------
3619 -- 3.8.1 Variant --
3620 --------------------
3622 -- VARIANT ::=
3623 -- when DISCRETE_CHOICE_LIST =>
3624 -- COMPONENT_LIST
3626 -- N_Variant
3627 -- Sloc points to WHEN
3628 -- Discrete_Choices
3629 -- Component_List
3630 -- Enclosing_Variant
3631 -- Present_Expr
3632 -- Dcheck_Function
3633 -- Has_SP_Choice
3635 -- Note: in the list of Discrete_Choices, the tree passed to the back
3636 -- end does not have choice entries corresponding to names of statically
3637 -- predicated subtypes. Such entries are always expanded out to the list
3638 -- of equivalent values or ranges.
3640 ---------------------------------
3641 -- 3.8.1 Discrete Choice List --
3642 ---------------------------------
3644 -- DISCRETE_CHOICE_LIST ::= DISCRETE_CHOICE {| DISCRETE_CHOICE}
3646 ----------------------------
3647 -- 3.8.1 Discrete Choice --
3648 ----------------------------
3650 -- DISCRETE_CHOICE ::= EXPRESSION | DISCRETE_RANGE | others
3652 -- Note: in Ada 83 mode, the expression must be a simple expression
3654 -- The only choice that appears explicitly is the OTHERS choice, as
3655 -- defined here. Other cases of discrete choice (expression and
3656 -- discrete range) appear directly. This production is also used
3657 -- for the OTHERS possibility of an exception choice.
3659 -- Note: in accordance with the syntax, the parser does not check that
3660 -- OTHERS appears at the end on its own in a choice list context. This
3661 -- is a semantic check.
3663 -- N_Others_Choice
3664 -- Sloc points to OTHERS
3665 -- Others_Discrete_Choices
3666 -- All_Others
3668 ----------------------------------
3669 -- 3.9.1 Record Extension Part --
3670 ----------------------------------
3672 -- RECORD_EXTENSION_PART ::= with RECORD_DEFINITION
3674 -- Note: record extension parts are not permitted in Ada 83 mode
3676 --------------------------------------
3677 -- 3.9.4 Interface Type Definition --
3678 --------------------------------------
3680 -- INTERFACE_TYPE_DEFINITION ::=
3681 -- [limited | task | protected | synchronized]
3682 -- interface [interface_list]
3684 -- Note: Interfaces are implemented with N_Record_Definition and
3685 -- N_Derived_Type_Definition nodes because most of the support
3686 -- for the analysis of abstract types has been reused to
3687 -- analyze abstract interfaces.
3689 ----------------------------------
3690 -- 3.10 Access Type Definition --
3691 ----------------------------------
3693 -- ACCESS_TYPE_DEFINITION ::=
3694 -- ACCESS_TO_OBJECT_DEFINITION
3695 -- | ACCESS_TO_SUBPROGRAM_DEFINITION
3697 --------------------------
3698 -- 3.10 Null Exclusion --
3699 --------------------------
3701 -- NULL_EXCLUSION ::= not null
3703 ---------------------------------------
3704 -- 3.10 Access To Object Definition --
3705 ---------------------------------------
3707 -- ACCESS_TO_OBJECT_DEFINITION ::=
3708 -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER]
3709 -- SUBTYPE_INDICATION
3711 -- N_Access_To_Object_Definition
3712 -- Sloc points to ACCESS
3713 -- All_Present
3714 -- Null_Exclusion_Present
3715 -- Null_Excluding_Subtype
3716 -- Subtype_Indication
3717 -- Constant_Present
3719 -----------------------------------
3720 -- 3.10 General Access Modifier --
3721 -----------------------------------
3723 -- GENERAL_ACCESS_MODIFIER ::= all | constant
3725 -- Note: general access modifiers are not permitted in Ada 83 mode
3727 -- There is no explicit node in the tree for general access modifier.
3728 -- Instead the All_Present or Constant_Present flags are set in the
3729 -- parent node.
3731 -------------------------------------------
3732 -- 3.10 Access To Subprogram Definition --
3733 -------------------------------------------
3735 -- ACCESS_TO_SUBPROGRAM_DEFINITION
3736 -- [NULL_EXCLUSION] access [protected] procedure PARAMETER_PROFILE
3737 -- | [NULL_EXCLUSION] access [protected] function
3738 -- PARAMETER_AND_RESULT_PROFILE
3740 -- Note: access to subprograms are not permitted in Ada 83 mode
3742 -- N_Access_Function_Definition
3743 -- Sloc points to ACCESS
3744 -- Null_Exclusion_Present
3745 -- Null_Exclusion_In_Return_Present
3746 -- Protected_Present
3747 -- Parameter_Specifications (set to No_List if no formal part)
3748 -- Result_Definition result subtype (subtype mark or access def)
3750 -- N_Access_Procedure_Definition
3751 -- Sloc points to ACCESS
3752 -- Null_Exclusion_Present
3753 -- Protected_Present
3754 -- Parameter_Specifications (set to No_List if no formal part)
3756 -----------------------------
3757 -- 3.10 Access Definition --
3758 -----------------------------
3760 -- ACCESS_DEFINITION ::=
3761 -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER] SUBTYPE_MARK
3762 -- | ACCESS_TO_SUBPROGRAM_DEFINITION
3764 -- Note: access to subprograms are an Ada 2005 (AI-254) extension
3766 -- N_Access_Definition
3767 -- Sloc points to ACCESS
3768 -- Null_Exclusion_Present
3769 -- All_Present
3770 -- Constant_Present
3771 -- Subtype_Mark
3772 -- Access_To_Subprogram_Definition (set to Empty if not present)
3774 -----------------------------------------
3775 -- 3.10.1 Incomplete Type Declaration --
3776 -----------------------------------------
3778 -- INCOMPLETE_TYPE_DECLARATION ::=
3779 -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] [IS TAGGED];
3781 -- N_Incomplete_Type_Declaration
3782 -- Sloc points to TYPE
3783 -- Defining_Identifier
3784 -- Discriminant_Specifications (set to No_List if no
3785 -- discriminant part, or if the discriminant part is an
3786 -- unknown discriminant part)
3787 -- Premature_Use used for improved diagnostics.
3788 -- Unknown_Discriminants_Present set if (<>) discriminant
3789 -- Tagged_Present
3791 ----------------------------
3792 -- 3.11 Declarative Part --
3793 ----------------------------
3795 -- DECLARATIVE_PART ::= {DECLARATIVE_ITEM}
3797 -- Note: although the parser enforces the syntactic requirement that
3798 -- a declarative part can contain only declarations, the semantic
3799 -- processing may add statements to the list of actions in a
3800 -- declarative part, so the code generator should be prepared
3801 -- to accept a statement in this position.
3803 ----------------------------
3804 -- 3.11 Declarative Item --
3805 ----------------------------
3807 -- DECLARATIVE_ITEM ::= BASIC_DECLARATIVE_ITEM | BODY
3809 ----------------------------------
3810 -- 3.11 Basic Declarative Item --
3811 ----------------------------------
3813 -- BASIC_DECLARATIVE_ITEM ::=
3814 -- BASIC_DECLARATION | REPRESENTATION_CLAUSE | USE_CLAUSE
3816 ----------------
3817 -- 3.11 Body --
3818 ----------------
3820 -- BODY ::= PROPER_BODY | BODY_STUB
3822 -----------------------
3823 -- 3.11 Proper Body --
3824 -----------------------
3826 -- PROPER_BODY ::=
3827 -- SUBPROGRAM_BODY | PACKAGE_BODY | TASK_BODY | PROTECTED_BODY
3829 ---------------
3830 -- 4.1 Name --
3831 ---------------
3833 -- NAME ::=
3834 -- DIRECT_NAME | EXPLICIT_DEREFERENCE
3835 -- | INDEXED_COMPONENT | SLICE
3836 -- | SELECTED_COMPONENT | ATTRIBUTE_REFERENCE
3837 -- | TYPE_CONVERSION | FUNCTION_CALL
3838 -- | CHARACTER_LITERAL
3840 ----------------------
3841 -- 4.1 Direct Name --
3842 ----------------------
3844 -- DIRECT_NAME ::= IDENTIFIER | OPERATOR_SYMBOL
3846 -----------------
3847 -- 4.1 Prefix --
3848 -----------------
3850 -- PREFIX ::= NAME | IMPLICIT_DEREFERENCE
3852 -------------------------------
3853 -- 4.1 Explicit Dereference --
3854 -------------------------------
3856 -- EXPLICIT_DEREFERENCE ::= NAME . all
3858 -- N_Explicit_Dereference
3859 -- Sloc points to ALL
3860 -- Prefix
3861 -- Actual_Designated_Subtype
3862 -- Has_Dereference_Action
3863 -- Atomic_Sync_Required
3864 -- plus fields for expression
3866 -------------------------------
3867 -- 4.1 Implicit Dereference --
3868 -------------------------------
3870 -- IMPLICIT_DEREFERENCE ::= NAME
3872 ------------------------------
3873 -- 4.1.1 Indexed Component --
3874 ------------------------------
3876 -- INDEXED_COMPONENT ::= PREFIX (EXPRESSION {, EXPRESSION})
3878 -- Note: the parser may generate this node in some situations where it
3879 -- should be a function call. The semantic pass must correct this
3880 -- misidentification (which is inevitable at the parser level).
3882 -- N_Indexed_Component
3883 -- Sloc contains a copy of the Sloc value of the Prefix
3884 -- Prefix
3885 -- Expressions
3886 -- Generalized_Indexing
3887 -- Atomic_Sync_Required
3888 -- plus fields for expression
3890 -- Note: if any of the subscripts requires a range check, then the
3891 -- Do_Range_Check flag is set on the corresponding expression, with
3892 -- the index type being determined from the type of the Prefix, which
3893 -- references the array being indexed.
3895 -- Note: in a fully analyzed and expanded indexed component node, and
3896 -- hence in any such node that gigi sees, if the prefix is an access
3897 -- type, then an explicit dereference operation has been inserted.
3899 ------------------
3900 -- 4.1.2 Slice --
3901 ------------------
3903 -- SLICE ::= PREFIX (DISCRETE_RANGE)
3905 -- Note: an implicit subtype is created to describe the resulting
3906 -- type, so that the bounds of this type are the bounds of the slice.
3908 -- N_Slice
3909 -- Sloc points to first token of prefix
3910 -- Prefix
3911 -- Discrete_Range
3912 -- plus fields for expression
3914 -------------------------------
3915 -- 4.1.3 Selected Component --
3916 -------------------------------
3918 -- SELECTED_COMPONENT ::= PREFIX . SELECTOR_NAME
3920 -- Note: selected components that are semantically expanded names get
3921 -- changed during semantic processing into the separate N_Expanded_Name
3922 -- node. See description of this node in the section on semantic nodes.
3924 -- N_Selected_Component
3925 -- Sloc points to the period
3926 -- Prefix
3927 -- Selector_Name
3928 -- Associated_Node
3929 -- Do_Discriminant_Check
3930 -- Is_In_Discriminant_Check
3931 -- Atomic_Sync_Required
3932 -- Is_Prefixed_Call
3933 -- plus fields for expression
3935 --------------------------
3936 -- 4.1.3 Selector Name --
3937 --------------------------
3939 -- SELECTOR_NAME ::= IDENTIFIER | CHARACTER_LITERAL | OPERATOR_SYMBOL
3941 --------------------------------
3942 -- 4.1.4 Attribute Reference --
3943 --------------------------------
3945 -- ATTRIBUTE_REFERENCE ::= PREFIX ' ATTRIBUTE_DESIGNATOR
3947 -- Note: the syntax is quite ambiguous at this point. Consider:
3949 -- A'Length (X) X is part of the attribute designator
3950 -- A'Pos (X) X is an explicit actual parameter of function A'Pos
3951 -- A'Class (X) X is the expression of a type conversion
3953 -- It would be possible for the parser to distinguish these cases
3954 -- by looking at the attribute identifier. However, that would mean
3955 -- more work in introducing new implementation defined attributes,
3956 -- and also it would mean that special processing for attributes
3957 -- would be scattered around, instead of being centralized in the
3958 -- semantic routine that handles an N_Attribute_Reference node.
3959 -- Consequently, the parser in all the above cases stores the
3960 -- expression (X in these examples) as a single element list in
3961 -- in the Expressions field of the N_Attribute_Reference node.
3963 -- Similarly, for attributes like Max which take two arguments,
3964 -- we store the two arguments as a two element list in the
3965 -- Expressions field. Of course it is clear at parse time that
3966 -- this case is really a function call with an attribute as the
3967 -- prefix, but it turns out to be convenient to handle the two
3968 -- argument case in a similar manner to the one argument case,
3969 -- and indeed in general the parser will accept any number of
3970 -- expressions in this position and store them as a list in the
3971 -- attribute reference node. This allows for future addition of
3972 -- attributes that take more than two arguments.
3974 -- Note: named associates are not permitted in function calls where
3975 -- the function is an attribute (see RM 6.4(3)) so it is legitimate
3976 -- to skip the normal subprogram argument processing.
3978 -- Note: for the attributes whose designators are technically keywords,
3979 -- i.e. digits, access, delta, range, the Attribute_Name field contains
3980 -- the corresponding name, even though no identifier is involved.
3982 -- Note: the generated code may contain stream attributes applied to
3983 -- limited types for which no stream routines exist officially. In such
3984 -- case, the result is to use the stream attribute for the underlying
3985 -- full type, or in the case of a protected type, the components
3986 -- (including any discriminants) are merely streamed in order.
3988 -- See Exp_Attr for a complete description of which attributes are
3989 -- passed onto Gigi, and which are handled entirely by the front end.
3991 -- Gigi restriction: For the Pos attribute, the prefix cannot be
3992 -- a non-standard enumeration type or a nonzero/zero semantics
3993 -- boolean type, so the value is simply the stored representation.
3995 -- Gigi requirement: For the Mechanism_Code attribute, if the prefix
3996 -- references a subprogram that is a renaming, then the front end must
3997 -- rewrite the attribute to refer directly to the renamed entity.
3999 -- Note: syntactically the prefix of an attribute reference must be a
4000 -- name, and this (somewhat artificial) requirement is enforced by the
4001 -- parser. However, for many attributes, such as 'Valid, it is quite
4002 -- reasonable to apply the attribute to any value, and hence to any
4003 -- expression. Internally in the tree, the prefix is an expression which
4004 -- does not have to be a name, and this is handled fine by the semantic
4005 -- analysis and expansion, and back ends. This arises for the case of
4006 -- attribute references built by the expander (e.g. 'Valid for the case
4007 -- of an implicit validity check).
4009 -- Note: In generated code, the Address and Unrestricted_Access
4010 -- attributes can be applied to any expression, and the meaning is
4011 -- to create an object containing the value (the object is in the
4012 -- current stack frame), and pass the address of this value. If the
4013 -- Must_Be_Byte_Aligned flag is set, then the object whose address
4014 -- is taken must be on a byte (storage unit) boundary, and if it is
4015 -- not (or may not be), then the generated code must create a copy
4016 -- that is byte aligned, and pass the address of this copy.
4018 -- N_Attribute_Reference
4019 -- Sloc points to apostrophe
4020 -- Prefix (general expression, see note above)
4021 -- Attribute_Name identifier name from attribute designator
4022 -- Expressions (set to No_List if no associated expressions)
4023 -- Entity used if the attribute yields a type
4024 -- Associated_Node
4025 -- Is_Elaboration_Checks_OK_Node
4026 -- Is_SPARK_Mode_On_Node
4027 -- Is_Elaboration_Warnings_OK_Node
4028 -- Header_Size_Added
4029 -- Redundant_Use
4030 -- Must_Be_Byte_Aligned
4031 -- plus fields for expression
4033 -- Note: in Modify_Tree_For_C mode, Max and Min attributes are expanded
4034 -- into equivalent if expressions, properly taking care of side effects.
4036 ---------------------------------
4037 -- 4.1.4 Attribute Designator --
4038 ---------------------------------
4040 -- ATTRIBUTE_DESIGNATOR ::=
4041 -- IDENTIFIER [(static_EXPRESSION)]
4042 -- | access | delta | digits
4044 -- There is no explicit node in the tree for an attribute designator.
4045 -- Instead the Attribute_Name and Expressions fields of the parent
4046 -- node (N_Attribute_Reference node) hold the information.
4048 -- Note: if ACCESS, DELTA, or DIGITS appears in an attribute
4049 -- designator, then they are treated as identifiers internally
4050 -- rather than the keywords of the same name.
4052 --------------------------------------
4053 -- 4.1.4 Range Attribute Reference --
4054 --------------------------------------
4056 -- RANGE_ATTRIBUTE_REFERENCE ::= PREFIX ' RANGE_ATTRIBUTE_DESIGNATOR
4058 -- A range attribute reference is represented in the tree using the
4059 -- normal N_Attribute_Reference node.
4061 ---------------------------------------
4062 -- 4.1.4 Range Attribute Designator --
4063 ---------------------------------------
4065 -- RANGE_ATTRIBUTE_DESIGNATOR ::= Range [(static_EXPRESSION)]
4067 -- A range attribute designator is represented in the tree using the
4068 -- normal N_Attribute_Reference node.
4070 --------------------
4071 -- 4.3 Aggregate --
4072 --------------------
4074 -- AGGREGATE ::=
4075 -- RECORD_AGGREGATE | EXTENSION_AGGREGATE | ARRAY_AGGREGATE
4077 -----------------------------
4078 -- 4.3.1 Record Aggregate --
4079 -----------------------------
4081 -- RECORD_AGGREGATE ::= (RECORD_COMPONENT_ASSOCIATION_LIST)
4083 -- N_Aggregate
4084 -- Sloc points to left parenthesis
4085 -- Expressions (set to No_List if none or null record case)
4086 -- Component_Associations (set to No_List if none)
4087 -- Null_Record_Present
4088 -- Aggregate_Bounds
4089 -- Associated_Node
4090 -- Compile_Time_Known_Aggregate
4091 -- Expansion_Delayed
4092 -- Has_Self_Reference
4093 -- Is_Enum_Array_Aggregate
4094 -- Is_Homogeneous_Aggregate
4095 -- Is_Parenthesis_Aggregate
4096 -- plus fields for expression
4098 -- Note: this structure is used for both record and array aggregates
4099 -- since the two cases are not separable by the parser. The parser
4100 -- makes no attempt to enforce consistency here, so it is up to the
4101 -- semantic phase to make sure that the aggregate is consistent (i.e.
4102 -- that it is not a "half-and-half" case that mixes record and array
4103 -- syntax). In particular, for a record aggregate, the expressions
4104 -- field will be set if there are positional associations.
4106 -- Note: N_Aggregate is not used for all aggregates; in particular,
4107 -- there is a separate node kind for extension aggregates.
4109 -- Note: gigi/gcc can handle array aggregates correctly providing that
4110 -- they are entirely positional, and the array subtype involved has a
4111 -- known at compile time length and is not bit packed, or a convention
4112 -- Fortran array with more than one dimension. If these conditions
4113 -- are not met, then the front end must translate the aggregate into
4114 -- an appropriate set of assignments into a temporary.
4116 -- Note: for the record aggregate case, gigi/gcc can handle most cases
4117 -- of record aggregates, including those for packed, and rep-claused
4118 -- records, and also variant records, providing that there are no
4119 -- variable length fields whose size is not known at compile time,
4120 -- and providing that the aggregate is presented in fully named form.
4122 -- The other situation in which array aggregates and record aggregates
4123 -- cannot be passed to the back end is if assignment to one or more
4124 -- components itself needs expansion, e.g. in the case of an assignment
4125 -- of an object of a controlled type. In such cases, the front end
4126 -- must expand the aggregate to a series of assignments, and apply
4127 -- the required expansion to the individual assignment statements.
4129 ----------------------------------------------
4130 -- 4.3.1 Record Component Association List --
4131 ----------------------------------------------
4133 -- RECORD_COMPONENT_ASSOCIATION_LIST ::=
4134 -- RECORD_COMPONENT_ASSOCIATION {, RECORD_COMPONENT_ASSOCIATION}
4135 -- | null record
4137 -- There is no explicit node in the tree for a record component
4138 -- association list. Instead the Null_Record_Present flag is set in
4139 -- the parent node for the NULL RECORD case.
4141 ------------------------------------------------------
4142 -- 4.3.1 Record Component Association (also 4.3.3) --
4143 ------------------------------------------------------
4145 -- RECORD_COMPONENT_ASSOCIATION ::=
4146 -- [COMPONENT_CHOICE_LIST =>] EXPRESSION
4148 -- N_Component_Association
4149 -- Sloc points to first selector name
4150 -- Choices
4151 -- Expression (empty if Box_Present)
4152 -- Loop_Actions
4153 -- Box_Present
4154 -- Inherited_Discriminant
4155 -- Binding_Chars
4157 -- Note: this structure is used for both record component associations
4158 -- and array component associations, since the two cases aren't always
4159 -- separable by the parser. The choices list may represent either a
4160 -- list of selector names in the record aggregate case, or a list of
4161 -- discrete choices in the array aggregate case or an N_Others_Choice
4162 -- node (which appears as a singleton list). Box_Present gives support
4163 -- to Ada 2005 (AI-287). Binding_Chars is only set if GNAT extensions
4164 -- are enabled and the given component association occurs within a
4165 -- choice_expression; in this case, it is the Name_Id, if any, specified
4166 -- via either of two syntactic forms: "Foo => Bar is Abc" or
4167 -- "Foo => <Abc>".
4169 ----------------------------------
4170 -- 4.3.1 Component Choice List --
4171 ----------------------------------
4173 -- COMPONENT_CHOICE_LIST ::=
4174 -- component_SELECTOR_NAME {| component_SELECTOR_NAME}
4175 -- | others
4177 -- The entries of a component choice list appear in the Choices list of
4178 -- the associated N_Component_Association, as either selector names, or
4179 -- as an N_Others_Choice node.
4181 --------------------------------
4182 -- 4.3.2 Extension Aggregate --
4183 --------------------------------
4185 -- EXTENSION_AGGREGATE ::=
4186 -- (ANCESTOR_PART with RECORD_COMPONENT_ASSOCIATION_LIST)
4188 -- Note: extension aggregates are not permitted in Ada 83 mode
4190 -- N_Extension_Aggregate
4191 -- Sloc points to left parenthesis
4192 -- Ancestor_Part
4193 -- Associated_Node
4194 -- Expressions (set to No_List if none or null record case)
4195 -- Component_Associations (set to No_List if none)
4196 -- Null_Record_Present
4197 -- Expansion_Delayed
4198 -- Has_Self_Reference
4199 -- plus fields for expression
4201 --------------------------
4202 -- 4.3.2 Ancestor Part --
4203 --------------------------
4205 -- ANCESTOR_PART ::= EXPRESSION | SUBTYPE_MARK
4207 ----------------------------
4208 -- 4.3.3 Array Aggregate --
4209 ----------------------------
4211 -- ARRAY_AGGREGATE ::=
4212 -- POSITIONAL_ARRAY_AGGREGATE | NAMED_ARRAY_AGGREGATE
4214 ---------------------------------------
4215 -- 4.3.3 Positional Array Aggregate --
4216 ---------------------------------------
4218 -- POSITIONAL_ARRAY_AGGREGATE ::=
4219 -- (EXPRESSION, EXPRESSION {, EXPRESSION})
4220 -- | (EXPRESSION {, EXPRESSION}, others => EXPRESSION)
4222 -- See Record_Aggregate (4.3.1) for node structure
4224 ----------------------------------
4225 -- 4.3.3 Named Array Aggregate --
4226 ----------------------------------
4228 -- NAMED_ARRAY_AGGREGATE ::=
4229 -- (ARRAY_COMPONENT_ASSOCIATION {, ARRAY_COMPONENT_ASSOCIATION})
4231 -- See Record_Aggregate (4.3.1) for node structure
4233 ----------------------------------------
4234 -- 4.3.3 Array Component Association --
4235 ----------------------------------------
4237 -- ARRAY_COMPONENT_ASSOCIATION ::=
4238 -- DISCRETE_CHOICE_LIST => EXPRESSION
4239 -- | ITERATED_COMPONENT_ASSOCIATION
4241 -- See Record_Component_Association (4.3.1) for node structure
4242 -- The iterated_component_association is introduced into the
4243 -- Corrigendum of Ada_2012 by AI12-061.
4245 ------------------------------------------
4246 -- 4.3.3 Iterated component Association --
4247 ------------------------------------------
4249 -- ITERATED_COMPONENT_ASSOCIATION ::=
4250 -- for DEFINING_IDENTIFIER in DISCRETE_CHOICE_LIST => EXPRESSION
4251 -- for ITERATOR_SPECIFICATION => EXPRESSION
4253 -- At most one of (Defining_Identifier, Iterator_Specification)
4254 -- is present at a time, in which case the other one is empty.
4256 -- N_Iterated_Component_Association
4257 -- Sloc points to FOR
4258 -- Defining_Identifier
4259 -- Iterator_Specification
4260 -- Expression
4261 -- Discrete_Choices
4262 -- Loop_Actions
4263 -- Box_Present
4265 -- Note that Box_Present is always False, but it is intentionally added
4266 -- for completeness.
4268 ----------------------------
4269 -- 4.3.4 Delta Aggregate --
4270 ----------------------------
4272 -- N_Delta_Aggregate
4273 -- Sloc points to left parenthesis
4274 -- Expression
4275 -- Component_Associations
4276 -- Etype
4278 ---------------------------------
4279 -- 3.4.5 Container_Aggregates --
4280 ---------------------------------
4282 -- ITERATED_ELEMENT_ASSOCIATION ::=
4283 -- for LOOP_PARAMETER_SPECIFICATION[ use KEY_EXPRESSION] => EXPRESSION
4284 -- | for ITERATOR_SPECIFICATION[ use KEY_EXPRESSION] => EXPRESSION
4286 -- N_Iterated_Element_Association
4287 -- Key_Expression
4288 -- Iterator_Specification
4289 -- Expression
4290 -- Loop_Parameter_Specification
4291 -- Loop_Actions
4292 -- Box_Present
4294 -- Exactly one of Iterator_Specification or Loop_Parameter_
4295 -- specification is present. If the Key_Expression is absent,
4296 -- the construct is parsed as an Iterated_Component_Association,
4297 -- and legality checks are performed during semantic analysis.
4299 -- Both iterated associations are Ada 2022 features that are
4300 -- expanded during aggregate construction, and do not appear in
4301 -- expanded code.
4303 --------------------------------------------------
4304 -- 4.4 Expression/Relation/Term/Factor/Primary --
4305 --------------------------------------------------
4307 -- EXPRESSION ::=
4308 -- RELATION {LOGICAL_OPERATOR RELATION}
4310 -- CHOICE_EXPRESSION ::=
4311 -- CHOICE_RELATION {LOGICAL_OPERATOR CHOICE_RELATION}
4313 -- CHOICE_RELATION ::=
4314 -- SIMPLE_EXPRESSION [RELATIONAL_OPERATOR SIMPLE_EXPRESSION]
4316 -- RELATION ::=
4317 -- SIMPLE_EXPRESSION [not] in MEMBERSHIP_CHOICE_LIST
4318 -- | RAISE_EXPRESSION
4320 -- MEMBERSHIP_CHOICE_LIST ::=
4321 -- MEMBERSHIP_CHOICE {'|' MEMBERSHIP CHOICE}
4323 -- MEMBERSHIP_CHOICE ::=
4324 -- CHOICE_EXPRESSION | RANGE | SUBTYPE_MARK
4326 -- LOGICAL_OPERATOR ::= and | and then | or | or else | xor
4328 -- SIMPLE_EXPRESSION ::=
4329 -- [UNARY_ADDING_OPERATOR] TERM {BINARY_ADDING_OPERATOR TERM}
4331 -- TERM ::= FACTOR {MULTIPLYING_OPERATOR FACTOR}
4333 -- FACTOR ::= PRIMARY [** PRIMARY] | abs PRIMARY | not PRIMARY
4335 -- No nodes are generated for any of these constructs. Instead, the
4336 -- node for the operator appears directly. When we refer to an
4337 -- expression in this description, we mean any of the possible
4338 -- constituent components of an expression (e.g. identifier is
4339 -- an example of an expression).
4341 -- Note: the above syntax is that Ada 2012 syntax which restricts
4342 -- choice relations to simple expressions to avoid ambiguities in
4343 -- some contexts with set membership notation. It has been decided
4344 -- that in retrospect, the Ada 95 change allowing general expressions
4345 -- in this context was a mistake, so we have reverted to the above
4346 -- syntax in Ada 95 and Ada 2005 modes (the restriction to simple
4347 -- expressions was there in Ada 83 from the start).
4349 ------------------
4350 -- 4.4 Primary --
4351 ------------------
4353 -- PRIMARY ::=
4354 -- NUMERIC_LITERAL | null
4355 -- | STRING_LITERAL | AGGREGATE
4356 -- | NAME | QUALIFIED_EXPRESSION
4357 -- | ALLOCATOR | (EXPRESSION)
4359 -- Usually there is no explicit node in the tree for primary. Instead
4360 -- the constituent (e.g. AGGREGATE) appears directly. There are two
4361 -- exceptions. First, there is an explicit node for a null primary.
4363 -- N_Null
4364 -- Sloc points to NULL
4365 -- plus fields for expression
4367 -- Second, the case of (EXPRESSION) is handled specially. Ada requires
4368 -- that the parser keep track of which subexpressions are enclosed
4369 -- in parentheses, and how many levels of parentheses are used. This
4370 -- information is required for optimization purposes, and also for
4371 -- some semantic checks (e.g. (((1))) in a procedure spec does not
4372 -- conform with ((((1)))) in the body).
4374 -- The parentheses are recorded by keeping a Paren_Count field in every
4375 -- subexpression node (it is actually present in all nodes, but only
4376 -- used in subexpression nodes). This count records the number of
4377 -- levels of parentheses. If the number of levels in the source exceeds
4378 -- the maximum accommodated by this count, then the count is simply left
4379 -- at the maximum value. This means that there are some pathological
4380 -- cases of failure to detect conformance failures (e.g. an expression
4381 -- with 500 levels of parens will conform with one with 501 levels),
4382 -- but we do not need to lose sleep over this.
4384 -- Historical note: in versions of GNAT prior to 1.75, there was a node
4385 -- type N_Parenthesized_Expression used to accurately record unlimited
4386 -- numbers of levels of parentheses. However, it turned out to be a
4387 -- real nuisance to have to take into account the possible presence of
4388 -- this node during semantic analysis, since basically parentheses have
4389 -- zero relevance to semantic analysis.
4391 -- Note: the level of parentheses always present in things like
4392 -- aggregates does not count, only the parentheses in the primary
4393 -- (EXPRESSION) affect the setting of the Paren_Count field.
4395 -- 2nd Note: the contents of the Expression field must be ignored (i.e.
4396 -- treated as though it were Empty) if No_Initialization is set True.
4398 --------------------------------------
4399 -- 4.5 Short-Circuit Control Forms --
4400 --------------------------------------
4402 -- EXPRESSION ::=
4403 -- RELATION {and then RELATION} | RELATION {or else RELATION}
4405 -- Gigi restriction: For both these control forms, the operand and
4406 -- result types are always Standard.Boolean. The expander inserts the
4407 -- required conversion operations where needed to ensure this is the
4408 -- case.
4410 -- N_And_Then
4411 -- Sloc points to AND of AND THEN
4412 -- Left_Opnd
4413 -- Right_Opnd
4414 -- Actions
4415 -- plus fields for expression
4417 -- N_Or_Else
4418 -- Sloc points to OR of OR ELSE
4419 -- Left_Opnd
4420 -- Right_Opnd
4421 -- Actions
4422 -- plus fields for expression
4424 -- Note: The Actions field is used to hold actions associated with
4425 -- the right hand operand. These have to be treated specially since
4426 -- they are not unconditionally executed. See Insert_Actions for a
4427 -- more detailed description of how these actions are handled.
4429 ---------------------------
4430 -- 4.5 Membership Tests --
4431 ---------------------------
4433 -- RELATION ::=
4434 -- SIMPLE_EXPRESSION [not] in MEMBERSHIP_CHOICE_LIST
4436 -- MEMBERSHIP_CHOICE_LIST ::=
4437 -- MEMBERSHIP_CHOICE {'|' MEMBERSHIP CHOICE}
4439 -- MEMBERSHIP_CHOICE ::=
4440 -- CHOICE_EXPRESSION | RANGE | SUBTYPE_MARK
4442 -- Note: although the grammar above allows only a range or a subtype
4443 -- mark, the parser in fact will accept any simple expression in place
4444 -- of a subtype mark. This means that the semantic analyzer must be able
4445 -- to deal with, and diagnose a simple expression other than a name for
4446 -- the right operand. This simplifies error recovery in the parser.
4448 -- The Alternatives field below is present only if there is more than
4449 -- one Membership_Choice present (which is legitimate only in Ada 2012
4450 -- mode) in which case Right_Opnd is Empty, and Alternatives contains
4451 -- the list of choices. In the tree passed to the back end, Alternatives
4452 -- is always No_List, and Right_Opnd is set (i.e. the expansion circuit
4453 -- expands out the complex set membership case using simple membership
4454 -- and equality operations).
4456 -- Should we rename Alternatives here to Membership_Choices ???
4458 -- N_In
4459 -- Sloc points to IN
4460 -- Left_Opnd
4461 -- Right_Opnd
4462 -- Alternatives (set to No_List if only one set alternative)
4463 -- No_Minimize_Eliminate
4464 -- plus fields for expression
4466 -- N_Not_In
4467 -- Sloc points to NOT of NOT IN
4468 -- Left_Opnd
4469 -- Right_Opnd
4470 -- Alternatives (set to No_List if only one set alternative)
4471 -- No_Minimize_Eliminate
4472 -- plus fields for expression
4474 --------------------
4475 -- 4.5 Operators --
4476 --------------------
4478 -- LOGICAL_OPERATOR ::= and | or | xor
4480 -- RELATIONAL_OPERATOR ::= = | /= | < | <= | > | >=
4482 -- BINARY_ADDING_OPERATOR ::= + | - | &
4484 -- UNARY_ADDING_OPERATOR ::= + | -
4486 -- MULTIPLYING_OPERATOR ::= * | / | mod | rem
4488 -- HIGHEST_PRECEDENCE_OPERATOR ::= ** | abs | not
4490 -- Gigi restriction: Gigi will never be given * / mod rem nodes with
4491 -- fixed-point operands. All handling of smalls for multiplication and
4492 -- division is handled by the front end (mod and rem result only from
4493 -- expansion). Gigi thus never needs to worry about small values (for
4494 -- other operators operating on fixed-point, e.g. addition, the small
4495 -- value does not have any semantic effect anyway, these are always
4496 -- integer operations).
4498 -- Gigi restriction: For all operators taking Boolean operands, the
4499 -- type is always Standard.Boolean. The expander inserts the required
4500 -- conversion operations where needed to ensure this is the case.
4502 -- N_Op_And
4503 -- Sloc points to AND
4504 -- Do_Length_Check
4505 -- plus fields for binary operator
4506 -- plus fields for expression
4508 -- N_Op_Or
4509 -- Sloc points to OR
4510 -- Do_Length_Check
4511 -- plus fields for binary operator
4512 -- plus fields for expression
4514 -- N_Op_Xor
4515 -- Sloc points to XOR
4516 -- Do_Length_Check
4517 -- plus fields for binary operator
4518 -- plus fields for expression
4520 -- N_Op_Eq
4521 -- Sloc points to =
4522 -- plus fields for binary operator
4523 -- plus fields for expression
4525 -- N_Op_Ne
4526 -- Sloc points to /=
4527 -- plus fields for binary operator
4528 -- plus fields for expression
4530 -- N_Op_Lt
4531 -- Sloc points to <
4532 -- plus fields for binary operator
4533 -- plus fields for expression
4535 -- N_Op_Le
4536 -- Sloc points to <=
4537 -- plus fields for binary operator
4538 -- plus fields for expression
4540 -- N_Op_Gt
4541 -- Sloc points to >
4542 -- plus fields for binary operator
4543 -- plus fields for expression
4545 -- N_Op_Ge
4546 -- Sloc points to >=
4547 -- plus fields for binary operator
4548 -- plus fields for expression
4550 -- N_Op_Add
4551 -- Sloc points to + (binary)
4552 -- plus fields for binary operator
4553 -- plus fields for expression
4555 -- N_Op_Subtract
4556 -- Sloc points to - (binary)
4557 -- plus fields for binary operator
4558 -- plus fields for expression
4560 -- N_Op_Concat
4561 -- Sloc points to &
4562 -- Is_Component_Left_Opnd
4563 -- Is_Component_Right_Opnd
4564 -- plus fields for binary operator
4565 -- plus fields for expression
4567 -- N_Op_Multiply
4568 -- Sloc points to *
4569 -- Rounded_Result
4570 -- plus fields for binary operator
4571 -- plus fields for expression
4573 -- N_Op_Divide
4574 -- Sloc points to /
4575 -- Do_Division_Check
4576 -- Rounded_Result
4577 -- plus fields for binary operator
4578 -- plus fields for expression
4580 -- N_Op_Mod
4581 -- Sloc points to MOD
4582 -- Do_Division_Check
4583 -- plus fields for binary operator
4584 -- plus fields for expression
4586 -- N_Op_Rem
4587 -- Sloc points to REM
4588 -- Do_Division_Check
4589 -- plus fields for binary operator
4590 -- plus fields for expression
4592 -- N_Op_Expon
4593 -- Sloc points to **
4594 -- Is_Power_Of_2_For_Shift
4595 -- plus fields for binary operator
4596 -- plus fields for expression
4598 -- N_Op_Plus
4599 -- Sloc points to + (unary)
4600 -- plus fields for unary operator
4601 -- plus fields for expression
4603 -- N_Op_Minus
4604 -- Sloc points to - (unary)
4605 -- plus fields for unary operator
4606 -- plus fields for expression
4608 -- N_Op_Abs
4609 -- Sloc points to ABS
4610 -- plus fields for unary operator
4611 -- plus fields for expression
4613 -- N_Op_Not
4614 -- Sloc points to NOT
4615 -- plus fields for unary operator
4616 -- plus fields for expression
4618 -- See also shift operators in section B.2
4620 -- Note on fixed-point operations passed to Gigi: For adding operators,
4621 -- the semantics is to treat these simply as integer operations, with
4622 -- the small values being ignored (the bounds are already stored in
4623 -- units of small, so that constraint checking works as usual). For the
4624 -- case of multiply/divide/rem/mod operations, Gigi will never see them.
4626 -- Note on equality/inequality tests for records. In the expanded tree,
4627 -- record comparisons are always expanded to be a series of component
4628 -- comparisons, so the back end will never see an equality or inequality
4629 -- operation with operands of a record type.
4631 -- Note on overflow handling: When the overflow checking mode is set to
4632 -- MINIMIZED or ELIMINATED, nodes for signed arithmetic operations may
4633 -- be modified to use a larger type for the operands and result. In
4634 -- the case where the computed range exceeds that of Long_Long_Integer,
4635 -- and we are running in ELIMINATED mode, the operator node will be
4636 -- changed to be a call to the appropriate routine in System.Bignums.
4638 -- Note: In Modify_Tree_For_C mode, we do not generate an N_Op_Mod node
4639 -- for signed integer types (since there is no equivalent operator in
4640 -- C). Instead we rewrite such an operation in terms of REM (which is
4641 -- % in C) and other C-available operators.
4643 ------------------------------------
4644 -- 4.5.7 Conditional Expressions --
4645 ------------------------------------
4647 -- CONDITIONAL_EXPRESSION ::= IF_EXPRESSION | CASE_EXPRESSION
4649 --------------------------
4650 -- 4.5.7 If Expression --
4651 --------------------------
4653 -- IF_EXPRESSION ::=
4654 -- if CONDITION then DEPENDENT_EXPRESSION
4655 -- {elsif CONDITION then DEPENDENT_EXPRESSION}
4656 -- [else DEPENDENT_EXPRESSION]
4658 -- DEPENDENT_EXPRESSION ::= EXPRESSION
4660 -- Note: if we have (IF x1 THEN x2 ELSIF x3 THEN x4 ELSE x5) then it
4661 -- is represented as (IF x1 THEN x2 ELSE (IF x3 THEN x4 ELSE x5)) and
4662 -- the Is_Elsif flag is set on the inner if expression.
4664 -- N_If_Expression
4665 -- Sloc points to IF or ELSIF keyword
4666 -- Expressions
4667 -- Then_Actions
4668 -- Else_Actions
4669 -- Is_Elsif (set if comes from ELSIF)
4670 -- Do_Overflow_Check
4671 -- plus fields for expression
4673 -- Expressions here is a three-element list, whose first element is the
4674 -- condition, the second element is the dependent expression after THEN
4675 -- and the third element is the dependent expression after the ELSE
4676 -- (explicitly set to True if missing).
4678 -- Note: the Then_Actions and Else_Actions fields are always set to
4679 -- No_List in the tree passed to the back end. These are used only
4680 -- for temporary processing purposes in the expander. Even though they
4681 -- are semantic fields, their parent pointers are set because analysis
4682 -- of actions nodes in those lists may generate additional actions that
4683 -- need to know their insertion point (for example for the creation of
4684 -- transient scopes).
4686 -- Note: in the tree passed to the back end, if the result type is
4687 -- an unconstrained array, the if expression can only appears in the
4688 -- initializing expression of an object declaration (this avoids the
4689 -- back end having to create a variable length temporary on the fly).
4691 ----------------------------
4692 -- 4.5.7 Case Expression --
4693 ----------------------------
4695 -- CASE_EXPRESSION ::=
4696 -- case SELECTING_EXPRESSION is
4697 -- CASE_EXPRESSION_ALTERNATIVE
4698 -- {,CASE_EXPRESSION_ALTERNATIVE}
4700 -- Note that the Alternatives cannot include pragmas (this contrasts
4701 -- with the situation of case statements where pragmas are allowed).
4703 -- N_Case_Expression
4704 -- Sloc points to CASE
4705 -- Expression (the selecting expression)
4706 -- Alternatives (the case expression alternatives)
4707 -- Etype
4708 -- Do_Overflow_Check
4710 ----------------------------------------
4711 -- 4.5.7 Case Expression Alternative --
4712 ----------------------------------------
4714 -- CASE_EXPRESSION_ALTERNATIVE ::=
4715 -- when DISCRETE_CHOICE_LIST =>
4716 -- DEPENDENT_EXPRESSION
4718 -- N_Case_Expression_Alternative
4719 -- Sloc points to WHEN
4720 -- Actions
4721 -- Discrete_Choices
4722 -- Expression
4723 -- Has_SP_Choice
4725 -- Note: The Actions field temporarily holds any actions associated with
4726 -- evaluation of the Expression. During expansion of the case expression
4727 -- these actions are wrapped into an N_Expression_With_Actions node
4728 -- replacing the original expression.
4730 -- Note: this node never appears in the tree passed to the back end,
4731 -- since the expander converts case expressions into case statements.
4733 ---------------------------------
4734 -- 4.5.8 Quantified Expression --
4735 ---------------------------------
4737 -- QUANTIFIED_EXPRESSION ::=
4738 -- for QUANTIFIER LOOP_PARAMETER_SPECIFICATION => PREDICATE
4739 -- | for QUANTIFIER ITERATOR_SPECIFICATION => PREDICATE
4741 -- QUANTIFIER ::= all | some
4743 -- At most one of (Iterator_Specification, Loop_Parameter_Specification)
4744 -- is present at a time, in which case the other one is empty.
4746 -- N_Quantified_Expression
4747 -- Sloc points to FOR
4748 -- Iterator_Specification
4749 -- Loop_Parameter_Specification
4750 -- Condition
4751 -- All_Present
4753 --------------------------
4754 -- 4.6 Type Conversion --
4755 --------------------------
4757 -- TYPE_CONVERSION ::=
4758 -- SUBTYPE_MARK (EXPRESSION) | SUBTYPE_MARK (NAME)
4760 -- In the (NAME) case, the name is stored as the expression
4762 -- Note: the parser never generates a type conversion node, since it
4763 -- looks like an indexed component which is generated by preference.
4764 -- The semantic pass must correct this misidentification.
4766 -- Gigi handles conversions that involve no change in the root type,
4767 -- and also all conversions from integer to floating-point types.
4768 -- Conversions from floating-point to integer are only handled in
4769 -- the case where Float_Truncate flag set. Other conversions from
4770 -- floating-point to integer (involving rounding) and all conversions
4771 -- involving fixed-point types are handled by the expander, unless the
4772 -- Conversion_OK flag is set.
4774 -- Sprint syntax if Float_Truncate set: X^(Y)
4775 -- Sprint syntax if Conversion_OK set X?(Y)
4776 -- Sprint syntax if both flags set X?^(Y)
4778 -- Note: If either the operand or result type is fixed-point, Gigi will
4779 -- only see a type conversion node with Conversion_OK set. The front end
4780 -- takes care of all handling of small's for fixed-point conversions.
4782 -- N_Type_Conversion
4783 -- Sloc points to first token of subtype mark
4784 -- Subtype_Mark
4785 -- Expression
4786 -- Do_Discriminant_Check
4787 -- Do_Length_Check
4788 -- Float_Truncate
4789 -- Conversion_OK
4790 -- Do_Overflow_Check
4791 -- Rounded_Result
4792 -- plus fields for expression
4794 -- Note: if a range check is required, then the Do_Range_Check flag
4795 -- is set in the Expression with the check being done against the
4796 -- target type range (after the base type conversion, if any).
4798 -------------------------------
4799 -- 4.7 Qualified Expression --
4800 -------------------------------
4802 -- QUALIFIED_EXPRESSION ::=
4803 -- SUBTYPE_MARK ' (EXPRESSION) | SUBTYPE_MARK ' AGGREGATE
4805 -- Note: the parentheses in the (EXPRESSION) case are deemed to enclose
4806 -- the expression, so the Expression field of this node always points
4807 -- to a parenthesized expression in this case (i.e. Paren_Count will
4808 -- always be non-zero for the referenced expression if it is not an
4809 -- aggregate).
4811 -- N_Qualified_Expression
4812 -- Sloc points to apostrophe
4813 -- Subtype_Mark
4814 -- Expression expression or aggregate
4815 -- Is_Qualified_Universal_Literal
4816 -- plus fields for expression
4818 --------------------
4819 -- 4.8 Allocator --
4820 --------------------
4822 -- ALLOCATOR ::=
4823 -- new [SUBPOOL_SPECIFICATION] SUBTYPE_INDICATION
4824 -- | new [SUBPOOL_SPECIFICATION] QUALIFIED_EXPRESSION
4826 -- SUBPOOL_SPECIFICATION ::= (subpool_handle_NAME)
4828 -- Sprint syntax (when storage pool present)
4829 -- new xxx (storage_pool = pool)
4830 -- or
4831 -- new (subpool) xxx (storage_pool = pool)
4833 -- N_Allocator
4834 -- Sloc points to NEW
4835 -- Expression subtype indication or qualified expression
4836 -- Subpool_Handle_Name (set to Empty if not present)
4837 -- Storage_Pool
4838 -- Procedure_To_Call
4839 -- For_Special_Return_Object
4840 -- Null_Exclusion_Present
4841 -- No_Initialization
4842 -- Is_Static_Coextension
4843 -- Do_Storage_Check
4844 -- Is_Dynamic_Coextension
4845 -- plus fields for expression
4847 -- Note: like all nodes, the N_Allocator has the Comes_From_Source flag.
4848 -- This flag has a special function in conjunction with the restriction
4849 -- No_Implicit_Heap_Allocations, which will be triggered if this flag
4850 -- is not set. This means that if a source allocator is replaced with
4851 -- a constructed allocator, the Comes_From_Source flag should be copied
4852 -- to the newly created allocator.
4854 ---------------------------------
4855 -- 5.1 Sequence Of Statements --
4856 ---------------------------------
4858 -- SEQUENCE_OF_STATEMENTS ::= STATEMENT {STATEMENT}
4860 -- Note: Although the parser will not accept a declaration as a
4861 -- statement, the semantic analyzer may insert declarations (e.g.
4862 -- declarations of implicit types needed for execution of other
4863 -- statements) into a sequence of statements, so the code generator
4864 -- should be prepared to accept a declaration where a statement is
4865 -- expected. Note also that pragmas can appear as statements.
4867 --------------------
4868 -- 5.1 Statement --
4869 --------------------
4871 -- STATEMENT ::=
4872 -- {LABEL} SIMPLE_STATEMENT | {LABEL} COMPOUND_STATEMENT
4874 -- There is no explicit node in the tree for a statement. Instead, the
4875 -- individual statement appears directly. Labels are treated as a
4876 -- kind of statement, i.e. they are linked into a statement list at
4877 -- the point they appear, so the labeled statement appears following
4878 -- the label or labels in the statement list.
4880 ---------------------------
4881 -- 5.1 Simple Statement --
4882 ---------------------------
4884 -- SIMPLE_STATEMENT ::= NULL_STATEMENT
4885 -- | ASSIGNMENT_STATEMENT | EXIT_STATEMENT
4886 -- | GOTO_STATEMENT | PROCEDURE_CALL_STATEMENT
4887 -- | SIMPLE_RETURN_STATEMENT | ENTRY_CALL_STATEMENT
4888 -- | REQUEUE_STATEMENT | DELAY_STATEMENT
4889 -- | ABORT_STATEMENT | RAISE_STATEMENT
4890 -- | CODE_STATEMENT
4892 -----------------------------
4893 -- 5.1 Compound Statement --
4894 -----------------------------
4896 -- COMPOUND_STATEMENT ::=
4897 -- IF_STATEMENT | CASE_STATEMENT
4898 -- | LOOP_STATEMENT | BLOCK_STATEMENT
4899 -- | EXTENDED_RETURN_STATEMENT
4900 -- | ACCEPT_STATEMENT | SELECT_STATEMENT
4902 -------------------------
4903 -- 5.1 Null Statement --
4904 -------------------------
4906 -- NULL_STATEMENT ::= null;
4908 -- N_Null_Statement
4909 -- Sloc points to NULL
4910 -- Next_Rep_Item
4912 ----------------
4913 -- 5.1 Label --
4914 ----------------
4916 -- LABEL ::= <<label_STATEMENT_IDENTIFIER>>
4918 -- Note that the occurrence of a label is not a defining identifier,
4919 -- but rather a referencing occurrence. The defining occurrence is
4920 -- in the implicit label declaration which occurs in the innermost
4921 -- enclosing block.
4923 -- N_Label
4924 -- Sloc points to <<
4925 -- Identifier direct name of statement identifier
4926 -- Exception_Junk
4928 -- Note: Before Ada 2012, a label is always followed by a statement,
4929 -- and this is true in the tree even in Ada 2012 mode (the parser
4930 -- inserts a null statement marked with Comes_From_Source False).
4932 -------------------------------
4933 -- 5.1 Statement Identifier --
4934 -------------------------------
4936 -- STATEMENT_IDENTIFIER ::= DIRECT_NAME
4938 -- The IDENTIFIER of a STATEMENT_IDENTIFIER shall be an identifier
4939 -- (not an OPERATOR_SYMBOL)
4941 -------------------------------
4942 -- 5.2 Assignment Statement --
4943 -------------------------------
4945 -- ASSIGNMENT_STATEMENT ::=
4946 -- variable_NAME := EXPRESSION;
4948 -- N_Assignment_Statement
4949 -- Sloc points to :=
4950 -- Name
4951 -- Expression
4952 -- Is_Elaboration_Checks_OK_Node
4953 -- Is_SPARK_Mode_On_Node
4954 -- Do_Discriminant_Check
4955 -- Do_Length_Check
4956 -- Forwards_OK
4957 -- Backwards_OK
4958 -- No_Ctrl_Actions
4959 -- No_Finalize_Actions
4960 -- Has_Target_Names
4961 -- Is_Elaboration_Code
4962 -- Componentwise_Assignment
4963 -- Suppress_Assignment_Checks
4965 -- Note: if a range check is required, then the Do_Range_Check flag
4966 -- is set in the Expression (right hand side), with the check being
4967 -- done against the type of the Name (left hand side).
4969 -- Note: the back end places some restrictions on the form of the
4970 -- Expression field. If the object being assigned to is Atomic, then
4971 -- the Expression may not have the form of an aggregate (since this
4972 -- might cause the back end to generate separate assignments). In this
4973 -- case the front end must generate an extra temporary and initialize
4974 -- this temporary as required (the temporary itself is not atomic).
4976 ------------------
4977 -- Target_Name --
4978 ------------------
4980 -- N_Target_Name
4981 -- Sloc points to @
4982 -- Etype
4984 -- Note (Ada 2022): node is used during analysis as a placeholder for
4985 -- the value of the LHS of the enclosing assignment statement. Node is
4986 -- eventually rewritten together with enclosing assignment, and backends
4987 -- are not aware of it.
4989 -----------------------
4990 -- 5.3 If Statement --
4991 -----------------------
4993 -- IF_STATEMENT ::=
4994 -- if CONDITION then
4995 -- SEQUENCE_OF_STATEMENTS
4996 -- {elsif CONDITION then
4997 -- SEQUENCE_OF_STATEMENTS}
4998 -- [else
4999 -- SEQUENCE_OF_STATEMENTS]
5000 -- end if;
5002 -- Gigi restriction: This expander ensures that the type of the
5003 -- Condition fields is always Standard.Boolean, even if the type
5004 -- in the source is some non-standard boolean type.
5006 -- N_If_Statement
5007 -- Sloc points to IF
5008 -- Condition
5009 -- Then_Statements
5010 -- Elsif_Parts (set to No_List if none present)
5011 -- Else_Statements (set to No_List if no else part present)
5012 -- End_Span (set to Uint_0 if expander generated)
5013 -- From_Conditional_Expression
5015 -- N_Elsif_Part
5016 -- Sloc points to ELSIF
5017 -- Condition
5018 -- Then_Statements
5019 -- Condition_Actions
5021 --------------------
5022 -- 5.3 Condition --
5023 --------------------
5025 -- CONDITION ::= boolean_EXPRESSION
5027 -------------------------
5028 -- 5.4 Case Statement --
5029 -------------------------
5031 -- CASE_STATEMENT ::=
5032 -- case EXPRESSION is
5033 -- CASE_STATEMENT_ALTERNATIVE
5034 -- {CASE_STATEMENT_ALTERNATIVE}
5035 -- end case;
5037 -- Note: the Alternatives can contain pragmas. These only occur at
5038 -- the start of the list, since any pragmas occurring after the first
5039 -- alternative are absorbed into the corresponding statement sequence.
5041 -- N_Case_Statement
5042 -- Sloc points to CASE
5043 -- Expression
5044 -- Alternatives
5045 -- End_Span (set to Uint_0 if expander generated)
5046 -- From_Conditional_Expression
5048 -- Note: Before Ada 2012, a pragma in a statement sequence is always
5049 -- followed by a statement, and this is true in the tree even in Ada
5050 -- 2012 mode (the parser inserts a null statement marked with the flag
5051 -- Comes_From_Source False).
5053 -------------------------------------
5054 -- 5.4 Case Statement Alternative --
5055 -------------------------------------
5057 -- CASE_STATEMENT_ALTERNATIVE ::=
5058 -- when DISCRETE_CHOICE_LIST =>
5059 -- SEQUENCE_OF_STATEMENTS
5061 -- N_Case_Statement_Alternative
5062 -- Sloc points to WHEN
5063 -- Discrete_Choices
5064 -- Statements
5065 -- Has_SP_Choice
5066 -- Multidefined_Bindings
5068 -- Note: in the list of Discrete_Choices, the tree passed to the back
5069 -- end does not have choice entries corresponding to names of statically
5070 -- predicated subtypes. Such entries are always expanded out to the list
5071 -- of equivalent values or ranges. Multidefined_Bindings is True iff
5072 -- more than one choice is present and each choice contains
5073 -- at least one component association having a non-null Binding_Chars
5074 -- attribute; this can only occur if GNAT extensions are enabled
5075 -- and the type of the case selector is composite.
5077 -------------------------
5078 -- 5.5 Loop Statement --
5079 -------------------------
5081 -- LOOP_STATEMENT ::=
5082 -- [loop_STATEMENT_IDENTIFIER :]
5083 -- [ITERATION_SCHEME] loop
5084 -- SEQUENCE_OF_STATEMENTS
5085 -- end loop [loop_IDENTIFIER];
5087 -- Note: The occurrence of a loop label is not a defining identifier
5088 -- but rather a referencing occurrence. The defining occurrence is in
5089 -- the implicit label declaration which occurs in the innermost
5090 -- enclosing block.
5092 -- Note: there is always a loop statement identifier present in the
5093 -- tree, even if none was given in the source. In the case where no loop
5094 -- identifier is given in the source, the parser creates a name of the
5095 -- form _Loop_n, where n is a decimal integer (the two underlines ensure
5096 -- that the loop names created in this manner do not conflict with any
5097 -- user defined identifiers), and the flag Has_Created_Identifier is set
5098 -- to True. The only exception to the rule that all loop statement nodes
5099 -- have identifiers occurs for loops constructed by the expander, and
5100 -- the semantic analyzer will create and supply dummy loop identifiers
5101 -- in these cases.
5103 -- N_Loop_Statement
5104 -- Sloc points to LOOP
5105 -- Identifier loop identifier (set to Empty if no identifier)
5106 -- Iteration_Scheme (set to Empty if no iteration scheme)
5107 -- Statements
5108 -- End_Label
5109 -- Has_Created_Identifier
5110 -- Is_Null_Loop
5111 -- Suppress_Loop_Warnings
5113 -- Note: the parser fills in the Identifier field if there is an
5114 -- explicit loop identifier. Otherwise the parser leaves this field
5115 -- set to Empty, and then the semantic processing for a loop statement
5116 -- creates an identifier, setting the Has_Created_Identifier flag to
5117 -- True. So after semantic analysis, the Identifier is always set,
5118 -- referencing an identifier whose entity has an Ekind of E_Loop.
5120 ---------------------------
5121 -- 5.5 Iteration Scheme --
5122 ---------------------------
5124 -- ITERATION_SCHEME ::=
5125 -- while CONDITION
5126 -- | for LOOP_PARAMETER_SPECIFICATION
5127 -- | for ITERATOR_SPECIFICATION
5129 -- At most one of (Iterator_Specification, Loop_Parameter_Specification)
5130 -- is present at a time, in which case the other one is empty. Both are
5131 -- empty in the case of a WHILE loop.
5133 -- Gigi restriction: The expander ensures that the type of the Condition
5134 -- field is always Standard.Boolean, even if the type in the source is
5135 -- some non-standard boolean type.
5137 -- N_Iteration_Scheme
5138 -- Sloc points to WHILE or FOR
5139 -- Condition (set to Empty if FOR case)
5140 -- Condition_Actions
5141 -- Iterator_Specification (set to Empty if WHILE case)
5142 -- Loop_Parameter_Specification (set to Empty if WHILE case)
5144 ---------------------------------------
5145 -- 5.5 Loop Parameter Specification --
5146 ---------------------------------------
5148 -- LOOP_PARAMETER_SPECIFICATION ::=
5149 -- DEFINING_IDENTIFIER in [reverse] DISCRETE_SUBTYPE_DEFINITION
5150 -- [Iterator_Filter]
5152 -- Note: the optional Iterator_Filter is an Ada 2022 construct.
5154 -- N_Loop_Parameter_Specification
5155 -- Sloc points to first identifier
5156 -- Defining_Identifier
5157 -- Reverse_Present
5158 -- Iterator_Filter (set to Empty if not present)
5159 -- Discrete_Subtype_Definition
5161 -----------------------------------
5162 -- 5.5.1 Iterator Specification --
5163 -----------------------------------
5165 -- ITERATOR_SPECIFICATION ::=
5166 -- DEFINING_IDENTIFIER in [reverse] NAME
5167 -- | DEFINING_IDENTIFIER [: SUBTYPE_INDICATION] of [reverse] NAME
5169 -- N_Iterator_Specification
5170 -- Sloc points to defining identifier
5171 -- Defining_Identifier
5172 -- Name
5173 -- Reverse_Present
5174 -- Of_Present
5175 -- Iterator_Filter (set to Empty if not present)
5176 -- Subtype_Indication
5178 -- Note: The Of_Present flag distinguishes the two forms
5180 --------------------------
5181 -- 5.6 Block Statement --
5182 --------------------------
5184 -- BLOCK_STATEMENT ::=
5185 -- [block_STATEMENT_IDENTIFIER:]
5186 -- [declare
5187 -- DECLARATIVE_PART]
5188 -- begin
5189 -- HANDLED_SEQUENCE_OF_STATEMENTS
5190 -- end [block_IDENTIFIER];
5192 -- Note that the occurrence of a block identifier is not a defining
5193 -- identifier, but rather a referencing occurrence. The defining
5194 -- occurrence is an E_Block entity declared by the implicit label
5195 -- declaration which occurs in the innermost enclosing block statement
5196 -- or body; the block identifier denotes that E_Block.
5198 -- For block statements that come from source code, there is always a
5199 -- block statement identifier present in the tree, denoting an E_Block.
5200 -- In the case where no block identifier is given in the source,
5201 -- the parser creates a name of the form B_n, where n is a decimal
5202 -- integer, and the flag Has_Created_Identifier is set to True. Blocks
5203 -- constructed by the expander usually have no identifier, and no
5204 -- corresponding entity.
5206 -- Note: the block statement created for an extended return statement
5207 -- has an entity, and this entity is an E_Return_Statement, rather than
5208 -- the usual E_Block.
5210 -- Note: Exception_Junk is set for the wrapping blocks created during
5211 -- local raise optimization (Exp_Ch11.Expand_Local_Exception_Handlers).
5213 -- Note: from a control flow viewpoint, a block statement defines an
5214 -- extended basic block, i.e. the entry of the block dominates every
5215 -- statement in the sequence. When generating new statements with
5216 -- exception handlers in the expander at the end of a sequence that
5217 -- comes from source code, it can be necessary to wrap them all in a
5218 -- block statement in order to expose the implicit control flow to
5219 -- gigi and thus prevent it from issuing bogus control flow warnings.
5221 -- N_Block_Statement
5222 -- Sloc points to DECLARE or BEGIN
5223 -- Identifier block direct name (set to Empty if not present)
5224 -- Declarations (set to No_List if no DECLARE part)
5225 -- Handled_Statement_Sequence
5226 -- Activation_Chain_Entity
5227 -- Cleanup_Actions
5228 -- Has_Created_Identifier
5229 -- Is_Asynchronous_Call_Block
5230 -- Is_Task_Allocation_Block
5231 -- Exception_Junk
5232 -- Is_Abort_Block
5233 -- Is_Finalization_Wrapper
5234 -- Is_Initialization_Block
5235 -- Is_Task_Master
5236 -- At_End_Proc (set to Empty if no clean up procedure)
5238 -------------------------
5239 -- 5.7 Exit Statement --
5240 -------------------------
5242 -- EXIT_STATEMENT ::= exit [loop_NAME] [when CONDITION];
5244 -- Gigi restriction: The expander ensures that the type of the Condition
5245 -- field is always Standard.Boolean, even if the type in the source is
5246 -- some non-standard boolean type.
5248 -- N_Exit_Statement
5249 -- Sloc points to EXIT
5250 -- Name (set to Empty if no loop name present)
5251 -- Condition (set to Empty if no WHEN part present)
5252 -- Next_Exit_Statement : Next exit on chain
5254 -------------------------
5255 -- 5.9 Goto Statement --
5256 -------------------------
5258 -- GOTO_STATEMENT ::= goto label_NAME;
5260 -- N_Goto_Statement
5261 -- Sloc points to GOTO
5262 -- Name
5263 -- Exception_Junk
5265 ---------------------------------
5266 -- 6.1 Subprogram Declaration --
5267 ---------------------------------
5269 -- SUBPROGRAM_DECLARATION ::=
5270 -- SUBPROGRAM_SPECIFICATION
5271 -- [ASPECT_SPECIFICATIONS];
5273 -- N_Subprogram_Declaration
5274 -- Sloc points to FUNCTION or PROCEDURE
5275 -- Specification
5276 -- Body_To_Inline
5277 -- Corresponding_Body
5278 -- Parent_Spec
5279 -- Is_Entry_Barrier_Function
5280 -- Is_Task_Body_Procedure
5282 ------------------------------------------
5283 -- 6.1 Abstract Subprogram Declaration --
5284 ------------------------------------------
5286 -- ABSTRACT_SUBPROGRAM_DECLARATION ::=
5287 -- SUBPROGRAM_SPECIFICATION is abstract
5288 -- [ASPECT_SPECIFICATIONS];
5290 -- N_Abstract_Subprogram_Declaration
5291 -- Sloc points to ABSTRACT
5292 -- Specification
5294 -----------------------------------
5295 -- 6.1 Subprogram Specification --
5296 -----------------------------------
5298 -- SUBPROGRAM_SPECIFICATION ::=
5299 -- [[not] overriding]
5300 -- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE
5301 -- | [[not] overriding]
5302 -- function DEFINING_DESIGNATOR PARAMETER_AND_RESULT_PROFILE
5304 -- Note: there are no separate nodes for the profiles, instead the
5305 -- information appears directly in the following nodes.
5307 -- N_Function_Specification
5308 -- Sloc points to FUNCTION
5309 -- Defining_Unit_Name (the designator)
5310 -- Parameter_Specifications (set to No_List if no formal part)
5311 -- Null_Exclusion_Present
5312 -- Result_Definition for result subtype
5313 -- Generic_Parent
5314 -- Must_Override set if overriding indicator present
5315 -- Must_Not_Override set if not_overriding indicator present
5317 -- N_Procedure_Specification
5318 -- Sloc points to PROCEDURE
5319 -- Defining_Unit_Name
5320 -- Null_Statement NULL statement for body, if Null_Present
5321 -- Parameter_Specifications (set to No_List if no formal part)
5322 -- Generic_Parent
5323 -- Null_Present set for null procedure case (Ada 2005 feature)
5324 -- Must_Override set if overriding indicator present
5325 -- Must_Not_Override set if not_overriding indicator present
5327 -- Note: overriding indicator is an Ada 2005 feature
5329 ---------------------
5330 -- 6.1 Designator --
5331 ---------------------
5333 -- DESIGNATOR ::=
5334 -- [PARENT_UNIT_NAME .] IDENTIFIER | OPERATOR_SYMBOL
5336 -- Designators that are simply identifiers or operator symbols appear
5337 -- directly in the tree in this form. The following node is used only
5338 -- in the case where the designator has a parent unit name component.
5340 -- N_Designator
5341 -- Sloc points to period
5342 -- Name holds the parent unit name
5343 -- Identifier
5345 -- Note: Name is always non-Empty, since this node is only used for the
5346 -- case where a parent library unit package name is present.
5348 -- Note that the identifier can also be an operator symbol here
5350 ------------------------------
5351 -- 6.1 Defining Designator --
5352 ------------------------------
5354 -- DEFINING_DESIGNATOR ::=
5355 -- DEFINING_PROGRAM_UNIT_NAME | DEFINING_OPERATOR_SYMBOL
5357 -------------------------------------
5358 -- 6.1 Defining Program Unit Name --
5359 -------------------------------------
5361 -- DEFINING_PROGRAM_UNIT_NAME ::=
5362 -- [PARENT_UNIT_NAME .] DEFINING_IDENTIFIER
5364 -- The parent unit name is present only in the case of a child unit name
5365 -- (permissible only for Ada 95 for a library level unit, i.e. a unit
5366 -- at scope level one). If no such name is present, the defining program
5367 -- unit name is represented simply as the defining identifier. In the
5368 -- child unit case, the following node is used to represent the child
5369 -- unit name.
5371 -- N_Defining_Program_Unit_Name
5372 -- Sloc points to period
5373 -- Name holds the parent unit name
5374 -- Defining_Identifier
5376 -- Note: Name is always non-Empty, since this node is only used for the
5377 -- case where a parent unit name is present.
5379 --------------------------
5380 -- 6.1 Operator Symbol --
5381 --------------------------
5383 -- OPERATOR_SYMBOL ::= STRING_LITERAL
5385 -- Note: the fields of the N_Operator_Symbol node are laid out to match
5386 -- the corresponding fields of an N_Character_Literal node. This allows
5387 -- easy conversion of the operator symbol node into a character literal
5388 -- node in the case where a string constant of the form of an operator
5389 -- symbol is scanned out as such, but turns out semantically to be a
5390 -- string literal that is not an operator. For details see Sinfo.CN.
5391 -- Change_Operator_Symbol_To_String_Literal.
5393 -- N_Operator_Symbol
5394 -- Sloc points to literal
5395 -- Chars contains the Name_Id for the operator symbol
5396 -- Strval Id of string value. This is used if the operator
5397 -- symbol turns out to be a normal string after all.
5398 -- Entity
5399 -- Associated_Node Note this is shared with Entity
5400 -- Etype
5401 -- Has_Private_View (set in generic units)
5402 -- Has_Secondary_Private_View (set in generic units)
5404 -- Note: the Strval field may be set to No_String for generated
5405 -- operator symbols that are known not to be string literals
5406 -- semantically.
5408 -----------------------------------
5409 -- 6.1 Defining Operator Symbol --
5410 -----------------------------------
5412 -- DEFINING_OPERATOR_SYMBOL ::= OPERATOR_SYMBOL
5414 -- A defining operator symbol is an entity, which has additional
5415 -- fields depending on the setting of the Ekind field. These
5416 -- additional fields are defined (and access subprograms declared)
5417 -- in package Einfo.
5419 -- Note: N_Defining_Operator_Symbol is an extended node whose fields
5420 -- are deliberately laid out to match the layout of fields in an
5421 -- ordinary N_Operator_Symbol node allowing for easy alteration of
5422 -- an operator symbol node into a defining operator symbol node.
5423 -- See Sinfo.CN.Change_Operator_Symbol_To_Defining_Operator_Symbol
5424 -- for further details.
5426 -- N_Defining_Operator_Symbol
5427 -- Sloc points to literal
5428 -- Chars contains the Name_Id for the operator symbol
5429 -- Next_Entity
5430 -- Scope
5431 -- Etype
5433 ----------------------------
5434 -- 6.1 Parameter Profile --
5435 ----------------------------
5437 -- PARAMETER_PROFILE ::= [FORMAL_PART]
5439 ---------------------------------------
5440 -- 6.1 Parameter and Result Profile --
5441 ---------------------------------------
5443 -- PARAMETER_AND_RESULT_PROFILE ::=
5444 -- [FORMAL_PART] return [NULL_EXCLUSION] SUBTYPE_MARK
5445 -- | [FORMAL_PART] return ACCESS_DEFINITION
5447 -- There is no explicit node in the tree for a parameter and result
5448 -- profile. Instead the information appears directly in the parent.
5450 ----------------------
5451 -- 6.1 Formal Part --
5452 ----------------------
5454 -- FORMAL_PART ::=
5455 -- (PARAMETER_SPECIFICATION {; PARAMETER_SPECIFICATION})
5457 ----------------------------------
5458 -- 6.1 Parameter Specification --
5459 ----------------------------------
5461 -- PARAMETER_SPECIFICATION ::=
5462 -- DEFINING_IDENTIFIER_LIST : [ALIASED] MODE [NULL_EXCLUSION]
5463 -- SUBTYPE_MARK [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATIONS]
5464 -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION
5465 -- [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATIONS]
5467 -- Although the syntax allows multiple identifiers in the list, the
5468 -- semantics is as though successive specifications were given with
5469 -- identical type definition and expression components. To simplify
5470 -- semantic processing, the parser represents a multiple declaration
5471 -- case as a sequence of single Specifications, using the More_Ids and
5472 -- Prev_Ids flags to preserve the original source form as described
5473 -- in the section on "Handling of Defining Identifier Lists".
5475 -- ALIASED can only be present in Ada 2012 mode
5477 -- N_Parameter_Specification
5478 -- Sloc points to first identifier
5479 -- Defining_Identifier
5480 -- Aliased_Present
5481 -- In_Present
5482 -- Out_Present
5483 -- Null_Exclusion_Present
5484 -- Parameter_Type subtype mark or access definition
5485 -- Expression (set to Empty if no default expression present)
5486 -- More_Ids (set to False if no more identifiers in list)
5487 -- Prev_Ids (set to False if no previous identifiers in list)
5488 -- Default_Expression
5490 ---------------
5491 -- 6.1 Mode --
5492 ---------------
5494 -- MODE ::= [in] | in out | out
5496 -- There is no explicit node in the tree for the Mode. Instead the
5497 -- In_Present and Out_Present flags are set in the parent node to
5498 -- record the presence of keywords specifying the mode.
5500 --------------------------
5501 -- 6.3 Subprogram Body --
5502 --------------------------
5504 -- SUBPROGRAM_BODY ::=
5505 -- SUBPROGRAM_SPECIFICATION [ASPECT_SPECIFICATIONS] is
5506 -- DECLARATIVE_PART
5507 -- begin
5508 -- HANDLED_SEQUENCE_OF_STATEMENTS
5509 -- end [DESIGNATOR];
5511 -- N_Subprogram_Body
5512 -- Sloc points to FUNCTION or PROCEDURE
5513 -- Specification
5514 -- Declarations
5515 -- Handled_Statement_Sequence
5516 -- Activation_Chain_Entity
5517 -- Corresponding_Spec
5518 -- Acts_As_Spec
5519 -- Bad_Is_Detected used only by parser
5520 -- Do_Storage_Check
5521 -- Has_Relative_Deadline_Pragma
5522 -- Is_Entry_Barrier_Function
5523 -- Is_Protected_Subprogram_Body
5524 -- Is_Task_Body_Procedure
5525 -- Is_Task_Master
5526 -- Was_Attribute_Reference
5527 -- Was_Expression_Function
5528 -- Was_Originally_Stub
5530 -----------------------------------
5531 -- 6.4 Procedure Call Statement --
5532 -----------------------------------
5534 -- PROCEDURE_CALL_STATEMENT ::=
5535 -- procedure_NAME; | procedure_PREFIX ACTUAL_PARAMETER_PART;
5537 -- Note: the reason that a procedure call has expression fields is that
5538 -- it semantically resembles an expression, e.g. overloading is allowed
5539 -- and a type is concocted for semantic processing purposes. Certain of
5540 -- these fields, such as Parens are not relevant, but it is easier to
5541 -- just supply all of them together.
5543 -- N_Procedure_Call_Statement
5544 -- Sloc points to first token of name or prefix
5545 -- Name stores name or prefix
5546 -- Parameter_Associations (set to No_List if no
5547 -- actual parameter part)
5548 -- First_Named_Actual
5549 -- Controlling_Argument (set to Empty if not dispatching)
5550 -- Is_Elaboration_Checks_OK_Node
5551 -- Is_SPARK_Mode_On_Node
5552 -- Is_Elaboration_Warnings_OK_Node
5553 -- No_Elaboration_Check
5554 -- Is_Known_Guaranteed_ABE
5555 -- plus fields for expression
5557 -- If any IN parameter requires a range check, then the corresponding
5558 -- argument expression has the Do_Range_Check flag set, and the range
5559 -- check is done against the formal type. Note that this argument
5560 -- expression may appear directly in the Parameter_Associations list,
5561 -- or may be a descendant of an N_Parameter_Association node that
5562 -- appears in this list.
5564 ------------------------
5565 -- 6.4 Function Call --
5566 ------------------------
5568 -- FUNCTION_CALL ::=
5569 -- function_NAME | function_PREFIX ACTUAL_PARAMETER_PART
5571 -- Note: the parser may generate an indexed component node or simply
5572 -- a name node instead of a function call node. The semantic pass must
5573 -- correct this misidentification.
5575 -- N_Function_Call
5576 -- Sloc points to first token of name or prefix
5577 -- Name stores name or prefix
5578 -- Parameter_Associations (set to No_List if no
5579 -- actual parameter part)
5580 -- First_Named_Actual
5581 -- Controlling_Argument (set to Empty if not dispatching)
5582 -- Is_Elaboration_Checks_OK_Node
5583 -- Is_SPARK_Mode_On_Node
5584 -- Is_Elaboration_Warnings_OK_Node
5585 -- No_Elaboration_Check
5586 -- Is_Expanded_Build_In_Place_Call
5587 -- Is_Known_Guaranteed_ABE
5588 -- plus fields for expression
5590 --------------------------------
5591 -- 6.4 Actual Parameter Part --
5592 --------------------------------
5594 -- ACTUAL_PARAMETER_PART ::=
5595 -- (PARAMETER_ASSOCIATION {,PARAMETER_ASSOCIATION})
5597 --------------------------------
5598 -- 6.4 Parameter Association --
5599 --------------------------------
5601 -- PARAMETER_ASSOCIATION ::=
5602 -- [formal_parameter_SELECTOR_NAME =>] EXPLICIT_ACTUAL_PARAMETER
5604 -- Note: the N_Parameter_Association node is built only if a formal
5605 -- parameter selector name is present, otherwise the parameter
5606 -- association appears in the tree simply as the node for the
5607 -- explicit actual parameter.
5609 -- N_Parameter_Association
5610 -- Sloc points to formal parameter
5611 -- Selector_Name (always non-Empty)
5612 -- Explicit_Actual_Parameter
5613 -- Next_Named_Actual
5614 -- Is_Accessibility_Actual
5616 ---------------------------
5617 -- 6.4 Actual Parameter --
5618 ---------------------------
5620 -- EXPLICIT_ACTUAL_PARAMETER ::=
5621 -- EXPRESSION | variable_NAME | REDUCTION_EXPRESSION_PARAMETER
5623 ---------------------------
5624 -- 6.5 Return Statement --
5625 ---------------------------
5627 -- SIMPLE_RETURN_STATEMENT ::= return [EXPRESSION];
5629 -- EXTENDED_RETURN_STATEMENT ::=
5630 -- return DEFINING_IDENTIFIER : [aliased] RETURN_SUBTYPE_INDICATION
5631 -- [:= EXPRESSION] [do
5632 -- HANDLED_SEQUENCE_OF_STATEMENTS
5633 -- end return];
5635 -- RETURN_SUBTYPE_INDICATION ::= SUBTYPE_INDICATION | ACCESS_DEFINITION
5637 -- The term "return statement" is defined in 6.5 to mean either a
5638 -- SIMPLE_RETURN_STATEMENT or an EXTENDED_RETURN_STATEMENT. We avoid
5639 -- the use of this term, since it used to mean something else in earlier
5640 -- versions of Ada.
5642 -- N_Simple_Return_Statement
5643 -- Sloc points to RETURN
5644 -- Return_Statement_Entity
5645 -- Expression (set to Empty if no expression present)
5646 -- Storage_Pool
5647 -- Procedure_To_Call
5648 -- Comes_From_Extended_Return_Statement
5650 -- Note: Return_Statement_Entity points to an E_Return_Statement
5652 -- If a range check is required, then Do_Range_Check is set on the
5653 -- Expression. The check is against the return subtype of the function.
5655 -- N_Extended_Return_Statement
5656 -- Sloc points to RETURN
5657 -- Return_Statement_Entity
5658 -- Return_Object_Declarations
5659 -- Handled_Statement_Sequence (set to Empty if not present)
5660 -- Storage_Pool
5661 -- Procedure_To_Call
5663 -- Note: Return_Statement_Entity points to an E_Return_Statement.
5665 -- Note that Return_Object_Declarations is a list containing the
5666 -- N_Object_Declaration -- see comment on this field above.
5668 -- The declared object will have Is_Return_Object = True.
5670 -- There is no such syntactic category as return_object_declaration
5671 -- in the RM. Return_Object_Declarations represents this portion of
5672 -- the syntax for EXTENDED_RETURN_STATEMENT:
5673 -- DEFINING_IDENTIFIER : [aliased] RETURN_SUBTYPE_INDICATION
5674 -- [:= EXPRESSION]
5676 -- There are two entities associated with an extended_return_statement:
5677 -- the Return_Statement_Entity represents the statement itself,
5678 -- and the Defining_Identifier of the Object_Declaration in
5679 -- Return_Object_Declarations represents the object being
5680 -- returned. N_Simple_Return_Statement has only the former.
5682 ------------------------------
5683 -- 6.8 Expression Function --
5684 ------------------------------
5686 -- EXPRESSION_FUNCTION ::=
5687 -- FUNCTION SPECIFICATION IS (EXPRESSION)
5688 -- [ASPECT_SPECIFICATIONS];
5690 -- N_Expression_Function
5691 -- Sloc points to FUNCTION
5692 -- Specification
5693 -- Expression
5694 -- Corresponding_Spec
5696 ------------------------------
5697 -- 7.1 Package Declaration --
5698 ------------------------------
5700 -- PACKAGE_DECLARATION ::=
5701 -- PACKAGE_SPECIFICATION;
5703 -- Note: the activation chain entity for a package spec is used for
5704 -- all tasks declared in the package spec, or in the package body.
5706 -- N_Package_Declaration
5707 -- Sloc points to PACKAGE
5708 -- Specification
5709 -- Corresponding_Body
5710 -- Parent_Spec
5711 -- Activation_Chain_Entity
5713 --------------------------------
5714 -- 7.1 Package Specification --
5715 --------------------------------
5717 -- PACKAGE_SPECIFICATION ::=
5718 -- package DEFINING_PROGRAM_UNIT_NAME
5719 -- [ASPECT_SPECIFICATIONS]
5720 -- is
5721 -- {BASIC_DECLARATIVE_ITEM}
5722 -- [private
5723 -- {BASIC_DECLARATIVE_ITEM}]
5724 -- end [[PARENT_UNIT_NAME .] IDENTIFIER]
5726 -- N_Package_Specification
5727 -- Sloc points to PACKAGE
5728 -- Defining_Unit_Name
5729 -- Visible_Declarations
5730 -- Private_Declarations (set to No_List if no private
5731 -- part present)
5732 -- End_Label
5733 -- Generic_Parent
5734 -- Limited_View_Installed
5736 -----------------------
5737 -- 7.1 Package Body --
5738 -----------------------
5740 -- PACKAGE_BODY ::=
5741 -- package body DEFINING_PROGRAM_UNIT_NAME
5742 -- [ASPECT_SPECIFICATIONS]
5743 -- is
5744 -- DECLARATIVE_PART
5745 -- [begin
5746 -- HANDLED_SEQUENCE_OF_STATEMENTS]
5747 -- end [[PARENT_UNIT_NAME .] IDENTIFIER];
5749 -- N_Package_Body
5750 -- Sloc points to PACKAGE
5751 -- Defining_Unit_Name
5752 -- Declarations
5753 -- Handled_Statement_Sequence (set to Empty if no HSS present)
5754 -- Corresponding_Spec
5755 -- Was_Originally_Stub
5756 -- At_End_Proc (set to Empty if no clean up procedure)
5758 -- Note: if a source level package does not contain a handled sequence
5759 -- of statements, then the parser supplies a dummy one with a null
5760 -- sequence of statements. Comes_From_Source will be False in this
5761 -- constructed sequence. The reason we need this is for the End_Label
5762 -- field in the HSS.
5764 -----------------------------------
5765 -- 7.4 Private Type Declaration --
5766 -----------------------------------
5768 -- PRIVATE_TYPE_DECLARATION ::=
5769 -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART]
5770 -- is [[abstract] tagged] [limited] private
5771 -- [ASPECT_SPECIFICATIONS];
5773 -- Note: TAGGED is not permitted in Ada 83 mode
5775 -- N_Private_Type_Declaration
5776 -- Sloc points to TYPE
5777 -- Defining_Identifier
5778 -- Discriminant_Specifications (set to No_List if no
5779 -- discriminant part)
5780 -- Unknown_Discriminants_Present set if (<>) discriminant
5781 -- Abstract_Present
5782 -- Tagged_Present
5783 -- Limited_Present
5785 ----------------------------------------
5786 -- 7.4 Private Extension Declaration --
5787 ----------------------------------------
5789 -- PRIVATE_EXTENSION_DECLARATION ::=
5790 -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] is
5791 -- [abstract] [limited | synchronized]
5792 -- new ancestor_SUBTYPE_INDICATION [and INTERFACE_LIST]
5793 -- with private [ASPECT_SPECIFICATIONS];
5795 -- Note: LIMITED, and private extension declarations are not allowed
5796 -- in Ada 83 mode.
5798 -- N_Private_Extension_Declaration
5799 -- Sloc points to TYPE
5800 -- Defining_Identifier
5801 -- Uninitialized_Variable
5802 -- Discriminant_Specifications (set to No_List if no
5803 -- discriminant part)
5804 -- Unknown_Discriminants_Present set if (<>) discriminant
5805 -- Abstract_Present
5806 -- Limited_Present
5807 -- Synchronized_Present
5808 -- Subtype_Indication
5809 -- Interface_List (set to No_List if none)
5811 ---------------------
5812 -- 8.4 Use Clause --
5813 ---------------------
5815 -- USE_CLAUSE ::= USE_PACKAGE_CLAUSE | USE_TYPE_CLAUSE
5817 -----------------------------
5818 -- 8.4 Use Package Clause --
5819 -----------------------------
5821 -- USE_PACKAGE_CLAUSE ::= use package_NAME {, package_NAME};
5823 -- N_Use_Package_Clause
5824 -- Sloc points to USE
5825 -- Prev_Use_Clause
5826 -- Name
5827 -- Next_Use_Clause
5828 -- Associated_Node
5829 -- Hidden_By_Use_Clause
5830 -- Is_Effective_Use_Clause
5831 -- More_Ids (set to False if no more identifiers in list)
5832 -- Prev_Ids (set to False if no previous identifiers in list)
5834 --------------------------
5835 -- 8.4 Use Type Clause --
5836 --------------------------
5838 -- USE_TYPE_CLAUSE ::= use [ALL] type SUBTYPE_MARK {, SUBTYPE_MARK};
5840 -- Note: use type clause is not permitted in Ada 83 mode
5842 -- Note: the ALL keyword can appear only in Ada 2012 mode
5844 -- N_Use_Type_Clause
5845 -- Sloc points to USE
5846 -- Prev_Use_Clause
5847 -- Used_Operations
5848 -- Next_Use_Clause
5849 -- Subtype_Mark
5850 -- Hidden_By_Use_Clause
5851 -- Is_Effective_Use_Clause
5852 -- More_Ids (set to False if no more identifiers in list)
5853 -- Prev_Ids (set to False if no previous identifiers in list)
5854 -- All_Present
5856 -------------------------------
5857 -- 8.5 Renaming Declaration --
5858 -------------------------------
5860 -- RENAMING_DECLARATION ::=
5861 -- OBJECT_RENAMING_DECLARATION
5862 -- | EXCEPTION_RENAMING_DECLARATION
5863 -- | PACKAGE_RENAMING_DECLARATION
5864 -- | SUBPROGRAM_RENAMING_DECLARATION
5865 -- | GENERIC_RENAMING_DECLARATION
5867 --------------------------------------
5868 -- 8.5 Object Renaming Declaration --
5869 --------------------------------------
5871 -- OBJECT_RENAMING_DECLARATION ::=
5872 -- DEFINING_IDENTIFIER :
5873 -- [NULL_EXCLUSION] SUBTYPE_MARK renames object_NAME
5874 -- [ASPECT_SPECIFICATIONS];
5875 -- | DEFINING_IDENTIFIER :
5876 -- ACCESS_DEFINITION renames object_NAME
5877 -- [ASPECT_SPECIFICATIONS];
5879 -- Note: Access_Definition is an optional field that gives support to
5880 -- Ada 2005 (AI-230). The parser generates nodes that have either the
5881 -- Subtype_Indication field or else the Access_Definition field.
5883 -- N_Object_Renaming_Declaration
5884 -- Sloc points to first identifier
5885 -- Defining_Identifier
5886 -- Null_Exclusion_Present (set to False if not present)
5887 -- Subtype_Mark (set to Empty if not present)
5888 -- Access_Definition (set to Empty if not present)
5889 -- Name
5890 -- Corresponding_Generic_Association
5892 -----------------------------------------
5893 -- 8.5 Exception Renaming Declaration --
5894 -----------------------------------------
5896 -- EXCEPTION_RENAMING_DECLARATION ::=
5897 -- DEFINING_IDENTIFIER : exception renames exception_NAME
5898 -- [ASPECT_SPECIFICATIONS];
5900 -- N_Exception_Renaming_Declaration
5901 -- Sloc points to first identifier
5902 -- Defining_Identifier
5903 -- Name
5905 ---------------------------------------
5906 -- 8.5 Package Renaming Declaration --
5907 ---------------------------------------
5909 -- PACKAGE_RENAMING_DECLARATION ::=
5910 -- package DEFINING_PROGRAM_UNIT_NAME renames package_NAME
5911 -- [ASPECT_SPECIFICATIONS];
5913 -- N_Package_Renaming_Declaration
5914 -- Sloc points to PACKAGE
5915 -- Defining_Unit_Name
5916 -- Name
5917 -- Parent_Spec
5919 ------------------------------------------
5920 -- 8.5 Subprogram Renaming Declaration --
5921 ------------------------------------------
5923 -- SUBPROGRAM_RENAMING_DECLARATION ::=
5924 -- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME
5925 -- [ASPECT_SPECIFICATIONS];
5927 -- N_Subprogram_Renaming_Declaration
5928 -- Sloc points to RENAMES
5929 -- Specification
5930 -- Name
5931 -- Parent_Spec
5932 -- Corresponding_Spec
5933 -- Corresponding_Formal_Spec
5934 -- From_Default
5936 -----------------------------------------
5937 -- 8.5.5 Generic Renaming Declaration --
5938 -----------------------------------------
5940 -- GENERIC_RENAMING_DECLARATION ::=
5941 -- generic package DEFINING_PROGRAM_UNIT_NAME
5942 -- renames generic_package_NAME
5943 -- [ASPECT_SPECIFICATIONS];
5944 -- | generic procedure DEFINING_PROGRAM_UNIT_NAME
5945 -- renames generic_procedure_NAME
5946 -- [ASPECT_SPECIFICATIONS];
5947 -- | generic function DEFINING_PROGRAM_UNIT_NAME
5948 -- renames generic_function_NAME
5949 -- [ASPECT_SPECIFICATIONS];
5951 -- N_Generic_Package_Renaming_Declaration
5952 -- Sloc points to GENERIC
5953 -- Defining_Unit_Name
5954 -- Name
5955 -- Parent_Spec
5957 -- N_Generic_Procedure_Renaming_Declaration
5958 -- Sloc points to GENERIC
5959 -- Defining_Unit_Name
5960 -- Name
5961 -- Parent_Spec
5963 -- N_Generic_Function_Renaming_Declaration
5964 -- Sloc points to GENERIC
5965 -- Defining_Unit_Name
5966 -- Name
5967 -- Parent_Spec
5969 --------------------------------
5970 -- 9.1 Task Type Declaration --
5971 --------------------------------
5973 -- TASK_TYPE_DECLARATION ::=
5974 -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART]
5975 -- [ASPECT_SPECIFICATIONS]
5976 -- [is [new INTERFACE_LIST with] TASK_DEFINITION];
5978 -- N_Task_Type_Declaration
5979 -- Sloc points to TASK
5980 -- Defining_Identifier
5981 -- Discriminant_Specifications (set to No_List if no
5982 -- discriminant part)
5983 -- Interface_List (set to No_List if none)
5984 -- Task_Definition (set to Empty if not present)
5985 -- Corresponding_Body
5987 ----------------------------------
5988 -- 9.1 Single Task Declaration --
5989 ----------------------------------
5991 -- SINGLE_TASK_DECLARATION ::=
5992 -- task DEFINING_IDENTIFIER
5993 -- [ASPECT_SPECIFICATIONS]
5994 -- [is [new INTERFACE_LIST with] TASK_DEFINITION];
5996 -- N_Single_Task_Declaration
5997 -- Sloc points to TASK
5998 -- Defining_Identifier
5999 -- Interface_List (set to No_List if none)
6000 -- Task_Definition (set to Empty if not present)
6002 --------------------------
6003 -- 9.1 Task Definition --
6004 --------------------------
6006 -- TASK_DEFINITION ::=
6007 -- {TASK_ITEM}
6008 -- [private
6009 -- {TASK_ITEM}]
6010 -- end [task_IDENTIFIER]
6012 -- Note: as a result of semantic analysis, the list of task items can
6013 -- include implicit type declarations resulting from entry families.
6015 -- N_Task_Definition
6016 -- Sloc points to first token of task definition
6017 -- Visible_Declarations
6018 -- Private_Declarations (set to No_List if no private part)
6019 -- End_Label
6020 -- Has_Storage_Size_Pragma
6021 -- Has_Relative_Deadline_Pragma
6023 --------------------
6024 -- 9.1 Task Item --
6025 --------------------
6027 -- TASK_ITEM ::= ENTRY_DECLARATION | REPRESENTATION_CLAUSE
6029 --------------------
6030 -- 9.1 Task Body --
6031 --------------------
6033 -- TASK_BODY ::=
6034 -- task body task_DEFINING_IDENTIFIER
6035 -- [ASPECT_SPECIFICATIONS]
6036 -- is
6037 -- DECLARATIVE_PART
6038 -- begin
6039 -- HANDLED_SEQUENCE_OF_STATEMENTS
6040 -- end [task_IDENTIFIER];
6042 -- Gigi restriction: This node never appears
6044 -- N_Task_Body
6045 -- Sloc points to TASK
6046 -- Defining_Identifier
6047 -- Declarations
6048 -- Handled_Statement_Sequence
6049 -- Is_Task_Master
6050 -- Activation_Chain_Entity
6051 -- Corresponding_Spec
6052 -- Was_Originally_Stub
6054 -------------------------------------
6055 -- 9.4 Protected Type Declaration --
6056 -------------------------------------
6058 -- PROTECTED_TYPE_DECLARATION ::=
6059 -- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART]
6060 -- [ASPECT_SPECIFICATIONS]
6061 -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION;
6063 -- Note: protected type declarations are not permitted in Ada 83 mode
6065 -- N_Protected_Type_Declaration
6066 -- Sloc points to PROTECTED
6067 -- Defining_Identifier
6068 -- Discriminant_Specifications (set to No_List if no
6069 -- discriminant part)
6070 -- Interface_List (set to No_List if none)
6071 -- Protected_Definition
6072 -- Corresponding_Body
6074 ---------------------------------------
6075 -- 9.4 Single Protected Declaration --
6076 ---------------------------------------
6078 -- SINGLE_PROTECTED_DECLARATION ::=
6079 -- protected DEFINING_IDENTIFIER
6080 -- [ASPECT_SPECIFICATIONS]
6081 -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION;
6083 -- Note: single protected declarations are not allowed in Ada 83 mode
6085 -- N_Single_Protected_Declaration
6086 -- Sloc points to PROTECTED
6087 -- Defining_Identifier
6088 -- Interface_List (set to No_List if none)
6089 -- Protected_Definition
6091 -------------------------------
6092 -- 9.4 Protected Definition --
6093 -------------------------------
6095 -- PROTECTED_DEFINITION ::=
6096 -- {PROTECTED_OPERATION_DECLARATION}
6097 -- [private
6098 -- {PROTECTED_ELEMENT_DECLARATION}]
6099 -- end [protected_IDENTIFIER]
6101 -- N_Protected_Definition
6102 -- Sloc points to first token of protected definition
6103 -- Visible_Declarations
6104 -- Private_Declarations (set to No_List if no private part)
6105 -- End_Label
6107 ------------------------------------------
6108 -- 9.4 Protected Operation Declaration --
6109 ------------------------------------------
6111 -- PROTECTED_OPERATION_DECLARATION ::=
6112 -- SUBPROGRAM_DECLARATION
6113 -- | ENTRY_DECLARATION
6114 -- | REPRESENTATION_CLAUSE
6116 ----------------------------------------
6117 -- 9.4 Protected Element Declaration --
6118 ----------------------------------------
6120 -- PROTECTED_ELEMENT_DECLARATION ::=
6121 -- PROTECTED_OPERATION_DECLARATION | COMPONENT_DECLARATION
6123 -------------------------
6124 -- 9.4 Protected Body --
6125 -------------------------
6127 -- PROTECTED_BODY ::=
6128 -- protected body DEFINING_IDENTIFIER
6129 -- [ASPECT_SPECIFICATIONS];
6130 -- is
6131 -- {PROTECTED_OPERATION_ITEM}
6132 -- end [protected_IDENTIFIER];
6134 -- Note: protected bodies are not allowed in Ada 83 mode
6136 -- Gigi restriction: This node never appears
6138 -- N_Protected_Body
6139 -- Sloc points to PROTECTED
6140 -- Defining_Identifier
6141 -- Declarations protected operation items (and pragmas)
6142 -- End_Label
6143 -- Corresponding_Spec
6144 -- Was_Originally_Stub
6146 -----------------------------------
6147 -- 9.4 Protected Operation Item --
6148 -----------------------------------
6150 -- PROTECTED_OPERATION_ITEM ::=
6151 -- SUBPROGRAM_DECLARATION
6152 -- | SUBPROGRAM_BODY
6153 -- | ENTRY_BODY
6154 -- | REPRESENTATION_CLAUSE
6156 ------------------------------
6157 -- 9.5.2 Entry Declaration --
6158 ------------------------------
6160 -- ENTRY_DECLARATION ::=
6161 -- [[not] overriding]
6162 -- entry DEFINING_IDENTIFIER
6163 -- [(DISCRETE_SUBTYPE_DEFINITION)] PARAMETER_PROFILE
6164 -- [ASPECT_SPECIFICATIONS];
6166 -- N_Entry_Declaration
6167 -- Sloc points to ENTRY
6168 -- Defining_Identifier
6169 -- Discrete_Subtype_Definition (set to Empty if not present)
6170 -- Parameter_Specifications (set to No_List if no formal part)
6171 -- Corresponding_Body
6172 -- Must_Override set if overriding indicator present
6173 -- Must_Not_Override set if not_overriding indicator present
6175 -- Note: overriding indicator is an Ada 2005 feature
6177 -----------------------------
6178 -- 9.5.2 Accept statement --
6179 -----------------------------
6181 -- ACCEPT_STATEMENT ::=
6182 -- accept entry_DIRECT_NAME
6183 -- [(ENTRY_INDEX)] PARAMETER_PROFILE [do
6184 -- HANDLED_SEQUENCE_OF_STATEMENTS
6185 -- end [entry_IDENTIFIER]];
6187 -- Gigi restriction: This node never appears
6189 -- Note: there are no explicit declarations allowed in an accept
6190 -- statement. However, the implicit declarations for any statement
6191 -- identifiers (labels and block/loop identifiers) are declarations
6192 -- that belong logically to the accept statement, and that is why
6193 -- there is a Declarations field in this node.
6195 -- N_Accept_Statement
6196 -- Sloc points to ACCEPT
6197 -- Entry_Direct_Name
6198 -- Entry_Index (set to Empty if not present)
6199 -- Parameter_Specifications (set to No_List if no formal part)
6200 -- Handled_Statement_Sequence
6201 -- Declarations (set to No_List if no declarations)
6203 ------------------------
6204 -- 9.5.2 Entry Index --
6205 ------------------------
6207 -- ENTRY_INDEX ::= EXPRESSION
6209 -----------------------
6210 -- 9.5.2 Entry Body --
6211 -----------------------
6213 -- ENTRY_BODY ::=
6214 -- entry DEFINING_IDENTIFIER ENTRY_BODY_FORMAL_PART ENTRY_BARRIER is
6215 -- DECLARATIVE_PART
6216 -- begin
6217 -- HANDLED_SEQUENCE_OF_STATEMENTS
6218 -- end [entry_IDENTIFIER];
6220 -- ENTRY_BARRIER ::= when CONDITION
6222 -- Note: we store the CONDITION of the ENTRY_BARRIER in the node for
6223 -- the ENTRY_BODY_FORMAL_PART to avoid the N_Entry_Body node getting
6224 -- too full (it would otherwise have too many fields)
6226 -- Gigi restriction: This node never appears
6228 -- N_Entry_Body
6229 -- Sloc points to ENTRY
6230 -- Defining_Identifier
6231 -- Entry_Body_Formal_Part
6232 -- Declarations
6233 -- Handled_Statement_Sequence
6234 -- Activation_Chain_Entity
6235 -- Corresponding_Spec
6236 -- At_End_Proc (set to Empty if no clean up procedure)
6238 -----------------------------------
6239 -- 9.5.2 Entry Body Formal Part --
6240 -----------------------------------
6242 -- ENTRY_BODY_FORMAL_PART ::=
6243 -- [(ENTRY_INDEX_SPECIFICATION)] PARAMETER_PROFILE
6245 -- Note that an entry body formal part node is present even if it is
6246 -- empty. This reflects the grammar, in which it is the components of
6247 -- the entry body formal part that are optional, not the entry body
6248 -- formal part itself. Also this means that the barrier condition
6249 -- always has somewhere to be stored.
6251 -- Gigi restriction: This node never appears
6253 -- N_Entry_Body_Formal_Part
6254 -- Sloc points to first token
6255 -- Entry_Index_Specification (set to Empty if not present)
6256 -- Parameter_Specifications (set to No_List if no formal part)
6257 -- Condition from entry barrier of entry body
6259 --------------------------
6260 -- 9.5.2 Entry Barrier --
6261 --------------------------
6263 -- ENTRY_BARRIER ::= when CONDITION
6265 --------------------------------------
6266 -- 9.5.2 Entry Index Specification --
6267 --------------------------------------
6269 -- ENTRY_INDEX_SPECIFICATION ::=
6270 -- for DEFINING_IDENTIFIER in DISCRETE_SUBTYPE_DEFINITION
6272 -- Gigi restriction: This node never appears
6274 -- N_Entry_Index_Specification
6275 -- Sloc points to FOR
6276 -- Defining_Identifier
6277 -- Discrete_Subtype_Definition
6279 ---------------------------------
6280 -- 9.5.3 Entry Call Statement --
6281 ---------------------------------
6283 -- ENTRY_CALL_STATEMENT ::= entry_NAME [ACTUAL_PARAMETER_PART];
6285 -- The parser may generate a procedure call for this construct. The
6286 -- semantic pass must correct this misidentification where needed.
6288 -- Gigi restriction: This node never appears
6290 -- N_Entry_Call_Statement
6291 -- Sloc points to first token of name
6292 -- Name
6293 -- Parameter_Associations (set to No_List if no
6294 -- actual parameter part)
6295 -- First_Named_Actual
6296 -- Is_Elaboration_Checks_OK_Node
6297 -- Is_SPARK_Mode_On_Node
6298 -- Is_Elaboration_Warnings_OK_Node
6300 ------------------------------
6301 -- 9.5.4 Requeue Statement --
6302 ------------------------------
6304 -- REQUEUE_STATEMENT ::= requeue entry_NAME [with abort];
6306 -- Note: requeue statements are not permitted in Ada 83 mode
6308 -- Gigi restriction: This node never appears
6310 -- N_Requeue_Statement
6311 -- Sloc points to REQUEUE
6312 -- Name
6313 -- Abort_Present
6314 -- Is_Elaboration_Checks_OK_Node
6315 -- Is_SPARK_Mode_On_Node
6316 -- Is_Elaboration_Warnings_OK_Node
6318 --------------------------
6319 -- 9.6 Delay Statement --
6320 --------------------------
6322 -- DELAY_STATEMENT ::=
6323 -- DELAY_UNTIL_STATEMENT
6324 -- | DELAY_RELATIVE_STATEMENT
6326 --------------------------------
6327 -- 9.6 Delay Until Statement --
6328 --------------------------------
6330 -- DELAY_UNTIL_STATEMENT ::= delay until delay_EXPRESSION;
6332 -- Note: delay until statements are not permitted in Ada 83 mode
6334 -- Gigi restriction: This node never appears
6336 -- N_Delay_Until_Statement
6337 -- Sloc points to DELAY
6338 -- Expression
6340 -----------------------------------
6341 -- 9.6 Delay Relative Statement --
6342 -----------------------------------
6344 -- DELAY_RELATIVE_STATEMENT ::= delay delay_EXPRESSION;
6346 -- Gigi restriction: This node never appears
6348 -- N_Delay_Relative_Statement
6349 -- Sloc points to DELAY
6350 -- Expression
6352 ---------------------------
6353 -- 9.7 Select Statement --
6354 ---------------------------
6356 -- SELECT_STATEMENT ::=
6357 -- SELECTIVE_ACCEPT
6358 -- | TIMED_ENTRY_CALL
6359 -- | CONDITIONAL_ENTRY_CALL
6360 -- | ASYNCHRONOUS_SELECT
6362 -----------------------------
6363 -- 9.7.1 Selective Accept --
6364 -----------------------------
6366 -- SELECTIVE_ACCEPT ::=
6367 -- select
6368 -- [GUARD]
6369 -- SELECT_ALTERNATIVE
6370 -- {or
6371 -- [GUARD]
6372 -- SELECT_ALTERNATIVE}
6373 -- [else
6374 -- SEQUENCE_OF_STATEMENTS]
6375 -- end select;
6377 -- Gigi restriction: This node never appears
6379 -- Note: the guard expression, if present, appears in the node for
6380 -- the select alternative.
6382 -- N_Selective_Accept
6383 -- Sloc points to SELECT
6384 -- Select_Alternatives
6385 -- Else_Statements (set to No_List if no else part)
6387 ------------------
6388 -- 9.7.1 Guard --
6389 ------------------
6391 -- GUARD ::= when CONDITION =>
6393 -- As noted above, the CONDITION that is part of a GUARD is included
6394 -- in the node for the select alternative for convenience.
6396 -------------------------------
6397 -- 9.7.1 Select Alternative --
6398 -------------------------------
6400 -- SELECT_ALTERNATIVE ::=
6401 -- ACCEPT_ALTERNATIVE
6402 -- | DELAY_ALTERNATIVE
6403 -- | TERMINATE_ALTERNATIVE
6405 -------------------------------
6406 -- 9.7.1 Accept Alternative --
6407 -------------------------------
6409 -- ACCEPT_ALTERNATIVE ::=
6410 -- ACCEPT_STATEMENT [SEQUENCE_OF_STATEMENTS]
6412 -- Gigi restriction: This node never appears
6414 -- N_Accept_Alternative
6415 -- Sloc points to ACCEPT
6416 -- Accept_Statement
6417 -- Condition from the guard (set to Empty if no guard present)
6418 -- Statements (set to Empty_List if no statements)
6419 -- Pragmas_Before pragmas before alt (set to No_List if none)
6420 -- Accept_Handler_Records
6422 ------------------------------
6423 -- 9.7.1 Delay Alternative --
6424 ------------------------------
6426 -- DELAY_ALTERNATIVE ::=
6427 -- DELAY_STATEMENT [SEQUENCE_OF_STATEMENTS]
6429 -- Gigi restriction: This node never appears
6431 -- N_Delay_Alternative
6432 -- Sloc points to DELAY
6433 -- Delay_Statement
6434 -- Condition from the guard (set to Empty if no guard present)
6435 -- Statements (set to Empty_List if no statements)
6436 -- Pragmas_Before pragmas before alt (set to No_List if none)
6438 ----------------------------------
6439 -- 9.7.1 Terminate Alternative --
6440 ----------------------------------
6442 -- TERMINATE_ALTERNATIVE ::= terminate;
6444 -- Gigi restriction: This node never appears
6446 -- N_Terminate_Alternative
6447 -- Sloc points to TERMINATE
6448 -- Condition from the guard (set to Empty if no guard present)
6449 -- Pragmas_Before pragmas before alt (set to No_List if none)
6450 -- Pragmas_After pragmas after alt (set to No_List if none)
6452 -----------------------------
6453 -- 9.7.2 Timed Entry Call --
6454 -----------------------------
6456 -- TIMED_ENTRY_CALL ::=
6457 -- select
6458 -- ENTRY_CALL_ALTERNATIVE
6459 -- or
6460 -- DELAY_ALTERNATIVE
6461 -- end select;
6463 -- Gigi restriction: This node never appears
6465 -- N_Timed_Entry_Call
6466 -- Sloc points to SELECT
6467 -- Entry_Call_Alternative
6468 -- Delay_Alternative
6470 -----------------------------------
6471 -- 9.7.2 Entry Call Alternative --
6472 -----------------------------------
6474 -- ENTRY_CALL_ALTERNATIVE ::=
6475 -- PROCEDURE_OR_ENTRY_CALL [SEQUENCE_OF_STATEMENTS]
6477 -- PROCEDURE_OR_ENTRY_CALL ::=
6478 -- PROCEDURE_CALL_STATEMENT | ENTRY_CALL_STATEMENT
6480 -- Gigi restriction: This node never appears
6482 -- N_Entry_Call_Alternative
6483 -- Sloc points to first token of entry call statement
6484 -- Entry_Call_Statement
6485 -- Statements (set to Empty_List if no statements)
6486 -- Pragmas_Before pragmas before alt (set to No_List if none)
6488 -----------------------------------
6489 -- 9.7.3 Conditional Entry Call --
6490 -----------------------------------
6492 -- CONDITIONAL_ENTRY_CALL ::=
6493 -- select
6494 -- ENTRY_CALL_ALTERNATIVE
6495 -- else
6496 -- SEQUENCE_OF_STATEMENTS
6497 -- end select;
6499 -- Gigi restriction: This node never appears
6501 -- N_Conditional_Entry_Call
6502 -- Sloc points to SELECT
6503 -- Entry_Call_Alternative
6504 -- Else_Statements
6506 --------------------------------
6507 -- 9.7.4 Asynchronous Select --
6508 --------------------------------
6510 -- ASYNCHRONOUS_SELECT ::=
6511 -- select
6512 -- TRIGGERING_ALTERNATIVE
6513 -- then abort
6514 -- ABORTABLE_PART
6515 -- end select;
6517 -- Note: asynchronous select is not permitted in Ada 83 mode
6519 -- Gigi restriction: This node never appears
6521 -- N_Asynchronous_Select
6522 -- Sloc points to SELECT
6523 -- Triggering_Alternative
6524 -- Abortable_Part
6526 -----------------------------------
6527 -- 9.7.4 Triggering Alternative --
6528 -----------------------------------
6530 -- TRIGGERING_ALTERNATIVE ::=
6531 -- TRIGGERING_STATEMENT [SEQUENCE_OF_STATEMENTS]
6533 -- Gigi restriction: This node never appears
6535 -- N_Triggering_Alternative
6536 -- Sloc points to first token of triggering statement
6537 -- Triggering_Statement
6538 -- Statements (set to Empty_List if no statements)
6539 -- Pragmas_Before pragmas before alt (set to No_List if none)
6541 ---------------------------------
6542 -- 9.7.4 Triggering Statement --
6543 ---------------------------------
6545 -- TRIGGERING_STATEMENT ::= PROCEDURE_OR_ENTRY_CALL | DELAY_STATEMENT
6547 ---------------------------
6548 -- 9.7.4 Abortable Part --
6549 ---------------------------
6551 -- ABORTABLE_PART ::= SEQUENCE_OF_STATEMENTS
6553 -- Gigi restriction: This node never appears
6555 -- N_Abortable_Part
6556 -- Sloc points to ABORT
6557 -- Statements
6559 --------------------------
6560 -- 9.8 Abort Statement --
6561 --------------------------
6563 -- ABORT_STATEMENT ::= abort task_NAME {, task_NAME};
6565 -- Gigi restriction: This node never appears
6567 -- N_Abort_Statement
6568 -- Sloc points to ABORT
6569 -- Names
6571 -------------------------
6572 -- 10.1.1 Compilation --
6573 -------------------------
6575 -- COMPILATION ::= {COMPILATION_UNIT}
6577 -- There is no explicit node in the tree for a compilation, since in
6578 -- general the compiler is processing only a single compilation unit
6579 -- at a time. It is possible to parse multiple units in syntax check
6580 -- only mode, but the trees are discarded in that case.
6582 ------------------------------
6583 -- 10.1.1 Compilation Unit --
6584 ------------------------------
6586 -- COMPILATION_UNIT ::=
6587 -- CONTEXT_CLAUSE LIBRARY_ITEM
6588 -- | CONTEXT_CLAUSE SUBUNIT
6590 -- The N_Compilation_Unit node itself represents the above syntax.
6591 -- However, there are two additional items not reflected in the above
6592 -- syntax. First we have the global declarations that are added by the
6593 -- code generator. These are outer level declarations (so they cannot
6594 -- be represented as being inside the units). An example is the wrapper
6595 -- subprograms that are created to do ABE checking. As always a list of
6596 -- declarations can contain actions as well (i.e. statements), and such
6597 -- statements are executed as part of the elaboration of the unit. Note
6598 -- that all such declarations are elaborated before the library unit.
6600 -- Similarly, certain actions need to be elaborated at the completion
6601 -- of elaboration of the library unit (notably the statement that sets
6602 -- the Boolean flag indicating that elaboration is complete).
6604 -- The third item not reflected in the syntax is pragmas that appear
6605 -- after the compilation unit. As always pragmas are a problem since
6606 -- they are not part of the formal syntax, but can be stuck into the
6607 -- source following a set of ad hoc rules, and we have to find an ad
6608 -- hoc way of sticking them into the tree. For pragmas that appear
6609 -- before the library unit, we just consider them to be part of the
6610 -- context clause, and pragmas can appear in the Context_Items list
6611 -- of the compilation unit. However, pragmas can also appear after
6612 -- the library item.
6614 -- To deal with all these problems, we create an auxiliary node for
6615 -- a compilation unit, referenced from the N_Compilation_Unit node,
6616 -- that contains these items.
6618 -- N_Compilation_Unit
6619 -- Sloc points to first token of defining unit name
6620 -- Context_Items context items and pragmas preceding unit
6621 -- Private_Present set if library unit has private keyword
6622 -- Unit library item or subunit
6623 -- Aux_Decls_Node points to the N_Compilation_Unit_Aux node
6624 -- First_Inlined_Subprogram
6625 -- Library_Unit corresponding/parent spec/body
6626 -- Save_Invocation_Graph_Of_Body
6627 -- Acts_As_Spec flag for subprogram body with no spec
6628 -- Body_Required set for spec if body is required
6629 -- Has_Pragma_Suppress_All
6630 -- Context_Pending
6631 -- Has_No_Elaboration_Code
6633 -- N_Compilation_Unit_Aux
6634 -- Sloc is a copy of the Sloc from the N_Compilation_Unit node
6635 -- Declarations (set to No_List if no global declarations)
6636 -- Actions (set to No_List if no actions)
6637 -- Pragmas_After pragmas after unit (set to No_List if none)
6638 -- Config_Pragmas config pragmas (set to Empty_List if none)
6639 -- Default_Storage_Pool
6641 --------------------------
6642 -- 10.1.1 Library Item --
6643 --------------------------
6645 -- LIBRARY_ITEM ::=
6646 -- [private] LIBRARY_UNIT_DECLARATION
6647 -- | LIBRARY_UNIT_BODY
6648 -- | [private] LIBRARY_UNIT_RENAMING_DECLARATION
6650 -- Note: PRIVATE is not allowed in Ada 83 mode
6652 -- There is no explicit node in the tree for library item, instead
6653 -- the declaration or body, and the flag for private if present,
6654 -- appear in the N_Compilation_Unit node.
6656 --------------------------------------
6657 -- 10.1.1 Library Unit Declaration --
6658 --------------------------------------
6660 -- LIBRARY_UNIT_DECLARATION ::=
6661 -- SUBPROGRAM_DECLARATION | PACKAGE_DECLARATION
6662 -- | GENERIC_DECLARATION | GENERIC_INSTANTIATION
6664 -----------------------------------------------
6665 -- 10.1.1 Library Unit Renaming Declaration --
6666 -----------------------------------------------
6668 -- LIBRARY_UNIT_RENAMING_DECLARATION ::=
6669 -- PACKAGE_RENAMING_DECLARATION
6670 -- | GENERIC_RENAMING_DECLARATION
6671 -- | SUBPROGRAM_RENAMING_DECLARATION
6673 -------------------------------
6674 -- 10.1.1 Library unit body --
6675 -------------------------------
6677 -- LIBRARY_UNIT_BODY ::= SUBPROGRAM_BODY | PACKAGE_BODY
6679 ------------------------------
6680 -- 10.1.1 Parent Unit Name --
6681 ------------------------------
6683 -- PARENT_UNIT_NAME ::= NAME
6685 ----------------------------
6686 -- 10.1.2 Context clause --
6687 ----------------------------
6689 -- CONTEXT_CLAUSE ::= {CONTEXT_ITEM}
6691 -- The context clause can include pragmas, and any pragmas that appear
6692 -- before the context clause proper (i.e. all configuration pragmas,
6693 -- also appear at the front of this list).
6695 --------------------------
6696 -- 10.1.2 Context_Item --
6697 --------------------------
6699 -- CONTEXT_ITEM ::= WITH_CLAUSE | USE_CLAUSE | WITH_TYPE_CLAUSE
6701 -------------------------
6702 -- 10.1.2 With clause --
6703 -------------------------
6705 -- WITH_CLAUSE ::=
6706 -- with library_unit_NAME {,library_unit_NAME};
6708 -- A separate With clause is built for each name, so that we have
6709 -- a Corresponding_Spec field for each with'ed spec. The flags
6710 -- First_Name and Last_Name are used to reconstruct the exact
6711 -- source form. When a list of names appears in one with clause,
6712 -- the first name in the list has First_Name set, and the last
6713 -- has Last_Name set. If the with clause has only one name, then
6714 -- both of the flags First_Name and Last_Name are set in this name.
6716 -- Note: in the case of implicit with's that are installed by the
6717 -- Rtsfind routine, Implicit_With is set, and the Sloc is typically
6718 -- set to Standard_Location, but it is incorrect to test the Sloc
6719 -- to find out if a with clause is implicit, test the flag instead.
6721 -- N_With_Clause
6722 -- Sloc points to first token of library unit name
6723 -- Name
6724 -- Private_Present set if with_clause has private keyword
6725 -- Limited_Present set if LIMITED is present
6726 -- Next_Implicit_With
6727 -- Library_Unit
6728 -- Corresponding_Spec
6729 -- First_Name (set to True if first name or only one name)
6730 -- Last_Name (set to True if last name or only one name)
6731 -- Context_Installed
6732 -- Elaborate_Present
6733 -- Elaborate_All_Present
6734 -- Elaborate_All_Desirable
6735 -- Elaborate_Desirable
6736 -- Implicit_With
6737 -- Limited_View_Installed
6738 -- Parent_With
6739 -- Unreferenced_In_Spec
6740 -- No_Entities_Ref_In_Spec
6742 -- Note: Limited_Present and Limited_View_Installed are used to support
6743 -- the implementation of Ada 2005 (AI-50217).
6745 -- Similarly, Private_Present is used to support the implementation of
6746 -- Ada 2005 (AI-50262).
6748 -- Note: if the WITH clause refers to a standard library unit, then a
6749 -- limited with clause is changed into a normal with clause, because we
6750 -- are not prepared to deal with limited with in the context of Rtsfind.
6751 -- So in this case, the Limited_Present flag will be False in the final
6752 -- tree.
6754 ----------------------
6755 -- With_Type clause --
6756 ----------------------
6758 -- This is a GNAT extension, used to implement mutually recursive
6759 -- types declared in different packages.
6761 -- Note: this is now obsolete. The functionality of this construct
6762 -- is now implemented by the Ada 2005 limited_with_clause.
6764 ---------------------
6765 -- 10.2 Body stub --
6766 ---------------------
6768 -- BODY_STUB ::=
6769 -- SUBPROGRAM_BODY_STUB
6770 -- | PACKAGE_BODY_STUB
6771 -- | TASK_BODY_STUB
6772 -- | PROTECTED_BODY_STUB
6774 ----------------------------------
6775 -- 10.1.3 Subprogram Body Stub --
6776 ----------------------------------
6778 -- SUBPROGRAM_BODY_STUB ::=
6779 -- SUBPROGRAM_SPECIFICATION is separate
6780 -- [ASPECT_SPECIFICATION];
6782 -- N_Subprogram_Body_Stub
6783 -- Sloc points to FUNCTION or PROCEDURE
6784 -- Specification
6785 -- Corresponding_Spec_Of_Stub
6786 -- Library_Unit points to the subunit
6787 -- Corresponding_Body
6788 -- At_End_Proc (set to Empty if no clean up procedure)
6790 -------------------------------
6791 -- 10.1.3 Package Body Stub --
6792 -------------------------------
6794 -- PACKAGE_BODY_STUB ::=
6795 -- package body DEFINING_IDENTIFIER is separate
6796 -- [ASPECT_SPECIFICATION];
6798 -- N_Package_Body_Stub
6799 -- Sloc points to PACKAGE
6800 -- Defining_Identifier
6801 -- Corresponding_Spec_Of_Stub
6802 -- Library_Unit points to the subunit
6803 -- Corresponding_Body
6805 ----------------------------
6806 -- 10.1.3 Task Body Stub --
6807 ----------------------------
6809 -- TASK_BODY_STUB ::=
6810 -- task body DEFINING_IDENTIFIER is separate
6811 -- [ASPECT_SPECIFICATION];
6813 -- N_Task_Body_Stub
6814 -- Sloc points to TASK
6815 -- Defining_Identifier
6816 -- Corresponding_Spec_Of_Stub
6817 -- Library_Unit points to the subunit
6818 -- Corresponding_Body
6819 -- At_End_Proc (set to Empty if no clean up procedure)
6821 ---------------------------------
6822 -- 10.1.3 Protected Body Stub --
6823 ---------------------------------
6825 -- PROTECTED_BODY_STUB ::=
6826 -- protected body DEFINING_IDENTIFIER is separate
6827 -- [ASPECT_SPECIFICATION];
6829 -- Note: protected body stubs are not allowed in Ada 83 mode
6831 -- N_Protected_Body_Stub
6832 -- Sloc points to PROTECTED
6833 -- Defining_Identifier
6834 -- Corresponding_Spec_Of_Stub
6835 -- Library_Unit points to the subunit
6836 -- Corresponding_Body
6838 ---------------------
6839 -- 10.1.3 Subunit --
6840 ---------------------
6842 -- SUBUNIT ::= separate (PARENT_UNIT_NAME) PROPER_BODY
6844 -- N_Subunit
6845 -- Sloc points to SEPARATE
6846 -- Name is the name of the parent unit
6847 -- Proper_Body is the subunit body
6848 -- Corresponding_Stub is the stub declaration for the unit.
6850 ---------------------------------
6851 -- 11.1 Exception Declaration --
6852 ---------------------------------
6854 -- EXCEPTION_DECLARATION ::= DEFINING_IDENTIFIER_LIST : exception
6855 -- [ASPECT_SPECIFICATIONS];
6857 -- For consistency with object declarations etc., the parser converts
6858 -- the case of multiple identifiers being declared to a series of
6859 -- declarations in which the expression is copied, using the More_Ids
6860 -- and Prev_Ids flags to remember the source form as described in the
6861 -- section on "Handling of Defining Identifier Lists".
6863 -- N_Exception_Declaration
6864 -- Sloc points to EXCEPTION
6865 -- Defining_Identifier
6866 -- Expression
6867 -- Renaming_Exception
6868 -- More_Ids (set to False if no more identifiers in list)
6869 -- Prev_Ids (set to False if no previous identifiers in list)
6871 ------------------------------------------
6872 -- 11.2 Handled Sequence Of Statements --
6873 ------------------------------------------
6875 -- HANDLED_SEQUENCE_OF_STATEMENTS ::=
6876 -- SEQUENCE_OF_STATEMENTS
6877 -- [exception
6878 -- EXCEPTION_HANDLER
6879 -- {EXCEPTION_HANDLER}]
6880 -- [at end
6881 -- cleanup_procedure_call (param, param, param, ...);]
6883 -- The AT END phrase is a GNAT extension to provide for cleanups. It is
6884 -- used only internally currently, but is considered to be syntactic.
6885 -- At the moment, the only cleanup action allowed is a single call to a
6886 -- parameterless procedure; this restriction could be lifted if we make
6887 -- some changes in gigi. The At_End_Proc field is an N_Identifier node
6888 -- that denotes the procedure to be called. The cleanup action occurs
6889 -- whenever the sequence of statements is left for any reason. The
6890 -- possible reasons are:
6892 -- 1. reaching the end of the sequence
6893 -- 2. exit, return, or goto
6894 -- 3. exception or abort
6896 -- The cleanup action also occurs whenever the exception handlers are
6897 -- left.
6899 -- The AT END cleanup handler protects only the sequence of statements
6900 -- and the exception handlers (not the associated declarations of
6901 -- the parent), just like exception handlers do not protect the
6902 -- declarations. The big difference is that the cleanup actions occur
6903 -- on either a normal or an abnormal exit from the statement sequence.
6905 -- At_End_Proc is also a field of various nodes that can contain
6906 -- both Declarations and Handled_Statement_Sequence, such as subprogram
6907 -- bodies and block statements. In that case, the At_End_Proc
6908 -- protects the Declarations as well as the Handled_Statement_Sequence.
6910 -- Note: the list of Exception_Handlers can contain pragmas as well
6911 -- as actual handlers. In practice these pragmas can only occur at
6912 -- the start of the list, since any pragmas occurring later on will
6913 -- be included in the statement list of the corresponding handler.
6915 -- Note: although in the Ada syntax, the sequence of statements in
6916 -- a handled sequence of statements can only contain statements, we
6917 -- allow free mixing of declarations and statements in the resulting
6918 -- expanded tree. This is for example used to deal with the case of
6919 -- a cleanup procedure that must handle declarations as well as the
6920 -- statements of a block.
6922 -- Note: the cleanup_procedure_call does not go through the common
6923 -- processing for calls, which in particular means that it will not be
6924 -- automatically inlined in all cases, even though the procedure to be
6925 -- called is marked inline. More specifically, if the procedure comes
6926 -- from another unit than the main source unit, for example a run-time
6927 -- unit, then it needs to be manually added to the list of bodies to be
6928 -- inlined by invoking Add_Inlined_Body on it.
6930 -- N_Handled_Sequence_Of_Statements
6931 -- Sloc points to first token of first statement
6932 -- Statements
6933 -- End_Label (set to Empty if expander generated)
6934 -- Exception_Handlers (set to No_List if none present)
6935 -- At_End_Proc (set to Empty if no clean up procedure)
6937 -- Note: A Handled_Sequence_Of_Statements can contain both
6938 -- Exception_Handlers and an At_End_Proc.
6940 -- Note: the parent always contains a Declarations field which contains
6941 -- declarations associated with the handled sequence of statements. This
6942 -- is true even in the case of an accept statement (see description of
6943 -- the N_Accept_Statement node).
6945 -- End_Label refers to the containing construct
6947 -----------------------------
6948 -- 11.2 Exception Handler --
6949 -----------------------------
6951 -- EXCEPTION_HANDLER ::=
6952 -- when [CHOICE_PARAMETER_SPECIFICATION :]
6953 -- EXCEPTION_CHOICE {| EXCEPTION_CHOICE} =>
6954 -- SEQUENCE_OF_STATEMENTS
6956 -- Note: choice parameter specification is not allowed in Ada 83 mode
6958 -- N_Exception_Handler
6959 -- Sloc points to WHEN
6960 -- Choice_Parameter (set to Empty if not present)
6961 -- Exception_Choices
6962 -- Statements
6963 -- Exception_Label (set to Empty if not present)
6964 -- Local_Raise_Statements (set to No_Elist if not present)
6965 -- Local_Raise_Not_OK
6966 -- Has_Local_Raise
6968 ------------------------------------------
6969 -- 11.2 Choice parameter specification --
6970 ------------------------------------------
6972 -- CHOICE_PARAMETER_SPECIFICATION ::= DEFINING_IDENTIFIER
6974 ----------------------------
6975 -- 11.2 Exception Choice --
6976 ----------------------------
6978 -- EXCEPTION_CHOICE ::= exception_NAME | others
6980 -- Except in the case of OTHERS, no explicit node appears in the tree
6981 -- for exception choice. Instead the exception name appears directly.
6982 -- An OTHERS choice is represented by a N_Others_Choice node (see
6983 -- section 3.8.1.
6985 -- Note: for the exception choice created for an at end handler, the
6986 -- exception choice is an N_Others_Choice node with All_Others set.
6988 ---------------------------
6989 -- 11.3 Raise Statement --
6990 ---------------------------
6992 -- RAISE_STATEMENT ::= raise [exception_NAME];
6994 -- In Ada 2005, we have
6996 -- RAISE_STATEMENT ::=
6997 -- raise; | raise exception_NAME [with string_EXPRESSION];
6999 -- N_Raise_Statement
7000 -- Sloc points to RAISE
7001 -- Name (set to Empty if no exception name present)
7002 -- Expression (set to Empty if no expression present)
7004 ----------------------------
7005 -- 11.3 Raise Expression --
7006 ----------------------------
7008 -- RAISE_EXPRESSION ::= raise exception_NAME [with string_EXPRESSION]
7010 -- N_Raise_Expression
7011 -- Sloc points to RAISE
7012 -- Name (always present)
7013 -- Expression (set to Empty if no expression present)
7014 -- plus fields for expression
7016 -------------------------------
7017 -- 12.1 Generic Declaration --
7018 -------------------------------
7020 -- GENERIC_DECLARATION ::=
7021 -- GENERIC_SUBPROGRAM_DECLARATION | GENERIC_PACKAGE_DECLARATION
7023 ------------------------------------------
7024 -- 12.1 Generic Subprogram Declaration --
7025 ------------------------------------------
7027 -- GENERIC_SUBPROGRAM_DECLARATION ::=
7028 -- GENERIC_FORMAL_PART SUBPROGRAM_SPECIFICATION
7029 -- [ASPECT_SPECIFICATIONS];
7031 -- Note: Generic_Formal_Declarations can include pragmas
7033 -- N_Generic_Subprogram_Declaration
7034 -- Sloc points to GENERIC
7035 -- Specification subprogram specification
7036 -- Corresponding_Body
7037 -- Generic_Formal_Declarations from generic formal part
7038 -- Parent_Spec
7040 ---------------------------------------
7041 -- 12.1 Generic Package Declaration --
7042 ---------------------------------------
7044 -- GENERIC_PACKAGE_DECLARATION ::=
7045 -- GENERIC_FORMAL_PART PACKAGE_SPECIFICATION
7046 -- [ASPECT_SPECIFICATIONS];
7048 -- Note: when we do generics right, the Activation_Chain_Entity entry
7049 -- for this node can be removed (since the expander won't see generic
7050 -- units any more)???.
7052 -- Note: Generic_Formal_Declarations can include pragmas
7054 -- N_Generic_Package_Declaration
7055 -- Sloc points to GENERIC
7056 -- Specification package specification
7057 -- Corresponding_Body
7058 -- Generic_Formal_Declarations from generic formal part
7059 -- Parent_Spec
7060 -- Activation_Chain_Entity
7062 -------------------------------
7063 -- 12.1 Generic Formal Part --
7064 -------------------------------
7066 -- GENERIC_FORMAL_PART ::=
7067 -- generic {GENERIC_FORMAL_PARAMETER_DECLARATION | USE_CLAUSE}
7069 ------------------------------------------------
7070 -- 12.1 Generic Formal Parameter Declaration --
7071 ------------------------------------------------
7073 -- GENERIC_FORMAL_PARAMETER_DECLARATION ::=
7074 -- FORMAL_OBJECT_DECLARATION
7075 -- | FORMAL_TYPE_DECLARATION
7076 -- | FORMAL_SUBPROGRAM_DECLARATION
7077 -- | FORMAL_PACKAGE_DECLARATION
7079 ---------------------------------
7080 -- 12.3 Generic Instantiation --
7081 ---------------------------------
7083 -- GENERIC_INSTANTIATION ::=
7084 -- package DEFINING_PROGRAM_UNIT_NAME is
7085 -- new generic_package_NAME [GENERIC_ACTUAL_PART]
7086 -- [ASPECT_SPECIFICATIONS];
7087 -- | [[not] overriding]
7088 -- procedure DEFINING_PROGRAM_UNIT_NAME is
7089 -- new generic_procedure_NAME [GENERIC_ACTUAL_PART]
7090 -- [ASPECT_SPECIFICATIONS];
7091 -- | [[not] overriding]
7092 -- function DEFINING_DESIGNATOR is
7093 -- new generic_function_NAME [GENERIC_ACTUAL_PART]
7094 -- [ASPECT_SPECIFICATIONS];
7096 -- N_Package_Instantiation
7097 -- Sloc points to PACKAGE
7098 -- Defining_Unit_Name
7099 -- Name
7100 -- Generic_Associations (set to No_List if no
7101 -- generic actual part)
7102 -- Parent_Spec
7103 -- Instance_Spec
7104 -- Is_Elaboration_Checks_OK_Node
7105 -- Is_SPARK_Mode_On_Node
7106 -- Is_Elaboration_Warnings_OK_Node
7107 -- Is_Declaration_Level_Node
7108 -- Is_Known_Guaranteed_ABE
7110 -- N_Procedure_Instantiation
7111 -- Sloc points to PROCEDURE
7112 -- Defining_Unit_Name
7113 -- Name
7114 -- Parent_Spec
7115 -- Generic_Associations (set to No_List if no
7116 -- generic actual part)
7117 -- Instance_Spec
7118 -- Is_Elaboration_Checks_OK_Node
7119 -- Is_SPARK_Mode_On_Node
7120 -- Is_Elaboration_Warnings_OK_Node
7121 -- Is_Declaration_Level_Node
7122 -- Must_Override set if overriding indicator present
7123 -- Must_Not_Override set if not_overriding indicator present
7124 -- Is_Known_Guaranteed_ABE
7126 -- N_Function_Instantiation
7127 -- Sloc points to FUNCTION
7128 -- Defining_Unit_Name
7129 -- Name
7130 -- Generic_Associations (set to No_List if no
7131 -- generic actual part)
7132 -- Parent_Spec
7133 -- Instance_Spec
7134 -- Is_Elaboration_Checks_OK_Node
7135 -- Is_SPARK_Mode_On_Node
7136 -- Is_Elaboration_Warnings_OK_Node
7137 -- Is_Declaration_Level_Node
7138 -- Must_Override set if overriding indicator present
7139 -- Must_Not_Override set if not_overriding indicator present
7140 -- Is_Known_Guaranteed_ABE
7142 -- Note: overriding indicator is an Ada 2005 feature
7144 -------------------------------
7145 -- 12.3 Generic Actual Part --
7146 -------------------------------
7148 -- GENERIC_ACTUAL_PART ::=
7149 -- (GENERIC_ASSOCIATION {, GENERIC_ASSOCIATION})
7151 -------------------------------
7152 -- 12.3 Generic Association --
7153 -------------------------------
7155 -- GENERIC_ASSOCIATION ::=
7156 -- [generic_formal_parameter_SELECTOR_NAME =>]
7158 -- Note: unlike the procedure call case, a generic association node
7159 -- is generated for every association, even if no formal parameter
7160 -- selector name is present. In this case the parser will leave the
7161 -- Selector_Name field set to Empty, to be filled in later by the
7162 -- semantic pass.
7164 -- In Ada 2005, a formal may be associated with a box, if the
7165 -- association is part of the list of actuals for a formal package.
7166 -- If the association is given by OTHERS => <>, the association is
7167 -- an N_Others_Choice.
7169 -- N_Generic_Association
7170 -- Sloc points to first token of generic association
7171 -- Selector_Name (set to Empty if no formal
7172 -- parameter selector name)
7173 -- Explicit_Generic_Actual_Parameter (Empty if box present)
7174 -- Box_Present (for formal_package associations with a box)
7176 ---------------------------------------------
7177 -- 12.3 Explicit Generic Actual Parameter --
7178 ---------------------------------------------
7180 -- EXPLICIT_GENERIC_ACTUAL_PARAMETER ::=
7181 -- EXPRESSION | variable_NAME | subprogram_NAME
7182 -- | entry_NAME | SUBTYPE_MARK | package_instance_NAME
7184 -------------------------------------
7185 -- 12.4 Formal Object Declaration --
7186 -------------------------------------
7188 -- FORMAL_OBJECT_DECLARATION ::=
7189 -- DEFINING_IDENTIFIER_LIST :
7190 -- MODE [NULL_EXCLUSION] SUBTYPE_MARK [:= DEFAULT_EXPRESSION]
7191 -- [ASPECT_SPECIFICATIONS];
7192 -- | DEFINING_IDENTIFIER_LIST :
7193 -- MODE ACCESS_DEFINITION [:= DEFAULT_EXPRESSION]
7194 -- [ASPECT_SPECIFICATIONS];
7196 -- Although the syntax allows multiple identifiers in the list, the
7197 -- semantics is as though successive declarations were given with
7198 -- identical type definition and expression components. To simplify
7199 -- semantic processing, the parser represents a multiple declaration
7200 -- case as a sequence of single declarations, using the More_Ids and
7201 -- Prev_Ids flags to preserve the original source form as described
7202 -- in the section on "Handling of Defining Identifier Lists".
7204 -- N_Formal_Object_Declaration
7205 -- Sloc points to first identifier
7206 -- Defining_Identifier
7207 -- In_Present
7208 -- Out_Present
7209 -- Null_Exclusion_Present (set to False if not present)
7210 -- Subtype_Mark (set to Empty if not present)
7211 -- Access_Definition (set to Empty if not present)
7212 -- Default_Expression (set to Empty if no default expression)
7213 -- More_Ids (set to False if no more identifiers in list)
7214 -- Prev_Ids (set to False if no previous identifiers in list)
7216 -----------------------------------
7217 -- 12.5 Formal Type Declaration --
7218 -----------------------------------
7220 -- FORMAL_TYPE_DECLARATION ::=
7221 -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART]
7222 -- is FORMAL_TYPE_DEFINITION
7223 -- [ASPECT_SPECIFICATIONS];
7224 -- | type DEFINING_IDENTIFIER [DISCRIMINANT_PART] [is tagged]
7226 -- N_Formal_Type_Declaration
7227 -- Sloc points to TYPE
7228 -- Defining_Identifier
7229 -- Formal_Type_Definition
7230 -- Discriminant_Specifications (set to No_List if no
7231 -- discriminant part)
7232 -- Unknown_Discriminants_Present set if (<>) discriminant
7233 -- Default_Subtype_Mark
7235 ----------------------------------
7236 -- 12.5 Formal type definition --
7237 ----------------------------------
7239 -- FORMAL_TYPE_DEFINITION ::=
7240 -- FORMAL_PRIVATE_TYPE_DEFINITION
7241 -- | FORMAL_DERIVED_TYPE_DEFINITION
7242 -- | FORMAL_DISCRETE_TYPE_DEFINITION
7243 -- | FORMAL_SIGNED_INTEGER_TYPE_DEFINITION
7244 -- | FORMAL_MODULAR_TYPE_DEFINITION
7245 -- | FORMAL_FLOATING_POINT_DEFINITION
7246 -- | FORMAL_ORDINARY_FIXED_POINT_DEFINITION
7247 -- | FORMAL_DECIMAL_FIXED_POINT_DEFINITION
7248 -- | FORMAL_ARRAY_TYPE_DEFINITION
7249 -- | FORMAL_ACCESS_TYPE_DEFINITION
7250 -- | FORMAL_INTERFACE_TYPE_DEFINITION
7251 -- | FORMAL_INCOMPLETE_TYPE_DEFINITION
7253 -- The Ada 2012 syntax introduces two new non-terminals:
7254 -- Formal_{Complete,Incomplete}_Type_Declaration just to introduce
7255 -- the latter category. Here we introduce an incomplete type definition
7256 -- in order to preserve as much as possible the existing structure.
7258 ---------------------------------------------
7259 -- 12.5.1 Formal Private Type Definition --
7260 ---------------------------------------------
7262 -- FORMAL_PRIVATE_TYPE_DEFINITION ::=
7263 -- [[abstract] tagged] [limited] private
7265 -- Note: TAGGED is not allowed in Ada 83 mode
7267 -- N_Formal_Private_Type_Definition
7268 -- Sloc points to PRIVATE
7269 -- Uninitialized_Variable
7270 -- Abstract_Present
7271 -- Tagged_Present
7272 -- Limited_Present
7274 --------------------------------------------
7275 -- 12.5.1 Formal Derived Type Definition --
7276 --------------------------------------------
7278 -- FORMAL_DERIVED_TYPE_DEFINITION ::=
7279 -- [abstract] [limited | synchronized]
7280 -- new SUBTYPE_MARK [[and INTERFACE_LIST] with private]
7281 -- Note: this construct is not allowed in Ada 83 mode
7283 -- N_Formal_Derived_Type_Definition
7284 -- Sloc points to NEW
7285 -- Subtype_Mark
7286 -- Private_Present
7287 -- Abstract_Present
7288 -- Limited_Present
7289 -- Synchronized_Present
7290 -- Interface_List (set to No_List if none)
7292 -----------------------------------------------
7293 -- 12.5.1 Formal Incomplete Type Definition --
7294 -----------------------------------------------
7296 -- FORMAL_INCOMPLETE_TYPE_DEFINITION ::= [tagged]
7298 -- N_Formal_Incomplete_Type_Definition
7299 -- Sloc points to identifier of parent
7300 -- Tagged_Present
7302 ---------------------------------------------
7303 -- 12.5.2 Formal Discrete Type Definition --
7304 ---------------------------------------------
7306 -- FORMAL_DISCRETE_TYPE_DEFINITION ::= (<>)
7308 -- N_Formal_Discrete_Type_Definition
7309 -- Sloc points to (
7311 ---------------------------------------------------
7312 -- 12.5.2 Formal Signed Integer Type Definition --
7313 ---------------------------------------------------
7315 -- FORMAL_SIGNED_INTEGER_TYPE_DEFINITION ::= range <>
7317 -- N_Formal_Signed_Integer_Type_Definition
7318 -- Sloc points to RANGE
7320 --------------------------------------------
7321 -- 12.5.2 Formal Modular Type Definition --
7322 --------------------------------------------
7324 -- FORMAL_MODULAR_TYPE_DEFINITION ::= mod <>
7326 -- N_Formal_Modular_Type_Definition
7327 -- Sloc points to MOD
7329 ----------------------------------------------
7330 -- 12.5.2 Formal Floating Point Definition --
7331 ----------------------------------------------
7333 -- FORMAL_FLOATING_POINT_DEFINITION ::= digits <>
7335 -- N_Formal_Floating_Point_Definition
7336 -- Sloc points to DIGITS
7338 ----------------------------------------------------
7339 -- 12.5.2 Formal Ordinary Fixed Point Definition --
7340 ----------------------------------------------------
7342 -- FORMAL_ORDINARY_FIXED_POINT_DEFINITION ::= delta <>
7344 -- N_Formal_Ordinary_Fixed_Point_Definition
7345 -- Sloc points to DELTA
7347 ---------------------------------------------------
7348 -- 12.5.2 Formal Decimal Fixed Point Definition --
7349 ---------------------------------------------------
7351 -- FORMAL_DECIMAL_FIXED_POINT_DEFINITION ::= delta <> digits <>
7353 -- Note: formal decimal fixed point definition not allowed in Ada 83
7355 -- N_Formal_Decimal_Fixed_Point_Definition
7356 -- Sloc points to DELTA
7358 ------------------------------------------
7359 -- 12.5.3 Formal Array Type Definition --
7360 ------------------------------------------
7362 -- FORMAL_ARRAY_TYPE_DEFINITION ::= ARRAY_TYPE_DEFINITION
7364 -------------------------------------------
7365 -- 12.5.4 Formal Access Type Definition --
7366 -------------------------------------------
7368 -- FORMAL_ACCESS_TYPE_DEFINITION ::= ACCESS_TYPE_DEFINITION
7370 ----------------------------------------------
7371 -- 12.5.5 Formal Interface Type Definition --
7372 ----------------------------------------------
7374 -- FORMAL_INTERFACE_TYPE_DEFINITION ::= INTERFACE_TYPE_DEFINITION
7376 -----------------------------------------
7377 -- 12.6 Formal Subprogram Declaration --
7378 -----------------------------------------
7380 -- FORMAL_SUBPROGRAM_DECLARATION ::=
7381 -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION
7382 -- | FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION
7384 --------------------------------------------------
7385 -- 12.6 Formal Concrete Subprogram Declaration --
7386 --------------------------------------------------
7388 -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION ::=
7389 -- with SUBPROGRAM_SPECIFICATION [is SUBPROGRAM_DEFAULT]
7390 -- [ASPECT_SPECIFICATIONS];
7392 -- N_Formal_Concrete_Subprogram_Declaration
7393 -- Sloc points to WITH
7394 -- Specification
7395 -- Default_Name (set to Empty if no subprogram default)
7396 -- Box_Present
7397 -- Expression (set to Empty if no expression present)
7399 -- Note: If no subprogram default is present, then Name is set
7400 -- to Empty, and Box_Present is False.
7402 -- Note: The Expression field is only used for the GNAT extension
7403 -- that allows a FORMAL_CONCRETE_SUBPROGRAM_DECLARATION to specify
7404 -- an expression default for generic formal functions.
7406 --------------------------------------------------
7407 -- 12.6 Formal Abstract Subprogram Declaration --
7408 --------------------------------------------------
7410 -- FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION ::=
7411 -- with SUBPROGRAM_SPECIFICATION is abstract [SUBPROGRAM_DEFAULT]
7412 -- [ASPECT_SPECIFICATIONS];
7414 -- N_Formal_Abstract_Subprogram_Declaration
7415 -- Sloc points to WITH
7416 -- Specification
7417 -- Default_Name (set to Empty if no subprogram default)
7418 -- Box_Present
7420 -- Note: if no subprogram default is present, then Name is set
7421 -- to Empty, and Box_Present is False.
7423 ------------------------------
7424 -- 12.6 Subprogram Default --
7425 ------------------------------
7427 -- SUBPROGRAM_DEFAULT ::= DEFAULT_NAME | <> | (EXPRESSION)
7429 -- There is no separate node in the tree for a subprogram default.
7430 -- Instead the parent (N_Formal_Concrete_Subprogram_Declaration
7431 -- or N_Formal_Abstract_Subprogram_Declaration) node contains the
7432 -- default name or box indication, as needed.
7434 -- Note: The syntax "(EXPRESSION)" is a GNAT extension, and allows
7435 -- a FORMAL_CONCRETE_SUBPROGRAM_DECLARATION to specify an expression
7436 -- default for formal functions, in analogy with expression_functions.
7438 ------------------------
7439 -- 12.6 Default Name --
7440 ------------------------
7442 -- DEFAULT_NAME ::= NAME
7444 --------------------------------------
7445 -- 12.7 Formal Package Declaration --
7446 --------------------------------------
7448 -- FORMAL_PACKAGE_DECLARATION ::=
7449 -- with package DEFINING_IDENTIFIER
7450 -- is new generic_package_NAME FORMAL_PACKAGE_ACTUAL_PART
7451 -- [ASPECT_SPECIFICATIONS];
7453 -- Note: formal package declarations not allowed in Ada 83 mode
7455 -- N_Formal_Package_Declaration
7456 -- Sloc points to WITH
7457 -- Defining_Identifier
7458 -- Name
7459 -- Generic_Associations (set to No_List if (<>) case or
7460 -- empty generic actual part)
7461 -- Box_Present
7462 -- Instance_Spec
7463 -- Is_Known_Guaranteed_ABE
7465 --------------------------------------
7466 -- 12.7 Formal Package Actual Part --
7467 --------------------------------------
7469 -- FORMAL_PACKAGE_ACTUAL_PART ::=
7470 -- ([OTHERS] => <>)
7471 -- | [GENERIC_ACTUAL_PART]
7472 -- (FORMAL_PACKAGE_ASSOCIATION {. FORMAL_PACKAGE_ASSOCIATION}
7474 -- FORMAL_PACKAGE_ASSOCIATION ::=
7475 -- GENERIC_ASSOCIATION
7476 -- | GENERIC_FORMAL_PARAMETER_SELECTOR_NAME => <>
7478 -- There is no explicit node in the tree for a formal package actual
7479 -- part. Instead the information appears in the parent node (i.e. the
7480 -- formal package declaration node itself).
7482 -- There is no explicit node for a formal package association. All of
7483 -- them are represented either by a generic association, possibly with
7484 -- Box_Present, or by an N_Others_Choice.
7486 ---------------------------------
7487 -- 13.1 Representation clause --
7488 ---------------------------------
7490 -- REPRESENTATION_CLAUSE ::=
7491 -- ATTRIBUTE_DEFINITION_CLAUSE
7492 -- | ENUMERATION_REPRESENTATION_CLAUSE
7493 -- | RECORD_REPRESENTATION_CLAUSE
7494 -- | AT_CLAUSE
7496 ----------------------
7497 -- 13.1 Local Name --
7498 ----------------------
7500 -- LOCAL_NAME :=
7501 -- DIRECT_NAME
7502 -- | DIRECT_NAME'ATTRIBUTE_DESIGNATOR
7503 -- | library_unit_NAME
7505 -- The construct DIRECT_NAME'ATTRIBUTE_DESIGNATOR appears in the tree
7506 -- as an attribute reference, which has essentially the same form.
7508 ---------------------------------------
7509 -- 13.3 Attribute definition clause --
7510 ---------------------------------------
7512 -- ATTRIBUTE_DEFINITION_CLAUSE ::=
7513 -- for LOCAL_NAME'ATTRIBUTE_DESIGNATOR use EXPRESSION;
7514 -- | for LOCAL_NAME'ATTRIBUTE_DESIGNATOR use NAME;
7516 -- In Ada 83, the expression must be a simple expression and the
7517 -- local name must be a direct name.
7519 -- Note: the only attribute definition clause that is processed by
7520 -- gigi is an address clause. For all other cases, the information
7521 -- is extracted by the front end and either results in setting entity
7522 -- information, e.g. Esize for the Size clause, or in appropriate
7523 -- expansion actions (e.g. in the case of Storage_Size).
7525 -- For an address clause, Gigi constructs the appropriate addressing
7526 -- code. It also ensures that no aliasing optimizations are made
7527 -- for the object for which the address clause appears.
7529 -- Note: for an address clause used to achieve an overlay:
7531 -- A : Integer;
7532 -- B : Integer;
7533 -- for B'Address use A'Address;
7535 -- the above rule means that Gigi will ensure that no optimizations
7536 -- will be made for B that would violate the implementation advice
7537 -- of RM 13.3(19). However, this advice applies only to B and not
7538 -- to A, which seems unfortunate. The GNAT front end will mark the
7539 -- object A as volatile to also prevent unwanted optimization
7540 -- assumptions based on no aliasing being made for B.
7542 -- N_Attribute_Definition_Clause
7543 -- Sloc points to FOR
7544 -- Name the local name
7545 -- Chars the identifier name from the attribute designator
7546 -- Expression the expression or name
7547 -- Entity
7548 -- Next_Rep_Item
7549 -- From_At_Mod
7550 -- Check_Address_Alignment
7551 -- From_Aspect_Specification
7552 -- Is_Delayed_Aspect
7553 -- Address_Warning_Posted
7555 -- Note: if From_Aspect_Specification is set, then Sloc points to the
7556 -- aspect name, and Entity is resolved already to reference the entity
7557 -- to which the aspect applies.
7559 -----------------------------------
7560 -- 13.3.1 Aspect Specifications --
7561 -----------------------------------
7563 -- We modify the RM grammar here, the RM grammar is:
7565 -- ASPECT_SPECIFICATION ::=
7566 -- with ASPECT_MARK [=> ASPECT_DEFINITION] {,
7567 -- ASPECT_MARK [=> ASPECT_DEFINITION] }
7569 -- ASPECT_MARK ::= aspect_IDENTIFIER['Class]
7571 -- ASPECT_DEFINITION ::= NAME | EXPRESSION
7573 -- That's inconvenient, since there is no non-terminal name for a single
7574 -- entry in the list of aspects. So we use this grammar instead:
7576 -- ASPECT_SPECIFICATIONS ::=
7577 -- with ASPECT_SPECIFICATION {, ASPECT_SPECIFICATION}
7579 -- ASPECT_SPECIFICATION =>
7580 -- ASPECT_MARK [=> ASPECT_DEFINITION]
7582 -- ASPECT_MARK ::= aspect_IDENTIFIER['Class]
7584 -- ASPECT_DEFINITION ::= NAME | EXPRESSION
7586 -- Note that for Annotate, the ASPECT_DEFINITION is a pure positional
7587 -- aggregate with the elements of the aggregate corresponding to the
7588 -- successive arguments of the corresponding pragma.
7590 -- See separate package Aspects for details on the incorporation of
7591 -- these nodes into the tree, and how aspect specifications for a given
7592 -- declaration node are associated with that node.
7594 -- N_Aspect_Specification
7595 -- Sloc points to aspect identifier
7596 -- Identifier aspect identifier
7597 -- Aspect_Rep_Item
7598 -- Expression (set to Empty if none)
7599 -- Entity entity to which the aspect applies
7600 -- Next_Rep_Item
7601 -- Class_Present Set if 'Class present
7602 -- Is_Ignored
7603 -- Is_Checked
7604 -- Is_Delayed_Aspect
7605 -- Is_Disabled
7606 -- Is_Boolean_Aspect
7607 -- Split_PPC Set if split pre/post attribute
7608 -- Aspect_On_Partial_View
7610 -- Note: Aspect_Specification is an Ada 2012 feature
7612 -- Note: The Identifier serves to identify the aspect involved (it
7613 -- is the aspect whose name corresponds to the Chars field). This
7614 -- means that the other fields of this identifier are unused, and
7615 -- in particular we use the Entity field of this identifier to save
7616 -- a copy of the expression for visibility analysis, see spec of
7617 -- Sem_Ch13 for full details of this usage.
7619 -- In the case of aspects of the form xxx'Class, the aspect identifier
7620 -- is for xxx, and Class_Present is set to True.
7622 -- Note: When a Pre or Post aspect specification is processed, it is
7623 -- broken into AND THEN sections. The left most section has Split_PPC
7624 -- set to False, indicating that it is the original specification (e.g.
7625 -- for posting errors). For the other sections, Split_PPC is set True.
7627 ---------------------------------------------
7628 -- 13.4 Enumeration representation clause --
7629 ---------------------------------------------
7631 -- ENUMERATION_REPRESENTATION_CLAUSE ::=
7632 -- for first_subtype_LOCAL_NAME use ENUMERATION_AGGREGATE;
7634 -- In Ada 83, the name must be a direct name
7636 -- N_Enumeration_Representation_Clause
7637 -- Sloc points to FOR
7638 -- Identifier direct name
7639 -- Array_Aggregate
7640 -- Next_Rep_Item
7642 ---------------------------------
7643 -- 13.4 Enumeration aggregate --
7644 ---------------------------------
7646 -- ENUMERATION_AGGREGATE ::= ARRAY_AGGREGATE
7648 ------------------------------------------
7649 -- 13.5.1 Record representation clause --
7650 ------------------------------------------
7652 -- RECORD_REPRESENTATION_CLAUSE ::=
7653 -- for first_subtype_LOCAL_NAME use
7654 -- record [MOD_CLAUSE]
7655 -- {COMPONENT_CLAUSE}
7656 -- end record;
7658 -- Gigi restriction: Mod_Clause is always Empty (if present it is
7659 -- replaced by a corresponding Alignment attribute definition clause).
7661 -- Note: Component_Clauses can include pragmas
7663 -- N_Record_Representation_Clause
7664 -- Sloc points to FOR
7665 -- Identifier direct name
7666 -- Mod_Clause (set to Empty if no mod clause present)
7667 -- Component_Clauses
7668 -- Next_Rep_Item
7670 ------------------------------
7671 -- 13.5.1 Component clause --
7672 ------------------------------
7674 -- COMPONENT_CLAUSE ::=
7675 -- component_LOCAL_NAME at POSITION
7676 -- range FIRST_BIT .. LAST_BIT;
7678 -- N_Component_Clause
7679 -- Sloc points to AT
7680 -- Component_Name points to Name or Attribute_Reference
7681 -- Position
7682 -- First_Bit
7683 -- Last_Bit
7685 ----------------------
7686 -- 13.5.1 Position --
7687 ----------------------
7689 -- POSITION ::= static_EXPRESSION
7691 -----------------------
7692 -- 13.5.1 First_Bit --
7693 -----------------------
7695 -- FIRST_BIT ::= static_SIMPLE_EXPRESSION
7697 ----------------------
7698 -- 13.5.1 Last_Bit --
7699 ----------------------
7701 -- LAST_BIT ::= static_SIMPLE_EXPRESSION
7703 --------------------------
7704 -- 13.8 Code statement --
7705 --------------------------
7707 -- CODE_STATEMENT ::= QUALIFIED_EXPRESSION;
7709 -- Note: in GNAT, the qualified expression has the form
7711 -- Asm_Insn'(Asm (...));
7713 -- See package System.Machine_Code in file s-maccod.ads for details on
7714 -- the allowed parameters to Asm. There are two ways this node can
7715 -- arise, as a code statement, in which case the expression is the
7716 -- qualified expression, or as a result of the expansion of an intrinsic
7717 -- call to the Asm or Asm_Input procedure.
7719 -- N_Code_Statement
7720 -- Sloc points to first token of the expression
7721 -- Expression
7723 -- Note: package Exp_Code contains an abstract functional interface
7724 -- for use by Gigi in accessing the data from N_Code_Statement nodes.
7726 ------------------------
7727 -- 13.12 Restriction --
7728 ------------------------
7730 -- RESTRICTION ::=
7731 -- restriction_IDENTIFIER
7732 -- | restriction_parameter_IDENTIFIER => EXPRESSION
7734 -- There is no explicit node for restrictions. Instead the restriction
7735 -- appears in normal pragma syntax as a pragma argument association,
7736 -- which has the same syntactic form.
7738 --------------------------
7739 -- B.2 Shift Operators --
7740 --------------------------
7742 -- Calls to the intrinsic shift functions are converted to one of
7743 -- the following shift nodes, which have the form of normal binary
7744 -- operator names. Note that for a given shift operation, one node
7745 -- covers all possible types, as for normal operators.
7747 -- Note: it is perfectly permissible for the expander to generate
7748 -- shift operation nodes directly, in which case they will be analyzed
7749 -- and parsed in the usual manner.
7751 -- Sprint syntax: shift-function-name!(expr, count)
7753 -- Note: the Left_Opnd field holds the first argument (the value to
7754 -- be shifted). The Right_Opnd field holds the second argument (the
7755 -- shift count). The Chars field is the name of the intrinsic function.
7757 -- N_Op_Rotate_Left
7758 -- Sloc points to the function name
7759 -- plus fields for binary operator
7760 -- plus fields for expression
7761 -- Shift_Count_OK
7763 -- N_Op_Rotate_Right
7764 -- Sloc points to the function name
7765 -- plus fields for binary operator
7766 -- plus fields for expression
7767 -- Shift_Count_OK
7769 -- N_Op_Shift_Left
7770 -- Sloc points to the function name
7771 -- plus fields for binary operator
7772 -- plus fields for expression
7773 -- Shift_Count_OK
7775 -- N_Op_Shift_Right_Arithmetic
7776 -- Sloc points to the function name
7777 -- plus fields for binary operator
7778 -- plus fields for expression
7779 -- Shift_Count_OK
7781 -- N_Op_Shift_Right
7782 -- Sloc points to the function name
7783 -- plus fields for binary operator
7784 -- plus fields for expression
7785 -- Shift_Count_OK
7787 -- Note: N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic
7788 -- never appear in the expanded tree if Modify_Tree_For_C mode is set.
7790 -- Note: For N_Op_Shift_Left and N_Op_Shift_Right, the right operand is
7791 -- always less than the word size if Modify_Tree_For_C mode is set.
7793 --------------------------
7794 -- Obsolescent Features --
7795 --------------------------
7797 -- The syntax descriptions and tree nodes for obsolescent features are
7798 -- grouped together, corresponding to their location in appendix I in
7799 -- the RM. However, parsing and semantic analysis for these constructs
7800 -- is located in an appropriate chapter (see individual notes).
7802 ---------------------------
7803 -- J.3 Delta Constraint --
7804 ---------------------------
7806 -- Note: the parse routine for this construct is located in section
7807 -- 3.5.9 of Par-Ch3, and semantic analysis is in Sem_Ch3, which is
7808 -- where delta constraint logically belongs.
7810 -- DELTA_CONSTRAINT ::= DELTA static_EXPRESSION [RANGE_CONSTRAINT]
7812 -- N_Delta_Constraint
7813 -- Sloc points to DELTA
7814 -- Delta_Expression
7815 -- Range_Constraint (set to Empty if not present)
7817 --------------------
7818 -- J.7 At Clause --
7819 --------------------
7821 -- AT_CLAUSE ::= for DIRECT_NAME use at EXPRESSION;
7823 -- Note: the parse routine for this construct is located in Par-Ch13,
7824 -- and the semantic analysis is in Sem_Ch13, where at clause logically
7825 -- belongs if it were not obsolescent.
7827 -- Note: in Ada 83 the expression must be a simple expression
7829 -- Gigi restriction: This node never appears, it is rewritten as an
7830 -- address attribute definition clause.
7832 -- N_At_Clause
7833 -- Sloc points to FOR
7834 -- Identifier
7835 -- Expression
7837 ---------------------
7838 -- J.8 Mod clause --
7839 ---------------------
7841 -- MOD_CLAUSE ::= at mod static_EXPRESSION;
7843 -- Note: the parse routine for this construct is located in Par-Ch13,
7844 -- and the semantic analysis is in Sem_Ch13, where mod clause logically
7845 -- belongs if it were not obsolescent.
7847 -- Note: in Ada 83, the expression must be a simple expression
7849 -- Gigi restriction: this node never appears. It is replaced
7850 -- by a corresponding Alignment attribute definition clause.
7852 -- Note: pragmas can appear before and after the MOD_CLAUSE since
7853 -- its name has "clause" in it. This is rather strange, but is quite
7854 -- definitely specified. The pragmas before are collected in the
7855 -- Pragmas_Before field of the mod clause node itself, and pragmas
7856 -- after are simply swallowed up in the list of component clauses.
7858 -- N_Mod_Clause
7859 -- Sloc points to AT
7860 -- Expression
7861 -- Pragmas_Before Pragmas before mod clause (No_List if none)
7863 --------------------
7864 -- Semantic Nodes --
7865 --------------------
7867 -- These semantic nodes are used to hold additional semantic information.
7868 -- They are inserted into the tree as a result of semantic processing.
7869 -- Although there are no legitimate source syntax constructions that
7870 -- correspond directly to these nodes, we need a source syntax for the
7871 -- reconstructed tree printed by Sprint, and the node descriptions here
7872 -- show this syntax.
7874 -----------------
7875 -- Call_Marker --
7876 -----------------
7878 -- This node is created during the analysis/resolution of entry calls,
7879 -- requeues, and subprogram calls. It performs several functions:
7881 -- * Call markers provide a uniform model for handling calls by the
7882 -- ABE mechanism, regardless of whether expansion took place.
7884 -- * The call marker captures the target of the related call along
7885 -- with other attributes which are either unavailable or expensive
7886 -- to recompute once analysis, resolution, and expansion are over.
7888 -- * The call marker aids the ABE Processing phase by signaling the
7889 -- presence of a call in case the original call was transformed by
7890 -- expansion.
7892 -- * The call marker acts as a reference point for the insertion of
7893 -- run-time conditional ABE checks or guaranteed ABE failures.
7895 -- Sprint syntax: #target#
7897 -- The Sprint syntax shown above is not enabled by default
7899 -- N_Call_Marker
7900 -- Sloc points to Sloc of original call
7901 -- Target
7902 -- Is_Elaboration_Checks_OK_Node
7903 -- Is_SPARK_Mode_On_Node
7904 -- Is_Elaboration_Warnings_OK_Node
7905 -- Is_Source_Call
7906 -- Is_Declaration_Level_Node
7907 -- Is_Dispatching_Call
7908 -- Is_Preelaborable_Call
7909 -- Is_Known_Guaranteed_ABE
7911 ------------------------
7912 -- Compound Statement --
7913 ------------------------
7915 -- This node is created by the analyzer/expander to handle some
7916 -- expansion cases where a sequence of actions needs to be captured
7917 -- within a single node (which acts as a container and allows the
7918 -- entire list of actions to be moved around as a whole) appearing
7919 -- in a sequence of statements.
7921 -- This is the statement counterpart to the expression node
7922 -- N_Expression_With_Actions.
7924 -- The required semantics is that the set of actions is executed in
7925 -- the order in which it appears, as though they appeared by themselves
7926 -- in the enclosing list of declarations or statements. Unlike what
7927 -- happens when using an N_Block_Statement, no new scope is introduced.
7929 -- Note: for the time being, this is used only as a transient
7930 -- representation during expansion, and all compound statement nodes
7931 -- must be exploded back to their constituent statements before handing
7932 -- the tree to the back end.
7934 -- Sprint syntax: do
7935 -- action;
7936 -- action;
7937 -- ...
7938 -- action;
7939 -- end;
7941 -- N_Compound_Statement
7942 -- Actions
7944 --------------
7945 -- Contract --
7946 --------------
7948 -- This node is used to hold the various parts of an entry, subprogram
7949 -- [body] or package [body] contract, in particular:
7950 -- Abstract states declared by a package declaration
7951 -- Contract cases that apply to a subprogram
7952 -- Dependency relations of inputs and output of a subprogram
7953 -- Global annotations classifying data as input or output
7954 -- Initialization sequences for a package declaration
7955 -- Pre- and postconditions that apply to a subprogram
7957 -- The node appears in an entry and [generic] subprogram [body] entity.
7959 -- Sprint syntax: <none> as the node should not appear in the tree, but
7960 -- only attached to an entry or [generic] subprogram
7961 -- entity.
7963 -- N_Contract
7964 -- Sloc points to the subprogram's name
7965 -- Pre_Post_Conditions (set to Empty if none)
7966 -- Contract_Test_Cases (set to Empty if none)
7967 -- Classifications (set to Empty if none)
7968 -- Is_Expanded_Contract
7970 -- Pre_Post_Conditions contains a collection of pragmas that correspond
7971 -- to pre- and postconditions associated with an entry or a subprogram
7972 -- [body or stub]. The pragmas can either come from source or be the
7973 -- byproduct of aspect expansion. Currently the following pragmas appear
7974 -- in this list:
7975 -- Post
7976 -- Postcondition
7977 -- Pre
7978 -- Precondition
7979 -- Refined_Post
7980 -- The ordering in the list is in LIFO fashion.
7982 -- Note that there might be multiple preconditions or postconditions
7983 -- in this list, either because they come from separate pragmas in the
7984 -- source, or because a Pre (resp. Post) aspect specification has been
7985 -- broken into AND THEN sections. See Split_PPC for details.
7987 -- In GNATprove mode, the inherited classwide pre- and postconditions
7988 -- (suitably specialized for the specific type of the overriding
7989 -- operation) are also in this list.
7991 -- Contract_Test_Cases contains a collection of pragmas that correspond
7992 -- to aspects/pragmas Contract_Cases, Exceptional_Cases, Test_Case and
7993 -- Subprogram_Variant. The ordering in the list is in LIFO fashion.
7995 -- Classifications contains pragmas that either declare, categorize, or
7996 -- establish dependencies between subprogram or package inputs and
7997 -- outputs. Currently the following pragmas appear in this list:
7998 -- Abstract_States
7999 -- Always_Terminates
8000 -- Async_Readers
8001 -- Async_Writers
8002 -- Constant_After_Elaboration
8003 -- Depends
8004 -- Effective_Reads
8005 -- Effective_Writes
8006 -- Extensions_Visible
8007 -- Global
8008 -- Initial_Condition
8009 -- Initializes
8010 -- Part_Of
8011 -- Refined_Depends
8012 -- Refined_Global
8013 -- Refined_States
8014 -- Volatile_Function
8015 -- The ordering is in LIFO fashion.
8017 -------------------
8018 -- Expanded Name --
8019 -------------------
8021 -- The N_Expanded_Name node is used to represent a selected component
8022 -- name that has been resolved to an expanded name. The semantic phase
8023 -- replaces N_Selected_Component nodes that represent names by the use
8024 -- of this node, leaving the N_Selected_Component node used only when
8025 -- the prefix is a record or protected type.
8027 -- The fields of the N_Expanded_Name node are laid out identically
8028 -- to those of the N_Selected_Component node, allowing conversion of
8029 -- an expanded name node to a selected component node to be done
8030 -- easily, see Sinfo.CN.Change_Selected_Component_To_Expanded_Name.
8032 -- There is no special sprint syntax for an expanded name
8034 -- N_Expanded_Name
8035 -- Sloc points to the period
8036 -- Chars copy of Chars field of selector name
8037 -- Prefix
8038 -- Selector_Name
8039 -- Entity
8040 -- Associated_Node
8041 -- Is_Elaboration_Checks_OK_Node
8042 -- Is_SPARK_Mode_On_Node
8043 -- Is_Elaboration_Warnings_OK_Node
8044 -- Has_Private_View (set in generic units)
8045 -- Has_Secondary_Private_View (set in generic units)
8046 -- Redundant_Use
8047 -- Atomic_Sync_Required
8048 -- plus fields for expression
8050 -----------------------------
8051 -- Expression With Actions --
8052 -----------------------------
8054 -- This node is created by the analyzer/expander to handle some
8055 -- expansion cases, notably short-circuit forms where there are
8056 -- actions associated with the right-hand side operand.
8058 -- The N_Expression_With_Actions node represents an expression with
8059 -- an associated set of actions (which are executable statements and
8060 -- declarations, as might occur in a handled statement sequence).
8062 -- The required semantics is that the set of actions is executed in
8063 -- the order in which it appears just before the expression is
8064 -- evaluated (and these actions must only be executed if the value
8065 -- of the expression is evaluated). The node is considered to be
8066 -- a subexpression, whose value is the value of the Expression after
8067 -- executing all the actions.
8069 -- If the actions contain declarations, then these declarations may
8070 -- be referenced within the expression.
8072 -- (AI12-0236-1): In Ada 2022, for a declare_expression, the parser
8073 -- generates an N_Expression_With_Actions. Declare_expressions have
8074 -- various restrictions, which we do not enforce on
8075 -- N_Expression_With_Actions nodes that are generated by the
8076 -- expander. The two cases can be distinguished by looking at
8077 -- Comes_From_Source.
8079 -- ???Perhaps we should change the name of this node to
8080 -- N_Declare_Expression, and perhaps we should change the Sprint syntax
8081 -- to match the RM syntax for declare_expression.
8083 -- Sprint syntax: do
8084 -- action;
8085 -- action;
8086 -- ...
8087 -- action;
8088 -- in expression end
8090 -- N_Expression_With_Actions
8091 -- Actions
8092 -- Expression
8093 -- plus fields for expression
8095 -- Note: In the final generated tree presented to the code generator,
8096 -- the actions list is always non-null, since there is no point in this
8097 -- node if the actions are Empty. During semantic analysis there are
8098 -- cases where it is convenient to temporarily generate an empty actions
8099 -- list. This arises in cases where we create such an empty actions
8100 -- list, and it may or may not end up being a place where additional
8101 -- actions are inserted. The expander removes such empty cases after
8102 -- the expression of the node is fully analyzed and expanded, at which
8103 -- point it is safe to remove it, since no more actions can be inserted.
8105 -- Note: In Modify_Tree_For_C, we never generate any declarations in
8106 -- the action list, which can contain only non-declarative statements.
8108 --------------------
8109 -- Free Statement --
8110 --------------------
8112 -- The N_Free_Statement node is generated as a result of a call to an
8113 -- instantiation of Unchecked_Deallocation. The instantiation of this
8114 -- generic is handled specially and generates this node directly.
8116 -- Sprint syntax: free expression
8118 -- N_Free_Statement
8119 -- Sloc is copied from the unchecked deallocation call
8120 -- Expression argument to unchecked deallocation call
8121 -- Storage_Pool
8122 -- Procedure_To_Call
8123 -- Actual_Designated_Subtype
8125 -- Note: in the case where a debug source file is generated, the Sloc
8126 -- for this node points to the FREE keyword in the Sprint file output.
8128 -------------------
8129 -- Freeze Entity --
8130 -------------------
8132 -- This node marks the point in a declarative part at which an entity
8133 -- declared therein becomes frozen. The expander places initialization
8134 -- procedures for types at those points. Gigi uses the freezing point
8135 -- to elaborate entities that may depend on previous private types.
8137 -- See the section in Einfo "Delayed Freezing and Elaboration" for
8138 -- a full description of the use of this node.
8140 -- The Entity field points back to the entity for the type (whose
8141 -- Freeze_Node field points back to this freeze node).
8143 -- The Actions field contains a list of declarations and statements
8144 -- generated by the expander which are associated with the freeze
8145 -- node, and are elaborated as though the freeze node were replaced
8146 -- by this sequence of actions.
8148 -- Note: the Sloc field in the freeze node references a construct
8149 -- associated with the freezing point. This is used for posting
8150 -- messages in some error/warning situations, e.g. the case where
8151 -- a primitive operation of a tagged type is declared too late.
8153 -- Sprint syntax: freeze entity-name [
8154 -- freeze actions
8155 -- ]
8157 -- N_Freeze_Entity
8158 -- Sloc points near freeze point (see above special note)
8159 -- Entity
8160 -- Access_Types_To_Process (set to No_Elist if none)
8161 -- TSS_Elist (set to No_Elist if no associated TSS's)
8162 -- Actions (set to No_List if no freeze actions)
8163 -- First_Subtype_Link (set to Empty if no link)
8165 -- The Actions field holds actions associated with the freeze. These
8166 -- actions are elaborated at the point where the type is frozen.
8168 -- Note: in the case where a debug source file is generated, the Sloc
8169 -- for this node points to the FREEZE keyword in the Sprint file output.
8171 ---------------------------
8172 -- Freeze Generic Entity --
8173 ---------------------------
8175 -- The freeze point of an entity indicates the point at which the
8176 -- information needed to generate code for the entity is complete.
8177 -- The freeze node for an entity triggers expander activities, such as
8178 -- build initialization procedures, and backend activities, such as
8179 -- completing the elaboration of packages.
8181 -- For entities declared within a generic unit, for which no code is
8182 -- generated, the freeze point is not equally meaningful. However, in
8183 -- Ada 2012 several semantic checks on declarations must be delayed to
8184 -- the freeze point, and we need to include such a mark in the tree to
8185 -- trigger these checks. The Freeze_Generic_Entity node plays no other
8186 -- role, and is ignored by the expander and the back-end.
8188 -- Sprint syntax: freeze_generic entity-name
8190 -- N_Freeze_Generic_Entity
8191 -- Sloc points near freeze point
8192 -- Entity
8194 --------------------------------
8195 -- Implicit Label Declaration --
8196 --------------------------------
8198 -- An implicit label declaration is created for every occurrence of a
8199 -- label on a statement or a label on a block or loop. It is chained
8200 -- in the declarations of the innermost enclosing block as specified
8201 -- in RM section 5.1 (3).
8203 -- The Defining_Identifier is the actual identifier for the statement
8204 -- identifier. Note that the occurrence of the label is a reference, NOT
8205 -- the defining occurrence. The defining occurrence occurs at the head
8206 -- of the innermost enclosing block, and is represented by this node.
8208 -- Note: from the grammar, this might better be called an implicit
8209 -- statement identifier declaration, but the term we choose seems
8210 -- friendlier, since at least informally statement identifiers are
8211 -- called labels in both cases (i.e. when used in labels, and when
8212 -- used as the identifiers of blocks and loops).
8214 -- Note: although this is logically a semantic node, since it does not
8215 -- correspond directly to a source syntax construction, these nodes are
8216 -- actually created by the parser in a post pass done just after parsing
8217 -- is complete, before semantic analysis is started (see Par.Labl).
8219 -- Sprint syntax: labelname : label;
8221 -- N_Implicit_Label_Declaration
8222 -- Sloc points to the << token for a statement identifier, or to the
8223 -- LOOP, DECLARE, or BEGIN token for a loop or block identifier
8224 -- Defining_Identifier
8225 -- Label_Construct
8227 -- Note: in the case where a debug source file is generated, the Sloc
8228 -- for this node points to the label name in the generated declaration.
8230 ---------------------
8231 -- Itype Reference --
8232 ---------------------
8234 -- This node is used to create a reference to an Itype. The only purpose
8235 -- is to make sure the Itype is defined if this is the first reference.
8237 -- A typical use of this node is when an Itype is to be referenced in
8238 -- two branches of an IF statement. In this case it is important that
8239 -- the first use of the Itype not be inside the conditional, since then
8240 -- it might not be defined if the other branch of the IF is taken, in
8241 -- the case where the definition generates elaboration code.
8243 -- The Itype field points to the referenced Itype
8245 -- Sprint syntax: reference itype-name
8247 -- N_Itype_Reference
8248 -- Sloc points to the node generating the reference
8249 -- Itype
8251 -- Note: in the case where a debug source file is generated, the Sloc
8252 -- for this node points to the REFERENCE keyword in the file output.
8254 ---------------------
8255 -- Raise xxx Error --
8256 ---------------------
8258 -- One of these nodes is created during semantic analysis to replace
8259 -- a node for an expression that is determined to definitely raise
8260 -- the corresponding exception.
8262 -- The N_Raise_xxx_Error node may also stand alone in place
8263 -- of a declaration or statement, in which case it simply causes
8264 -- the exception to be raised (i.e. it is equivalent to a raise
8265 -- statement that raises the corresponding exception). This use
8266 -- is distinguished by the fact that the Etype in this case is
8267 -- Standard_Void_Type; in the subexpression case, the Etype is the
8268 -- same as the type of the subexpression which it replaces.
8270 -- If Condition is empty, then the raise is unconditional. If the
8271 -- Condition field is non-empty, it is a boolean expression which is
8272 -- first evaluated, and the exception is raised only if the value of the
8273 -- expression is True. In the unconditional case, the creation of this
8274 -- node is usually accompanied by a warning message (unless it appears
8275 -- within the right operand of a short-circuit form whose left argument
8276 -- is static and decisively eliminates elaboration of the raise
8277 -- operation). The condition field can ONLY be present when the node is
8278 -- used as a statement form; it must NOT be present in the case where
8279 -- the node appears within an expression.
8281 -- The exception is generated with a message that contains the
8282 -- file name and line number, and then appended text. The Reason
8283 -- code shows the text to be added. The Reason code is an element
8284 -- of the type Types.RT_Exception_Code, and indicates both the
8285 -- message to be added, and the exception to be raised (which must
8286 -- match the node type). The value is stored by storing a Uint which
8287 -- is the Pos value of the enumeration element in this type.
8289 -- Gigi restriction: This expander ensures that the type of the
8290 -- Condition field is always Standard.Boolean, even if the type
8291 -- in the source is some non-standard boolean type.
8293 -- Sprint syntax: [xxx_error "msg"]
8294 -- or: [xxx_error when condition "msg"]
8296 -- N_Raise_Constraint_Error
8297 -- Sloc references related construct
8298 -- Condition (set to Empty if no condition)
8299 -- Reason
8300 -- plus fields for expression
8302 -- N_Raise_Program_Error
8303 -- Sloc references related construct
8304 -- Condition (set to Empty if no condition)
8305 -- Reason
8306 -- plus fields for expression
8308 -- N_Raise_Storage_Error
8309 -- Sloc references related construct
8310 -- Condition (set to Empty if no condition)
8311 -- Reason
8312 -- plus fields for expression
8314 -- Note: Sloc is copied from the expression generating the exception.
8315 -- In the case where a debug source file is generated, the Sloc for
8316 -- this node points to the left bracket in the Sprint file output.
8318 -- Note: the back end may be required to translate these nodes into
8319 -- appropriate goto statements. See description of N_Push/Pop_xxx_Label.
8321 ---------------------------------------------
8322 -- Optimization of Exception Raise to Goto --
8323 ---------------------------------------------
8325 -- In some cases, the front end will determine that any exception raised
8326 -- by the back end for a certain exception should be transformed into a
8327 -- goto statement.
8329 -- There are three kinds of exceptions raised by the back end (note that
8330 -- for this purpose we consider gigi to be part of the back end in the
8331 -- gcc case):
8333 -- 1. Exceptions resulting from N_Raise_xxx_Error nodes
8334 -- 2. Exceptions from checks triggered by Do_xxx_Check flags
8335 -- 3. Other cases not specifically marked by the front end
8337 -- Normally all such exceptions are translated into calls to the proper
8338 -- Rcheck_xx procedure, where xx encodes both the exception to be raised
8339 -- and the exception message.
8341 -- The front end may determine that for a particular sequence of code,
8342 -- exceptions in any of these three categories for a particular builtin
8343 -- exception should result in a goto, rather than a call to Rcheck_xx.
8344 -- The exact sequence to be generated is:
8346 -- Local_Raise (exception'Identity);
8347 -- goto Label
8349 -- The front end marks such a sequence of code by bracketing it with
8350 -- push and pop nodes:
8352 -- N_Push_xxx_Label (referencing the label)
8353 -- ...
8354 -- (code where transformation is expected for exception xxx)
8355 -- ...
8356 -- N_Pop_xxx_Label
8358 -- The use of push/pop reflects the fact that such regions can properly
8359 -- nest, and one special case is a subregion in which no transformation
8360 -- is allowed. Such a region is marked by a N_Push_xxx_Label node whose
8361 -- Exception_Label field is Empty.
8363 -- N_Push_Constraint_Error_Label
8364 -- Sloc references first statement in region covered
8365 -- Exception_Label
8367 -- N_Push_Program_Error_Label
8368 -- Sloc references first statement in region covered
8369 -- Exception_Label
8371 -- N_Push_Storage_Error_Label
8372 -- Sloc references first statement in region covered
8373 -- Exception_Label
8375 -- N_Pop_Constraint_Error_Label
8376 -- Sloc references last statement in region covered
8378 -- N_Pop_Program_Error_Label
8379 -- Sloc references last statement in region covered
8381 -- N_Pop_Storage_Error_Label
8382 -- Sloc references last statement in region covered
8384 ---------------
8385 -- Reference --
8386 ---------------
8388 -- For a number of purposes, we need to construct references to objects.
8389 -- These references are subsequently treated as normal access values.
8390 -- An example is the construction of the parameter block passed to a
8391 -- task entry. The N_Reference node is provided for this purpose. It is
8392 -- similar in effect to the use of the Unrestricted_Access attribute,
8393 -- and like Unrestricted_Access can be applied to objects which would
8394 -- not be valid prefixes for the Unchecked_Access attribute (e.g.
8395 -- objects which are not aliased, and slices). In addition it can be
8396 -- applied to composite type values as well as objects, including string
8397 -- values and aggregates.
8399 -- Note: we use the Prefix field for this expression so that the
8400 -- resulting node can be treated using common code with the attribute
8401 -- nodes for the 'Access and related attributes. Logically it would make
8402 -- more sense to call it an Expression field, but then we would have to
8403 -- special case the treatment of the N_Reference node.
8405 -- Note: evaluating a N_Reference node is guaranteed to yield a non-null
8406 -- value at run time. Therefore, it is valid to set Is_Known_Non_Null on
8407 -- a temporary initialized to a N_Reference node in order to eliminate
8408 -- superfluous access checks.
8410 -- Sprint syntax: prefix'reference
8412 -- N_Reference
8413 -- Sloc is copied from the expression
8414 -- Prefix
8415 -- plus fields for expression
8417 -- Note: in the case where a debug source file is generated, the Sloc
8418 -- for this node points to the quote in the Sprint file output.
8420 ----------------
8421 -- SCIL Nodes --
8422 ----------------
8424 -- SCIL nodes are special nodes added to the tree when the CodePeer mode
8425 -- is active. They are only generated if SCIL generation is enabled.
8426 -- A standard tree-walk will not encounter these nodes even if they
8427 -- are present; these nodes are only accessible via the function
8428 -- SCIL_LL.Get_SCIL_Node. These nodes have no associated dynamic
8429 -- semantics.
8431 -- Sprint syntax: [ <node kind> ]
8432 -- No semantic field values are displayed.
8434 -- N_SCIL_Dispatch_Table_Tag_Init
8435 -- Sloc references a node for a tag initialization
8436 -- SCIL_Entity
8438 -- An N_SCIL_Dispatch_Table_Tag_Init node may be associated (via
8439 -- Get_SCIL_Node) with the N_Object_Declaration node corresponding to
8440 -- the declaration of the dispatch table for a tagged type.
8442 -- N_SCIL_Dispatching_Call
8443 -- Sloc references the node of a dispatching call
8444 -- SCIL_Target_Prim
8445 -- SCIL_Entity
8446 -- SCIL_Controlling_Tag
8448 -- An N_Scil_Dispatching call node may be associated (via Get_SCIL_Node)
8449 -- with the N_Procedure_Call_Statement or N_Function_Call node (or a
8450 -- rewriting thereof) corresponding to a dispatching call.
8452 -- N_SCIL_Membership_Test
8453 -- Sloc references the node of a membership test
8454 -- SCIL_Tag_Value
8455 -- SCIL_Entity
8457 -- An N_Scil_Membership_Test node may be associated (via Get_SCIL_Node)
8458 -- with the N_In node (or a rewriting thereof) corresponding to a
8459 -- classwide membership test.
8461 --------------------------
8462 -- Unchecked Expression --
8463 --------------------------
8465 -- An unchecked expression is one that must be analyzed and resolved
8466 -- with all checks off, regardless of the current setting of scope
8467 -- suppress flags.
8469 -- Sprint syntax: `(expression)
8471 -- Note: this node is always removed from the tree (and replaced by
8472 -- its constituent expression) on completion of analysis, so it only
8473 -- appears in intermediate trees, and will never be seen by Gigi.
8475 -- N_Unchecked_Expression
8476 -- Sloc is a copy of the Sloc of the expression
8477 -- Expression
8478 -- plus fields for expression
8480 -- Note: in the case where a debug source file is generated, the Sloc
8481 -- for this node points to the back quote in the Sprint file output.
8483 -------------------------------
8484 -- Unchecked Type Conversion --
8485 -------------------------------
8487 -- An unchecked type conversion node represents the semantic action
8488 -- corresponding to a call to an instantiation of Unchecked_Conversion.
8489 -- It is generated as a result of actual use of Unchecked_Conversion
8490 -- and also by the expander.
8492 -- Unchecked type conversion nodes should be created by calling
8493 -- Tbuild.Unchecked_Convert_To, rather than by directly calling
8494 -- Nmake.Make_Unchecked_Type_Conversion.
8496 -- Note: an unchecked type conversion is a variable as far as the
8497 -- semantics are concerned, which is convenient for the expander.
8498 -- This does not change what Ada source programs are legal, since
8499 -- clearly a function call to an instantiation of Unchecked_Conversion
8500 -- is not a variable in any case.
8502 -- Sprint syntax: subtype-mark!(expression)
8504 -- N_Unchecked_Type_Conversion
8505 -- Sloc points to related node in source
8506 -- Subtype_Mark
8507 -- Expression
8508 -- Kill_Range_Check
8509 -- No_Truncation
8510 -- plus fields for expression
8512 -- Note: in the case where a debug source file is generated, the Sloc
8513 -- for this node points to the exclamation in the Sprint file output.
8515 -----------------------------------
8516 -- Validate_Unchecked_Conversion --
8517 -----------------------------------
8519 -- The front end does most of the validation of unchecked conversion,
8520 -- including checking sizes (this is done after the back end is called
8521 -- to take advantage of back-annotation of calculated sizes).
8523 -- The front end also deals with specific cases that are not allowed
8524 -- e.g. involving unconstrained array types.
8526 -- For the case of the standard gigi backend, this means that all
8527 -- checks are done in the front end.
8529 -- However, in the case of specialized back-ends, in particular the JVM
8530 -- backend in the past, additional requirements and restrictions may
8531 -- apply to unchecked conversion, and these are most conveniently
8532 -- performed in the specialized back-end.
8534 -- To accommodate this requirement, for such back ends, the following
8535 -- special node is generated recording an unchecked conversion that
8536 -- needs to be validated. The back end should post an appropriate
8537 -- error message if the unchecked conversion is invalid or warrants
8538 -- a special warning message.
8540 -- Source_Type and Target_Type point to the entities for the two
8541 -- types involved in the unchecked conversion instantiation that
8542 -- is to be validated.
8544 -- Sprint syntax: validate Unchecked_Conversion (source, target);
8546 -- N_Validate_Unchecked_Conversion
8547 -- Sloc points to instantiation (location for warning message)
8548 -- Source_Type
8549 -- Target_Type
8551 -- Note: in the case where a debug source file is generated, the Sloc
8552 -- for this node points to the VALIDATE keyword in the file output.
8554 -------------------------------
8555 -- Variable_Reference_Marker --
8556 -------------------------------
8558 -- This node is created during the analysis of direct or expanded names,
8559 -- and the resolution of entry and subprogram calls. It performs several
8560 -- functions:
8562 -- * Variable reference markers provide a uniform model for handling
8563 -- variable references by the ABE mechanism, regardless of whether
8564 -- expansion took place.
8566 -- * The variable reference marker captures the entity of the variable
8567 -- being read or written.
8569 -- * The variable reference markers aid the ABE Processing phase by
8570 -- signaling the presence of a call in case the original variable
8571 -- reference was transformed by expansion.
8573 -- Sprint syntax: r#target# -- for a read
8574 -- rw#target# -- for a read/write
8575 -- w#target# -- for a write
8577 -- The Sprint syntax shown above is not enabled by default
8579 -- N_Variable_Reference_Marker
8580 -- Sloc points to Sloc of original variable reference
8581 -- Target
8582 -- Is_Elaboration_Checks_OK_Node
8583 -- Is_SPARK_Mode_On_Node
8584 -- Is_Elaboration_Warnings_OK_Node
8585 -- Is_Read
8586 -- Is_Write
8588 -----------
8589 -- Empty --
8590 -----------
8592 -- Used as the contents of the Nkind field of the dummy Empty node and in
8593 -- some other situations to indicate an uninitialized value.
8595 -- N_Empty
8596 -- Chars is set to No_Name
8598 -----------
8599 -- Error --
8600 -----------
8602 -- Used as the contents of the Nkind field of the dummy Error node.
8603 -- Has an Etype field, which gets set to Any_Type later on, to help
8604 -- error recovery (Error_Posted is also set in the Error node).
8606 -- N_Error
8607 -- Chars is set to Error_Name
8608 -- Etype
8610 end Sinfo;