Debian Codegraph @

gcc/ada/sinfo.ads

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