-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- package provides a basic tree structure. Sinfo describes how this structure
-- is used to represent the syntax of an Ada program.
--- The grammar in the RM is followed very closely in the tree
--- design, and is repeated as part of this source file.
+-- The grammar in the RM is followed very closely in the tree design, and is
+-- repeated as part of this source file.
-- The tree contains not only the full syntactic representation of the
-- program, but also the results of semantic analysis. In particular, the
-- A flag present in the N_Assignment_Statement node. It is used only
-- if the type being assigned is an array type, and is set if analysis
-- determines that it is definitely safe to do the copy backwards, i.e.
- -- starting at the highest addressed element. Note that if neither of the
- -- flags Forwards_OK or Backwards_OK is set, it means that the front end
- -- could not determine that either direction is definitely safe, and a
- -- runtime check may be required if the backend cannot figure it out.
+ -- starting at the highest addressed element. This is the case if either
+ -- the operands do not overlap, or they may overlap, but if they do,
+ -- then the left operand is at a higher address than the right operand.
+ --
+ -- Note: If neither of the flags Forwards_OK or Backwards_OK is set, it
+ -- means that the front end could not determine that either direction is
+ -- definitely safe, and a runtime check may be required if the backend
+ -- cannot figure it out. If both flags Forwards_OK and Backwards_OK are
+ -- set, it means that the front end can assure no overlap of operands.
-- Body_To_Inline (Node3-Sem)
-- present in subprogram declarations. Denotes analyzed but unexpanded
-- See also the description of Do_Range_Check for this case. The only
-- attribute references which use this flag are Pred and Succ, where it
-- means that the result should be checked for going outside the base
- -- range.
+ -- range. Note that this flag is not set for modular types.
-- Do_Range_Check (Flag9-Sem)
-- This flag is set on an expression which appears in a context where a
-- Expansion_Delayed (Flag11-Sem)
-- Set on aggregates and extension aggregates that need a top-down rather
- -- than bottom up expansion. Typically aggregate expansion happens bottom
+ -- than bottom-up expansion. Typically aggregate expansion happens bottom
-- up. For nested aggregates the expansion is delayed until the enclosing
-- aggregate itself is expanded, e.g. in the context of a declaration. To
-- delay it we set this flag. This is done to avoid creating a temporary
-- A flag present in the N_Assignment_Statement node. It is used only
-- if the type being assigned is an array type, and is set if analysis
-- determines that it is definitely safe to do the copy forwards, i.e.
- -- starting at the lowest addressed element. Note that if neither of the
- -- flags Forwards_OK or Backwards_OK is set, it means that the front end
- -- could not determine that either direction is definitely safe, and a
- -- runtime check is required.
+ -- starting at the lowest addressed element. This is the case if either
+ -- the operands do not overlap, or they may overlap, but if they do,
+ -- then the left operand is at a lower address than the right operand.
+ --
+ -- Note: If neither of the flags Forwards_OK or Backwards_OK is set, it
+ -- means that the front end could not determine that either direction is
+ -- definitely safe, and a runtime check may be required if the backend
+ -- cannot figure it out. If both flags Forwards_OK and Backwards_OK are
+ -- set, it means that the front end can assure no overlap of operands.
-- From_At_End (Flag4-Sem)
-- This flag is set on an N_Raise_Statement node if it corresponds to
-- This flag is set in the N_With_Clause node that is implicitly
-- generated for runtime units that are loaded by the expander, and also
-- for package System, if it is loaded implicitly by a use of the
- -- 'Address or 'Tag attribute.
+ -- 'Address or 'Tag attribute. ???There are other implicit with clauses
+ -- as well.
-- Includes_Infinities (Flag11-Sem)
-- This flag is present in N_Range nodes. It is set for the range of
--
-- In a compilation unit node, the usage depends on the unit type:
--
- -- For a subprogram body, Library_Unit points to the compilation unit
- -- node of the corresponding spec, unless Acts_As_Spec is set, in which
- -- case it points to itself.
- --
- -- For a package body, Library_Unit points to the compilation unit of
- -- the corresponding package spec.
- --
- -- For a subprogram spec to which pragma Inline applies, Library_Unit
- -- points to the compilation unit node of the corresponding body, if
- -- inlining is active.
+ -- For a library unit body, Library_Unit points to the compilation unit
+ -- node of the corresponding spec, unless it's a subprogram body with
+ -- Acts_As_Spec set, in which case it points to itself.
--
- -- For a generic declaration, Library_Unit points to the compilation
- -- unit node of the corresponding generic body.
+ -- For a spec, Library_Unit points to the compilation unit node of the
+ -- corresponding body, if present. The body will be present if the spec
+ -- is or contains generics that we needed to instantiate. Similarly, the
+ -- body will be present if we needed it for inlining purposes. Thus, if
+ -- we have a spec/body pair, both of which are present, they point to
+ -- each other via Library_Unit.
--
-- For a subunit, Library_Unit points to the compilation unit node of
-- the parent body.
-- Note: the back end places some restrictions on the form of the
-- Expression field. If the object being declared is Atomic, then
-- the Expression may not have the form of an aggregate (since this
- -- might cause the back end to generate separate assignments). It
- -- also cannot be a reference to an object marked as a true constant
- -- (Is_True_Constant flag set), where the object is itself initialized
- -- with an aggregate. If necessary the front end must generate an
- -- extra temporary (with Is_True_Constant set False), and initialize
+ -- might cause the back end to generate separate assignments). In this
+ -- case the front end must generate an extra temporary and initialize
-- this temporary as required (the temporary itself is not atomic).
-- Note: there is not node kind for object definition. Instead, the
-- N_Access_Function_Definition
-- Sloc points to ACCESS
-- Null_Exclusion_Present (Flag11)
+ -- Null_Exclusion_In_Return_Present (Flag14)
-- Protected_Present (Flag6)
-- Parameter_Specifications (List3) (set to No_List if no formal part)
-- Result_Definition (Node4) result subtype (subtype mark or access def)
-- Is_Dynamic_Coextension (Flag18-Sem)
-- plus fields for expression
+ -- Note: like all nodes, the N_Allocator has the Comes_From_Source flag.
+ -- This flag has a special function in conjunction with the restriction
+ -- No_Implicit_Heap_Allocations, which will be triggered if this flag
+ -- is not set. This means that if a source allocator is replaced with
+ -- a constructed allocator, the Comes_From_Source flag should be copied
+ -- to the newly created allocator.
+
---------------------------------
-- 5.1 Sequence Of Statements --
---------------------------------
-- Note: the back end places some restrictions on the form of the
-- Expression field. If the object being assigned to is Atomic, then
-- the Expression may not have the form of an aggregate (since this
- -- might cause the back end to generate separate assignments). It
- -- also cannot be a reference to an object marked as a true constant
- -- (Is_True_Constant flag set), where the object is itself initialized
- -- with an aggregate. If necessary the front end must generate an
- -- extra temporary (with Is_True_Constant set False), and initialize
+ -- might cause the back end to generate separate assignments). In this
+ -- case the front end must generate an extra temporary and initialize
-- this temporary as required (the temporary itself is not atomic).
-----------------------
-- There is no explicit node in the tree for a compilation, since in
-- general the compiler is processing only a single compilation unit
-- at a time. It is possible to parse multiple units in syntax check
- -- only mode, but they the trees are discarded in any case.
+ -- only mode, but the trees are discarded in that case.
------------------------------
-- 10.1.1 Compilation Unit --
-- There is no explicit node in the tree for library item, instead
-- the declaration or body, and the flag for private if present,
- -- appear in the N_Compilation_Unit clause.
+ -- appear in the N_Compilation_Unit node.
--------------------------------------
-- 10.1.1 Library Unit Declaration --
-- in the declarations of the innermost enclosing block as specified
-- in RM section 5.1 (3).
- -- The Defining_Identifier is the actual identifier for the
- -- statement identifier. Note that the occurrence of the label
- -- is a reference, NOT the defining occurrence. The defining
- -- occurrence occurs at the head of the innermost enclosing
- -- block, and is represented by this node.
+ -- The Defining_Identifier is the actual identifier for the statement
+ -- identifier. Note that the occurrence of the label is a reference, NOT
+ -- the defining occurrence. The defining occurrence occurs at the head
+ -- of the innermost enclosing block, and is represented by this node.
-- Note: from the grammar, this might better be called an implicit
-- statement identifier declaration, but the term we choose seems
-- called labels in both cases (i.e. when used in labels, and when
-- used as the identifiers of blocks and loops).
- -- Note: although this is logically a semantic node, since it does
- -- not correspond directly to a source syntax construction, these
- -- nodes are actually created by the parser in a post pass done just
- -- after parsing is complete, before semantic analysis is started (see
- -- the Par.Labl subunit in file par-labl.adb).
+ -- Note: although this is logically a semantic node, since it does not
+ -- correspond directly to a source syntax construction, these nodes are
+ -- actually created by the parser in a post pass done just after parsing
+ -- is complete, before semantic analysis is started (see Par.Labl).
-- Sprint syntax: labelname : label;
-- Itype_Reference --
---------------------
- -- This node is used to create a reference to an Itype. The only
- -- purpose is to make sure that the Itype is defined if this is the
- -- first reference.
+ -- This node is used to create a reference to an Itype. The only purpose
+ -- is to make sure the Itype is defined if this is the first reference.
-- A typical use of this node is when an Itype is to be referenced in
- -- two branches of an if statement. In this case it is important that
- -- the first use of the Itype not be inside the conditional, since
- -- then it might not be defined if the wrong branch of the if is
- -- taken in the case where the definition generates elaboration code.
+ -- two branches of an IF statement. In this case it is important that
+ -- the first use of the Itype not be inside the conditional, since then
+ -- it might not be defined if the other branch of the IF is taken, in
+ -- the case where the definition generates elaboration code.
-- The Itype field points to the referenced Itype
- -- sprint syntax: reference itype-name
+ -- Sprint syntax: reference itype-name
-- N_Itype_Reference
-- Sloc points to the node generating the reference
function Null_Exclusion_Present
(N : Node_Id) return Boolean; -- Flag11
+ function Null_Exclusion_In_Return_Present
+ (N : Node_Id) return Boolean; -- Flag14
+
function Null_Record_Present
(N : Node_Id) return Boolean; -- Flag17
procedure Set_Null_Exclusion_Present
(N : Node_Id; Val : Boolean := True); -- Flag11
+ procedure Set_Null_Exclusion_In_Return_Present
+ (N : Node_Id; Val : Boolean := True); -- Flag14
+
procedure Set_Null_Record_Present
(N : Node_Id; Val : Boolean := True); -- Flag17
pragma Inline (No_Truncation);
pragma Inline (Null_Present);
pragma Inline (Null_Exclusion_Present);
+ pragma Inline (Null_Exclusion_In_Return_Present);
pragma Inline (Null_Record_Present);
pragma Inline (Object_Definition);
pragma Inline (Original_Discriminant);
pragma Inline (Set_No_Truncation);
pragma Inline (Set_Null_Present);
pragma Inline (Set_Null_Exclusion_Present);
+ pragma Inline (Set_Null_Exclusion_In_Return_Present);
pragma Inline (Set_Null_Record_Present);
pragma Inline (Set_Object_Definition);
pragma Inline (Set_Original_Discriminant);