aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/atree.ads
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2021-10-06 09:03:53 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-10-20 10:17:04 +0000
commit36e38022125f2f336e5d281fb3e5e66191d21e73 (patch)
tree568b72492d067a5dca44147b9e452dbba8b8136f /gcc/ada/atree.ads
parent749e01a5f310f2c4327f030d425aa6e23afbbbd5 (diff)
downloadgcc-36e38022125f2f336e5d281fb3e5e66191d21e73.zip
gcc-36e38022125f2f336e5d281fb3e5e66191d21e73.tar.gz
gcc-36e38022125f2f336e5d281fb3e5e66191d21e73.tar.bz2
[Ada] tech debt: Clean up Uint fields, such as Esize
gcc/ada/ * atree.ads: Comment improvements. How is a "completely new node" different from a "new node"? Document default values corresponding to field types. * exp_ch7.adb (Process_Tagged_Type_Declaration): Use higher-level Scope_Depth instead of Scope_Depth_Value. Remove confusing comment: not clear what a "true" library level package is. * uintp.adb (Image_Out): Print No_Uint in a more readable way. * gen_il-gen.adb, gen_il-gen-gen_entities.adb, gen_il-gen-gen_nodes.adb, gen_il-types.ads: Tighten up the subtypes of fields whose type is Uint, where possible; use more-constrained subtypes such as Unat. * einfo-utils.adb, einfo-utils.ads, exp_attr.adb, exp_ch3.adb, exp_intr.adb, exp_unst.adb, exp_util.adb, freeze.adb, repinfo.adb, sem.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb, sem_ch8.adb, sem_util.adb, sprint.adb, treepr.adb: No longer use Uint_0 to indicate "unknown" or "not yet known" for various fields whose type is Uint. Use No_Uint for that, except in a small number of legacy cases that cause test failures. Protect many queries of such fields with calls to Known_... functions. Improve comments. * exp_aggr.adb: Likewise. (Is_OK_Aggregate): Check whether Csiz is present. (Aggr_Assignment_OK_For_Backend): Ensure we do not access an uninitialized size. * exp_strm.adb (Build_Elementary_Input_Call, Build_Elementary_Write_Call): Check whether P_Size is present. * cstand.adb: Leave Component_Size of Any_Composite unknown. Similar for RM_Size of Standard_Exception_Type. These should not be used. * einfo.ads: Comment improvements. * exp_disp.ads: Minor. * gen_il-internals.ads, gen_il-internals.adb: Minor. * sinfo-utils.adb: Take advantage of full-coverage rules. * types.h: Minor.
Diffstat (limited to 'gcc/ada/atree.ads')
-rw-r--r--gcc/ada/atree.ads45
1 files changed, 26 insertions, 19 deletions
diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads
index 2f3ca40..4861236 100644
--- a/gcc/ada/atree.ads
+++ b/gcc/ada/atree.ads
@@ -230,11 +230,18 @@ package Atree is
function New_Node
(New_Node_Kind : Node_Kind;
New_Sloc : Source_Ptr) return Node_Id;
- -- Allocates a completely new node with the given node type and source
- -- location values. All other fields are set to their standard defaults:
+ -- Allocates a new node with the given node type and source location
+ -- values. Fields have defaults depending on their type:
+
+ -- Flag: False
+ -- Node_Id: Empty
+ -- List_Id: Empty
+ -- Elist_Id: No_Elist
+ -- Uint: No_Uint
--
- -- Empty for all FieldN fields
- -- False for all FlagN fields
+ -- Name_Id, String_Id, Valid_Uint, Unat, Upos, Nonzero_Uint, Ureal:
+ -- No default. This means it is an error to call the getter before
+ -- calling the setter.
--
-- The usual approach is to build a new node using this function and
-- then, using the value returned, use the Set_xxx functions to set
@@ -288,16 +295,16 @@ package Atree is
-- with copying aspect specifications where this is required.
function New_Copy (Source : Node_Id) return Node_Id;
- -- This function allocates a completely new node, and then initializes
- -- it by copying the contents of the source node into it. The contents of
- -- the source node is not affected. The target node is always marked as
- -- not being in a list (even if the source is a list member), and not
- -- overloaded. The new node will have an extension if the source has
- -- an extension. New_Copy (Empty) returns Empty, and New_Copy (Error)
- -- returns Error. Note that, unlike Copy_Separate_Tree, New_Copy does not
- -- recursively copy any descendants, so in general parent pointers are not
- -- set correctly for the descendants of the copied node. Both normal and
- -- extended nodes (entities) may be copied using New_Copy.
+ -- This function allocates a new node, and then initializes it by copying
+ -- the contents of the source node into it. The contents of the source node
+ -- is not affected. The target node is always marked as not being in a list
+ -- (even if the source is a list member), and not overloaded. The new node
+ -- will have an extension if the source has an extension. New_Copy (Empty)
+ -- returns Empty, and New_Copy (Error) returns Error. Note that, unlike
+ -- Copy_Separate_Tree, New_Copy does not recursively copy any descendants,
+ -- so in general parent pointers are not set correctly for the descendants
+ -- of the copied node. Both normal and extended nodes (entities) may be
+ -- copied using New_Copy.
function Relocate_Node (Source : Node_Id) return Node_Id;
-- Source is a non-entity node that is to be relocated. A new node is
@@ -340,11 +347,11 @@ package Atree is
-- Exchange the contents of two entities. The parent pointers are switched
-- as well as the Defining_Identifier fields in the parents, so that the
-- entities point correctly to their original parents. The effect is thus
- -- to leave the tree completely unchanged in structure, except that the
- -- entity ID values of the two entities are interchanged. Neither of the
- -- two entities may be list members. Note that entities appear on two
- -- semantic chains: Homonym and Next_Entity: the corresponding links must
- -- be adjusted by the caller, according to context.
+ -- to leave the tree unchanged in structure, except that the entity ID
+ -- values of the two entities are interchanged. Neither of the two entities
+ -- may be list members. Note that entities appear on two semantic chains:
+ -- Homonym and Next_Entity: the corresponding links must be adjusted by the
+ -- caller, according to context.
procedure Extend_Node (Source : Node_Id);
-- This turns a node into an entity; it function is used only by Sinfo.CN.