From 2e02ab86744ccc97cc65d739ca515cb7d3b882d2 Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Wed, 24 Feb 2021 08:13:36 -0500 Subject: [PATCH] [Ada] Variable-sized node types -- cleanup gcc/ada/ * atree.ads, atree.adb, gen_il-gen.ads: Fix comments and clean up ??? marks. Rename Set_Ekind to be Mutate_Ekind. * einfo.ads, sinfo.ads: Likewise. Change "definitive definition" to "official definition", because the former sounds redundant. Rename Set_Ekind to be Mutate_Ekind. * checks.adb, contracts.adb, cstand.adb, exp_aggr.adb, exp_attr.adb, exp_ch11.adb, exp_ch3.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, exp_disp.adb, exp_dist.adb, exp_imgv.adb, exp_intr.adb, exp_prag.adb, exp_unst.adb, exp_util.adb, gen_il-gen.adb, inline.adb, lib-writ.adb, lib-xref-spark_specific.adb, sem_aggr.adb, sem_ch10.adb, sem_ch11.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb, sem_ch5.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_dist.adb, sem_elab.adb, sem_prag.adb, sem_util.adb: Rename Set_Ekind to be Mutate_Ekind. --- gcc/ada/atree.adb | 25 +++-- gcc/ada/atree.ads | 133 +++++----------------- gcc/ada/checks.adb | 2 +- gcc/ada/contracts.adb | 10 +- gcc/ada/cstand.adb | 98 ++++++++--------- gcc/ada/einfo.ads | 76 +++---------- gcc/ada/exp_aggr.adb | 6 +- gcc/ada/exp_attr.adb | 6 +- gcc/ada/exp_ch11.adb | 2 +- gcc/ada/exp_ch3.adb | 20 ++-- gcc/ada/exp_ch5.adb | 10 +- gcc/ada/exp_ch6.adb | 4 +- gcc/ada/exp_ch7.adb | 2 +- gcc/ada/exp_ch9.adb | 32 +++--- gcc/ada/exp_disp.adb | 30 ++--- gcc/ada/exp_dist.adb | 20 ++-- gcc/ada/exp_imgv.adb | 2 +- gcc/ada/exp_intr.adb | 2 +- gcc/ada/exp_prag.adb | 4 +- gcc/ada/exp_unst.adb | 4 +- gcc/ada/exp_util.adb | 22 ++-- gcc/ada/gen_il-gen.adb | 4 +- gcc/ada/gen_il-gen.ads | 16 ++- gcc/ada/inline.adb | 4 +- gcc/ada/lib-writ.adb | 2 +- gcc/ada/lib-xref-spark_specific.adb | 2 +- gcc/ada/sem_aggr.adb | 6 +- gcc/ada/sem_ch10.adb | 29 ++--- gcc/ada/sem_ch11.adb | 4 +- gcc/ada/sem_ch12.adb | 64 +++++------ gcc/ada/sem_ch13.adb | 6 +- gcc/ada/sem_ch3.adb | 212 ++++++++++++++++++------------------ gcc/ada/sem_ch5.adb | 24 ++-- gcc/ada/sem_ch6.adb | 34 +++--- gcc/ada/sem_ch7.adb | 12 +- gcc/ada/sem_ch8.adb | 22 ++-- gcc/ada/sem_ch9.adb | 32 +++--- gcc/ada/sem_dist.adb | 2 +- gcc/ada/sem_elab.adb | 4 +- gcc/ada/sem_prag.adb | 2 +- gcc/ada/sem_util.adb | 10 +- gcc/ada/sinfo.ads | 154 ++++++++++++-------------- 42 files changed, 517 insertions(+), 638 deletions(-) diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index 06bf8d2..a725d87 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -83,14 +83,15 @@ package body Atree is -- Implementation of Tree Substitution Routines -- -------------------------------------------------- - -- A separate table keeps track of the mapping between rewritten nodes - -- and their corresponding original tree nodes. Rewrite makes an entry - -- in this table for use by Original_Node. By default, if no call is - -- Rewrite, the entry in this table points to the original unwritten node. + -- A separate table keeps track of the mapping between rewritten nodes and + -- their corresponding original tree nodes. Rewrite makes an entry in this + -- table for use by Original_Node. By default the entry in this table + -- points to the original unwritten node. Note that if a node is rewritten + -- more than once, there is no easy way to get to the intermediate + -- rewrites; the node itself is the latest version, and the entry in this + -- table is the original. - -- Note: eventually, this should be a field in the Node directly, but - -- for now we do not want to disturb the efficiency of a power of 2 - -- for the node size. ????We are getting rid of power-of-2. + -- Note: This could be a node field. package Orig_Nodes is new Table.Table ( Table_Component_Type => Node_Id, @@ -825,9 +826,9 @@ package body Atree is Old_Kind : constant Entity_Kind := Ekind (Old_N); -- If this fails, it means you need to call Reinit_Field_To_Zero before - -- calling Set_Ekind. But we have many cases where vanishing fields are - -- expected to reappear after converting to/from E_Void. Other cases are - -- more problematic; set a breakpoint on "(non-E_Void case)" below. + -- calling Mutate_Ekind. But we have many cases where vanishing fields + -- are expected to reappear after converting to/from E_Void. Other cases + -- are more problematic; set a breakpoint on "(non-E_Void case)" below. begin for J in Entity_Field_Table (Old_Kind)'Range loop @@ -909,7 +910,7 @@ package body Atree is procedure Set_Ekind_Type is new Set_8_Bit_Field (Entity_Kind) with Inline; - procedure Set_Ekind + procedure Mutate_Ekind (N : Entity_Id; Val : Entity_Kind) is begin @@ -926,7 +927,7 @@ package body Atree is Set_Ekind_Type (N, Ekind_Offset, Val); pragma Debug (Validate_Node_Write (N)); - end Set_Ekind; + end Mutate_Ekind; ----------------------- -- Allocate_New_Node -- diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads index d0184c7..c470ac3 100644 --- a/gcc/ada/atree.ads +++ b/gcc/ada/atree.ads @@ -23,16 +23,6 @@ -- -- ------------------------------------------------------------------------------ -with Alloc; -with Sinfo.Nodes; use Sinfo.Nodes; -with Einfo.Entities; use Einfo.Entities; -with Types; use Types; -with System; use System; -with Table; -with Unchecked_Conversion; - -package Atree is - -- This package defines the low-level representation of the tree used to -- represent the Ada program internally. Syntactic and semantic information -- is combined in this tree. There is no separate symbol table structure. @@ -54,81 +44,23 @@ package Atree is -- syntax tree format. Subsequent processing in the front end traverses the -- tree, transforming it in various ways and adding semantic information. - -- ????The following comments should be moved elsewhere. - - ---------------------------------------- - -- Definitions of fields in tree node -- - ---------------------------------------- - - -- The representation of the tree is completely hidden, using a functional - -- interface for accessing and modifying the contents of nodes. Logically - -- a node contains a number of fields, much as though the nodes were - -- defined as a record type. The fields in a node are as follows: - - -- Nkind Indicates the kind of the node. This field is present - -- in all nodes. The type is Node_Kind, which is declared - -- in the package Sinfo. - - -- Sloc Location (Source_Ptr) of the corresponding token - -- in the Source buffer. The individual node definitions - -- show which token is referenced by this pointer. - - -- In_List A flag used to indicate if the node is a member - -- of a node list (see package Nlists). - - -- Rewrite_Ins A flag set if a node is marked as a rewrite inserted - -- node as a result of a call to Mark_Rewrite_Insertion. - - -- Paren_Count A 2-bit count used in sub-expression nodes to indicate - -- the level of parentheses. The settings are 0,1,2 and - -- 3 for many. If the value is 3, then an auxiliary table - -- is used to indicate the real value. Set to zero for - -- non-subexpression nodes. - - -- Note: the required parentheses surrounding conditional - -- and quantified expressions count as a level of parens - -- for this purpose, so e.g. in X := (if A then B else C); - -- Paren_Count for the right side will be 1. - - -- Comes_From_Source - -- This flag is present in all nodes. It is set if the - -- node is built by the scanner or parser, and clear if - -- the node is built by the analyzer or expander. It - -- indicates that the node corresponds to a construct - -- that appears in the original source program. - - -- Analyzed This flag is present in all nodes. It is set when - -- a node is analyzed, and is used to avoid analyzing - -- the same node twice. Analysis includes expansion if - -- expansion is active, so in this case if the flag is - -- set it means the node has been analyzed and expanded. - - -- Error_Posted This flag is present in all nodes. It is set when - -- an error message is posted which is associated with - -- the flagged node. This is used to avoid posting more - -- than one message on the same node. - - -- Link For a node, points to the Parent. For a list, points - -- to the list header. Note that in the latter case, a - -- client cannot modify the link field. This field is - -- private to the Atree package (but is also modified - -- by the Nlists package). - - -- The following additional fields are present in extended nodes used - -- for entities (Nkind in N_Entity). - - -- Ekind Entity type. This field indicates the type of the - -- entity, it is of type Entity_Kind which is defined - -- in package Einfo. - - -- Convention Entity convention (Convention_Id value) - - -- Access to fields is generally done through the getters and setters in - -- packages Sinfo.Nodes and Einfo.Entities. However, in specialized - -- circumstances (examples are the circuit in generic instantiation to copy - -- trees, and in the tree dump routine), it is useful to be able to do - -- untyped traversals, and an internal package in Atree allows for direct - -- untyped accesses in such cases. +with Alloc; +with Sinfo.Nodes; use Sinfo.Nodes; +with Einfo.Entities; use Einfo.Entities; +with Types; use Types; +with System; use System; +with Table; +with Unchecked_Conversion; + +package Atree is + + -- Access to node fields is generally done through the getters and setters + -- in packages Sinfo.Nodes and Einfo.Entities, which are automatically + -- generated (see Gen_IL.Gen). However, in specialized circumstances + -- (examples are the circuit in generic instantiation to copy trees, and in + -- the tree dump routine), it is useful to be able to do untyped + -- traversals, and an internal package in Atree allows for direct untyped + -- accesses in such cases. function Last_Node_Id return Node_Id; -- Returns Id of last allocated node Id @@ -334,12 +266,9 @@ package Atree is -- of Comes_From_Source from OldN to NewN. procedure Change_Node (N : Node_Id; New_Kind : Node_Kind); - -- This procedure replaces the given node by setting its Nkind field to - -- the indicated value and resetting all other fields to their default - -- values except for Sloc, which is unchanged, and the Parent pointer - -- and list links, which are also unchanged. All other information in - -- the original node is lost. The new node has an extension if the - -- original node had an extension.????somewhat wrong. + -- This procedure replaces the given node by setting its Nkind field to the + -- indicated value and resetting all other fields to their default values + -- except for certain fields that are preserved (see body for details). procedure Copy_Node (Source, Destination : Node_Or_Entity_Id); -- Copy the entire contents of the source node to the destination node. @@ -579,19 +508,15 @@ package Atree is -- original node, i.e. the old contents of Old_Node. procedure Replace (Old_Node, New_Node : Node_Id); - -- This is similar to Rewrite, except that the old value of Old_Node is - -- not saved, and the New_Node is deleted after the replace, since it - -- In what sense is it "deleted"???? - -- is assumed that it can no longer be legitimately needed. The flag + -- This is similar to Rewrite, except that the old value of Old_Node + -- is not saved. New_Node should not be used after Replace. The flag -- Is_Rewrite_Substitution will be False for the resulting node, unless -- it was already true on entry, and Original_Node will not return the - -- original contents of the Old_Node, but rather the New_Node value (unless - -- How is this "unless" true???? - -- Old_Node had already been rewritten using Rewrite). Replace also - -- preserves the setting of Comes_From_Source. + -- original contents of the Old_Node, but rather the New_Node value. + -- Replace also preserves the setting of Comes_From_Source. -- - -- Note, New_Node must not contain references to Old_Node, for example as - -- descendants, since the rewrite would make such references invalid. If + -- Note that New_Node must not contain references to Old_Node, for example + -- as descendants, since the rewrite would make such references invalid. If -- New_Node does need to reference Old_Node, then these references should -- be to a relocated copy of Old_Node (see Relocate_Node procedure). -- @@ -614,7 +539,7 @@ package Atree is -- -- Note: Parents are not preserved in original tree nodes that are -- retrieved in this way (i.e. their children may have children whose - -- pointers which reference some other node). This needs more details??? + -- Parent pointers reference some other node). -- -- Note: there is no direct mechanism for deleting an original node (in -- a manner that can be reversed later). One possible approach is to use @@ -660,10 +585,8 @@ package Atree is -- vanishing fields might be used for totally unrelated fields in the new -- node. See Reinit_Field_To_Zero. - procedure Set_Ekind + procedure Mutate_Ekind (N : Entity_Id; Val : Entity_Kind) with Inline; - -- ????Perhaps should be called Mutate_Ekind. - -- -- Ekind is also like a discriminant, and is mostly treated as above (see -- Mutate_Nkind). However, there are a few cases where we set the Ekind -- from its initial E_Void value to something else, then set it back to diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 22b2b69..faf5326 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -8158,7 +8158,7 @@ package body Checks is -- cause our object declaration to remain unanalyzed we must do -- some manual decoration. - Set_Ekind (Var_Id, E_Variable); + Mutate_Ekind (Var_Id, E_Variable); Set_Etype (Var_Id, Typ); Insert_Action (Exp, diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 61345ea..59b53de 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -1580,7 +1580,7 @@ package body Contracts is -- in its visible declarations. if Nkind (Templ) = N_Generic_Package_Declaration then - Set_Ekind (Templ_Id, E_Generic_Package); + Mutate_Ekind (Templ_Id, E_Generic_Package); if Present (Visible_Declarations (Specification (Templ))) then Decl := First (Visible_Declarations (Specification (Templ))); @@ -1590,7 +1590,7 @@ package body Contracts is -- declarations. elsif Nkind (Templ) = N_Package_Body then - Set_Ekind (Templ_Id, E_Package_Body); + Mutate_Ekind (Templ_Id, E_Package_Body); if Present (Declarations (Templ)) then Decl := First (Declarations (Templ)); @@ -1600,9 +1600,9 @@ package body Contracts is elsif Nkind (Templ) = N_Generic_Subprogram_Declaration then if Nkind (Specification (Templ)) = N_Function_Specification then - Set_Ekind (Templ_Id, E_Generic_Function); + Mutate_Ekind (Templ_Id, E_Generic_Function); else - Set_Ekind (Templ_Id, E_Generic_Procedure); + Mutate_Ekind (Templ_Id, E_Generic_Procedure); end if; -- When the generic subprogram acts as a compilation unit, inspect @@ -1626,7 +1626,7 @@ package body Contracts is -- its declarations. elsif Nkind (Templ) = N_Subprogram_Body then - Set_Ekind (Templ_Id, E_Subprogram_Body); + Mutate_Ekind (Templ_Id, E_Subprogram_Body); if Present (Declarations (Templ)) then Decl := First (Declarations (Templ)); diff --git a/gcc/ada/cstand.adb b/gcc/ada/cstand.adb index 5229153..d087ce2 100644 --- a/gcc/ada/cstand.adb +++ b/gcc/ada/cstand.adb @@ -203,7 +203,7 @@ package body CStand is Make_Floating_Point_Definition (Stloc, Digits_Expression => Make_Integer (UI_From_Int (Digs)))); - Set_Ekind (E, E_Floating_Point_Type); + Mutate_Ekind (E, E_Floating_Point_Type); Set_Etype (E, E); Init_Digits_Value (E, Digs); Set_Float_Rep (E, Rep); @@ -247,7 +247,7 @@ package body CStand is Low_Bound => Make_Integer (Lbound), High_Bound => Make_Integer (Ubound))); - Set_Ekind (E, E_Signed_Integer_Type); + Mutate_Ekind (E, E_Signed_Integer_Type); Set_Etype (E, E); Init_Size (E, Siz); Set_Elem_Alignment (E); @@ -272,7 +272,7 @@ package body CStand is begin Set_Defining_Identifier (Decl, Uns); - Set_Ekind (Uns, E_Modular_Integer_Type); + Mutate_Ekind (Uns, E_Modular_Integer_Type); Set_Scope (Uns, Standard_Standard); Set_Etype (Uns, Uns); Init_Size (Uns, Siz); @@ -467,7 +467,7 @@ package body CStand is procedure Build_Exception (S : Standard_Entity_Type) is begin - Set_Ekind (Standard_Entity (S), E_Exception); + Mutate_Ekind (Standard_Entity (S), E_Exception); Set_Etype (Standard_Entity (S), Standard_Exception_Type); Set_Is_Public (Standard_Entity (S), True); @@ -607,7 +607,7 @@ package body CStand is Set_Defining_Unit_Name (Pspec, Standard_Standard); Set_Visible_Declarations (Pspec, Decl_S); - Set_Ekind (Standard_Standard, E_Package); + Mutate_Ekind (Standard_Standard, E_Package); Set_Is_Pure (Standard_Standard); Set_Is_Compilation_Unit (Standard_Standard); @@ -649,7 +649,7 @@ package body CStand is Append (Standard_True, Literals (Tdef_Node)); Set_Type_Definition (Parent (Standard_Boolean), Tdef_Node); - Set_Ekind (Standard_Boolean, E_Enumeration_Type); + Mutate_Ekind (Standard_Boolean, E_Enumeration_Type); Set_First_Literal (Standard_Boolean, Standard_False); Set_Etype (Standard_Boolean, Standard_Boolean); Init_Esize (Standard_Boolean, Standard_Character_Size); @@ -660,13 +660,13 @@ package body CStand is Set_Size_Known_At_Compile_Time (Standard_Boolean); Set_Has_Pragma_Ordered (Standard_Boolean); - Set_Ekind (Standard_True, E_Enumeration_Literal); + Mutate_Ekind (Standard_True, E_Enumeration_Literal); Set_Etype (Standard_True, Standard_Boolean); Set_Enumeration_Pos (Standard_True, Uint_1); Set_Enumeration_Rep (Standard_True, Uint_1); Set_Is_Known_Valid (Standard_True, True); - Set_Ekind (Standard_False, E_Enumeration_Literal); + Mutate_Ekind (Standard_False, E_Enumeration_Literal); Set_Etype (Standard_False, Standard_Boolean); Set_Enumeration_Pos (Standard_False, Uint_0); Set_Enumeration_Rep (Standard_False, Uint_0); @@ -755,7 +755,7 @@ package body CStand is Tdef_Node := New_Node (N_Enumeration_Type_Definition, Stloc); Set_Type_Definition (Parent (Standard_Character), Tdef_Node); - Set_Ekind (Standard_Character, E_Enumeration_Type); + Mutate_Ekind (Standard_Character, E_Enumeration_Type); Set_Etype (Standard_Character, Standard_Character); Init_Esize (Standard_Character, Standard_Character_Size); Init_RM_Size (Standard_Character, 8); @@ -802,7 +802,7 @@ package body CStand is Tdef_Node := New_Node (N_Enumeration_Type_Definition, Stloc); Set_Type_Definition (Parent (Standard_Wide_Character), Tdef_Node); - Set_Ekind (Standard_Wide_Character, E_Enumeration_Type); + Mutate_Ekind (Standard_Wide_Character, E_Enumeration_Type); Set_Etype (Standard_Wide_Character, Standard_Wide_Character); Init_Size (Standard_Wide_Character, Standard_Wide_Character_Size); @@ -848,7 +848,7 @@ package body CStand is Tdef_Node := New_Node (N_Enumeration_Type_Definition, Stloc); Set_Type_Definition (Parent (Standard_Wide_Wide_Character), Tdef_Node); - Set_Ekind (Standard_Wide_Wide_Character, E_Enumeration_Type); + Mutate_Ekind (Standard_Wide_Wide_Character, E_Enumeration_Type); Set_Etype (Standard_Wide_Wide_Character, Standard_Wide_Wide_Character); Init_Size (Standard_Wide_Wide_Character, @@ -908,7 +908,7 @@ package body CStand is Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node)); Set_Type_Definition (Parent (Standard_String), Tdef_Node); - Set_Ekind (Standard_String, E_Array_Type); + Mutate_Ekind (Standard_String, E_Array_Type); Set_Etype (Standard_String, Standard_String); Set_Component_Type (Standard_String, Standard_Character); Set_Component_Size (Standard_String, Uint_8); @@ -952,7 +952,7 @@ package body CStand is Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node)); Set_Type_Definition (Parent (Standard_Wide_String), Tdef_Node); - Set_Ekind (Standard_Wide_String, E_Array_Type); + Mutate_Ekind (Standard_Wide_String, E_Array_Type); Set_Etype (Standard_Wide_String, Standard_Wide_String); Set_Component_Type (Standard_Wide_String, Standard_Wide_Character); Set_Component_Size (Standard_Wide_String, Uint_16); @@ -987,7 +987,7 @@ package body CStand is Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node)); Set_Type_Definition (Parent (Standard_Wide_Wide_String), Tdef_Node); - Set_Ekind (Standard_Wide_Wide_String, E_Array_Type); + Mutate_Ekind (Standard_Wide_Wide_String, E_Array_Type); Set_Etype (Standard_Wide_Wide_String, Standard_Wide_Wide_String); Set_Component_Type (Standard_Wide_Wide_String, @@ -1009,7 +1009,7 @@ package body CStand is -- Setup entity for Natural - Set_Ekind (Standard_Natural, E_Signed_Integer_Subtype); + Mutate_Ekind (Standard_Natural, E_Signed_Integer_Subtype); Set_Etype (Standard_Natural, Base_Type (Standard_Integer)); Init_Esize (Standard_Natural, Standard_Integer_Size); Init_RM_Size (Standard_Natural, Standard_Integer_Size - 1); @@ -1024,7 +1024,7 @@ package body CStand is -- Setup entity for Positive - Set_Ekind (Standard_Positive, E_Signed_Integer_Subtype); + Mutate_Ekind (Standard_Positive, E_Signed_Integer_Subtype); Set_Etype (Standard_Positive, Base_Type (Standard_Integer)); Init_Esize (Standard_Positive, Standard_Integer_Size); Init_RM_Size (Standard_Positive, Standard_Integer_Size - 1); @@ -1047,7 +1047,7 @@ package body CStand is Set_Specification (Decl, Pspec); Set_Defining_Unit_Name (Pspec, Standard_Entity (S_ASCII)); - Set_Ekind (Standard_Entity (S_ASCII), E_Package); + Mutate_Ekind (Standard_Entity (S_ASCII), E_Package); Set_Visible_Declarations (Pspec, Decl_A); -- Create control character definitions in package ASCII. Note that @@ -1067,7 +1067,7 @@ package body CStand is begin Set_Sloc (A_Char, Staloc); - Set_Ekind (A_Char, E_Constant); + Mutate_Ekind (A_Char, E_Constant); Set_Never_Set_In_Source (A_Char, True); Set_Is_True_Constant (A_Char, True); Set_Etype (A_Char, Standard_Character); @@ -1122,7 +1122,7 @@ package body CStand is -- type name that is reasonable, but does not overlap any Ada name. Standard_A_String := New_Standard_Entity ("access_string"); - Set_Ekind (Standard_A_String, E_Access_Type); + Mutate_Ekind (Standard_A_String, E_Access_Type); Set_Scope (Standard_A_String, Standard_Standard); Set_Etype (Standard_A_String, Standard_A_String); @@ -1138,7 +1138,7 @@ package body CStand is (Standard_A_String, Standard_String); Standard_A_Char := New_Standard_Entity ("access_character"); - Set_Ekind (Standard_A_Char, E_Access_Type); + Mutate_Ekind (Standard_A_Char, E_Access_Type); Set_Scope (Standard_A_Char, Standard_Standard); Set_Etype (Standard_A_Char, Standard_A_String); Init_Size (Standard_A_Char, System_Address_Size); @@ -1153,7 +1153,7 @@ package body CStand is Standard_Debug_Renaming_Type := New_Standard_Entity ("_renaming_type"); - Set_Ekind (Standard_Debug_Renaming_Type, E_Signed_Integer_Subtype); + Mutate_Ekind (Standard_Debug_Renaming_Type, E_Signed_Integer_Subtype); Set_Scope (Standard_Debug_Renaming_Type, Standard_Standard); Set_Etype (Standard_Debug_Renaming_Type, Base_Type (Standard_Integer)); Init_Esize (Standard_Debug_Renaming_Type, 0); @@ -1183,14 +1183,14 @@ package body CStand is Build_Signed_Integer_Type (Any_Type, Standard_Integer_Size); Any_Id := New_Standard_Entity ("any id"); - Set_Ekind (Any_Id, E_Variable); + Mutate_Ekind (Any_Id, E_Variable); Set_Scope (Any_Id, Standard_Standard); Set_Etype (Any_Id, Any_Type); Init_Esize (Any_Id); Init_Alignment (Any_Id); Any_Access := New_Standard_Entity ("an access type"); - Set_Ekind (Any_Access, E_Access_Type); + Mutate_Ekind (Any_Access, E_Access_Type); Set_Scope (Any_Access, Standard_Standard); Set_Etype (Any_Access, Any_Access); Init_Size (Any_Access, System_Address_Size); @@ -1199,7 +1199,7 @@ package body CStand is (Any_Access, Any_Type); Any_Character := New_Standard_Entity ("a character type"); - Set_Ekind (Any_Character, E_Enumeration_Type); + Mutate_Ekind (Any_Character, E_Enumeration_Type); Set_Scope (Any_Character, Standard_Standard); Set_Etype (Any_Character, Any_Character); Set_Is_Unsigned_Type (Any_Character); @@ -1210,7 +1210,7 @@ package body CStand is Set_Scalar_Range (Any_Character, Scalar_Range (Standard_Character)); Any_Array := New_Standard_Entity ("an array type"); - Set_Ekind (Any_Array, E_Array_Type); + Mutate_Ekind (Any_Array, E_Array_Type); Set_Scope (Any_Array, Standard_Standard); Set_Etype (Any_Array, Any_Array); Set_Component_Type (Any_Array, Any_Character); @@ -1218,7 +1218,7 @@ package body CStand is Make_Dummy_Index (Any_Array); Any_Boolean := New_Standard_Entity ("a boolean type"); - Set_Ekind (Any_Boolean, E_Enumeration_Type); + Mutate_Ekind (Any_Boolean, E_Enumeration_Type); Set_Scope (Any_Boolean, Standard_Standard); Set_Etype (Any_Boolean, Standard_Boolean); Init_Esize (Any_Boolean, Standard_Character_Size); @@ -1228,7 +1228,7 @@ package body CStand is Set_Scalar_Range (Any_Boolean, Scalar_Range (Standard_Boolean)); Any_Composite := New_Standard_Entity ("a composite type"); - Set_Ekind (Any_Composite, E_Array_Type); + Mutate_Ekind (Any_Composite, E_Array_Type); Set_Scope (Any_Composite, Standard_Standard); Set_Etype (Any_Composite, Any_Composite); Set_Component_Size (Any_Composite, Uint_0); @@ -1236,21 +1236,21 @@ package body CStand is Init_Size_Align (Any_Composite); Any_Discrete := New_Standard_Entity ("a discrete type"); - Set_Ekind (Any_Discrete, E_Signed_Integer_Type); + Mutate_Ekind (Any_Discrete, E_Signed_Integer_Type); Set_Scope (Any_Discrete, Standard_Standard); Set_Etype (Any_Discrete, Any_Discrete); Init_Size (Any_Discrete, Standard_Integer_Size); Set_Elem_Alignment (Any_Discrete); Any_Fixed := New_Standard_Entity ("a fixed-point type"); - Set_Ekind (Any_Fixed, E_Ordinary_Fixed_Point_Type); + Mutate_Ekind (Any_Fixed, E_Ordinary_Fixed_Point_Type); Set_Scope (Any_Fixed, Standard_Standard); Set_Etype (Any_Fixed, Any_Fixed); Init_Size (Any_Fixed, Standard_Integer_Size); Set_Elem_Alignment (Any_Fixed); Any_Integer := New_Standard_Entity ("an integer type"); - Set_Ekind (Any_Integer, E_Signed_Integer_Type); + Mutate_Ekind (Any_Integer, E_Signed_Integer_Type); Set_Scope (Any_Integer, Standard_Standard); Set_Etype (Any_Integer, Standard_Long_Long_Long_Integer); Init_Size (Any_Integer, Standard_Long_Long_Long_Integer_Size); @@ -1263,7 +1263,7 @@ package body CStand is Hb => Intval (High_Bound (Scalar_Range (Standard_Integer)))); Any_Modular := New_Standard_Entity ("a modular type"); - Set_Ekind (Any_Modular, E_Modular_Integer_Type); + Mutate_Ekind (Any_Modular, E_Modular_Integer_Type); Set_Scope (Any_Modular, Standard_Standard); Set_Etype (Any_Modular, Standard_Long_Long_Long_Integer); Init_Size (Any_Modular, Standard_Long_Long_Long_Integer_Size); @@ -1271,14 +1271,14 @@ package body CStand is Set_Is_Unsigned_Type (Any_Modular); Any_Numeric := New_Standard_Entity ("a numeric type"); - Set_Ekind (Any_Numeric, E_Signed_Integer_Type); + Mutate_Ekind (Any_Numeric, E_Signed_Integer_Type); Set_Scope (Any_Numeric, Standard_Standard); Set_Etype (Any_Numeric, Standard_Long_Long_Long_Integer); Init_Size (Any_Numeric, Standard_Long_Long_Long_Integer_Size); Set_Elem_Alignment (Any_Numeric); Any_Real := New_Standard_Entity ("a real type"); - Set_Ekind (Any_Real, E_Floating_Point_Type); + Mutate_Ekind (Any_Real, E_Floating_Point_Type); Set_Scope (Any_Real, Standard_Standard); Set_Etype (Any_Real, Standard_Long_Long_Float); Init_Size (Any_Real, @@ -1286,14 +1286,14 @@ package body CStand is Set_Elem_Alignment (Any_Real); Any_Scalar := New_Standard_Entity ("a scalar type"); - Set_Ekind (Any_Scalar, E_Signed_Integer_Type); + Mutate_Ekind (Any_Scalar, E_Signed_Integer_Type); Set_Scope (Any_Scalar, Standard_Standard); Set_Etype (Any_Scalar, Any_Scalar); Init_Size (Any_Scalar, Standard_Integer_Size); Set_Elem_Alignment (Any_Scalar); Any_String := New_Standard_Entity ("a string type"); - Set_Ekind (Any_String, E_Array_Type); + Mutate_Ekind (Any_String, E_Array_Type); Set_Scope (Any_String, Standard_Standard); Set_Etype (Any_String, Any_String); Set_Component_Type (Any_String, Any_Character); @@ -1405,7 +1405,7 @@ package body CStand is Universal_Fixed := New_Standard_Entity ("universal_fixed"); Decl := New_Node (N_Full_Type_Declaration, Stloc); Set_Defining_Identifier (Decl, Universal_Fixed); - Set_Ekind (Universal_Fixed, E_Ordinary_Fixed_Point_Type); + Mutate_Ekind (Universal_Fixed, E_Ordinary_Fixed_Point_Type); Set_Etype (Universal_Fixed, Universal_Fixed); Set_Scope (Universal_Fixed, Standard_Standard); Init_Size (Universal_Fixed, Standard_Long_Long_Integer_Size); @@ -1450,7 +1450,7 @@ package body CStand is Set_Type_Definition (Parent (Standard_Duration), Tdef_Node); - Set_Ekind (Standard_Duration, E_Ordinary_Fixed_Point_Type); + Mutate_Ekind (Standard_Duration, E_Ordinary_Fixed_Point_Type); Set_Etype (Standard_Duration, Standard_Duration); if Duration_32_Bits_On_Target then @@ -1501,7 +1501,7 @@ package body CStand is begin Standard_Exception_Type := New_Standard_Entity ("exception"); - Set_Ekind (Standard_Exception_Type, E_Record_Type); + Mutate_Ekind (Standard_Exception_Type, E_Record_Type); Set_Etype (Standard_Exception_Type, Standard_Exception_Type); Set_Scope (Standard_Exception_Type, Standard_Standard); Set_Stored_Constraint @@ -1576,7 +1576,7 @@ package body CStand is Decl := New_Node (N_Exception_Renaming_Declaration, Stloc); E_Id := Standard_Entity (S_Numeric_Error); - Set_Ekind (E_Id, E_Exception); + Mutate_Ekind (E_Id, E_Exception); Set_Etype (E_Id, Standard_Exception_Type); Set_Is_Public (E_Id); Set_Renamed_Entity (E_Id, Standard_Entity (S_Constraint_Error)); @@ -1594,7 +1594,7 @@ package body CStand is Abort_Signal := New_Standard_Entity; Set_Chars (Abort_Signal, Name_uAbort_Signal); - Set_Ekind (Abort_Signal, E_Exception); + Mutate_Ekind (Abort_Signal, E_Exception); Set_Etype (Abort_Signal, Standard_Exception_Type); Set_Scope (Abort_Signal, Standard_Standard); Set_Is_Public (Abort_Signal, True); @@ -1609,24 +1609,24 @@ package body CStand is Standard_Op_Rotate_Left := New_Standard_Entity; Set_Chars (Standard_Op_Rotate_Left, Name_Rotate_Left); - Set_Ekind (Standard_Op_Rotate_Left, E_Operator); + Mutate_Ekind (Standard_Op_Rotate_Left, E_Operator); Standard_Op_Rotate_Right := New_Standard_Entity; Set_Chars (Standard_Op_Rotate_Right, Name_Rotate_Right); - Set_Ekind (Standard_Op_Rotate_Right, E_Operator); + Mutate_Ekind (Standard_Op_Rotate_Right, E_Operator); Standard_Op_Shift_Left := New_Standard_Entity; Set_Chars (Standard_Op_Shift_Left, Name_Shift_Left); - Set_Ekind (Standard_Op_Shift_Left, E_Operator); + Mutate_Ekind (Standard_Op_Shift_Left, E_Operator); Standard_Op_Shift_Right := New_Standard_Entity; Set_Chars (Standard_Op_Shift_Right, Name_Shift_Right); - Set_Ekind (Standard_Op_Shift_Right, E_Operator); + Mutate_Ekind (Standard_Op_Shift_Right, E_Operator); Standard_Op_Shift_Right_Arithmetic := New_Standard_Entity; Set_Chars (Standard_Op_Shift_Right_Arithmetic, Name_Shift_Right_Arithmetic); - Set_Ekind (Standard_Op_Shift_Right_Arithmetic, + Mutate_Ekind (Standard_Op_Shift_Right_Arithmetic, E_Operator); -- Create standard operator declarations @@ -1681,7 +1681,7 @@ package body CStand is New_Ent : constant Entity_Id := New_Copy (E); begin - Set_Ekind (E, K); + Mutate_Ekind (E, K); Set_Is_Constrained (E, True); Set_Is_First_Subtype (E, True); Set_Etype (E, New_Ent); @@ -1723,7 +1723,7 @@ package body CStand is Id : constant Entity_Id := New_Standard_Entity (Nam); begin - Set_Ekind (Id, E_Component); + Mutate_Ekind (Id, E_Component); Set_Etype (Id, Typ); Set_Scope (Id, Rec); Init_Component_Location (Id); @@ -1741,7 +1741,7 @@ package body CStand is Formal : constant Entity_Id := New_Standard_Entity (Nam); begin - Set_Ekind (Formal, E_In_Parameter); + Mutate_Ekind (Formal, E_In_Parameter); Set_Mechanism (Formal, Default_Mechanism); Set_Scope (Formal, Standard_Standard); Set_Etype (Formal, Typ); @@ -1771,7 +1771,7 @@ package body CStand is begin Set_Is_Pure (Ident_Node, True); - Set_Ekind (Ident_Node, E_Operator); + Mutate_Ekind (Ident_Node, E_Operator); Set_Etype (Ident_Node, Typ); Set_Scope (Ident_Node, Standard_Standard); Set_Homonym (Ident_Node, Get_Name_Entity_Id (Op)); diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 7428ead..bd4998f 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -34,23 +34,25 @@ pragma Warnings (On); package Einfo is --- ????Comments below are partly obsolete +-- This package documents the annotations to the abstract syntax tree that are +-- needed to support semantic processing of an Ada compilation. --- This package defines the annotations to the abstract syntax tree that --- are needed to support semantic processing of an Ada compilation. - --- Note that after editing this spec and the corresponding body it is --- required to run ceinfo to check the consistentcy of spec and body. --- See ceinfo.adb for more information about the checks made. +-- See the spec of Gen_IL.Gen for instructions on making changes to this file. +-- Note that the official definition of what entities have what fields is in +-- Gen_IL.Gen.Gen_Entities; if there is a discrepancy between that and the +-- comments here, Gen_IL.Gen.Gen_Entities wins. +-- +-- Offsets of each field are given in parentheses below, but this information +-- is obsolete, and should be completely ignored. The actual field offsets are +-- determined by the Gen_IL program. We might want to remove these comments at +-- some point. -- These annotations are for the most part attributes of declared entities, -- and they correspond to conventional symbol table information. Other -- attributes include sets of meanings for overloaded names, possible -- types for overloaded expressions, flags to indicate deferred constants, --- incomplete types, etc. These attributes are stored in available fields in --- tree nodes (i.e. fields not used by the parser, as defined by the Sinfo --- package specification), and accessed by means of a set of subprograms --- which define an abstract interface. +-- incomplete types, etc. These attributes are stored in fields in +-- tree nodes. -- There are two kinds of semantic information @@ -69,61 +71,13 @@ package Einfo is -- Second, in some cases semantic information is stored directly in other -- kinds of nodes, e.g. the Etype field, used to indicate the type of an --- expression. The access functions to these fields are defined in the --- Sinfo package, but their full documentation is to be found in --- the Einfo package specification. +-- expression. These fields are defined in the Sinfo package, but their +-- full documentation is in the Einfo package specification. -- Declaration processing places information in the nodes of their defining -- identifiers. Name resolution places in all other occurrences of an -- identifier a pointer to the corresponding defining occurrence. --------------------------------- --- The XEINFO Utility Program -- --------------------------------- - --- XEINFO is a utility program which automatically produces a C header file, --- einfo.h from the spec and body of package Einfo. It reads the input files --- einfo.ads and einfo.adb and produces the output file einfo.h. XEINFO is run --- automatically by the build scripts when you do a full bootstrap. - --- In order for this utility program to operate correctly, the form of the --- einfo.ads and einfo.adb files must meet certain requirements and be laid --- out in a specific manner. - --- The general form of einfo.ads is as follows: - --- type declaration for type Entity_Kind --- subtype declarations declaring subranges of Entity_Kind --- subtype declarations declaring synonyms for some standard types --- function specs for attributes --- procedure specs --- pragma Inline declarations - --- This order must be observed. There are no restrictions on the procedures, --- since the C header file only includes functions (The back end is not --- allowed to modify the generated tree). However, functions are required to --- have headers that fit on a single line. - --- XEINFO reads and processes the function specs and the pragma Inlines. For --- functions that are declared as inlined, XEINFO reads the corresponding body --- from einfo.adb, and processes it into C code. This results in some strict --- restrictions on which functions can be inlined: - --- The function spec must be on a single line - --- There can only be a single return statement, not counting any pragma --- Assert statements, possibly followed by a comment. - --- This single statement must either contain a function call with simple, --- single token arguments, or it must contain a membership test of the form --- a in b, where a and b are single tokens, or it must contain an equality --- or inequality test of single tokens, or it must contain a disjunction of --- the preceding constructs. - --- For functions that are not inlined, there is no restriction on the body, --- and XEINFO generates a direct reference in the C header file which allows --- the C code in the backend to directly call the corresponding Ada body. - ---------------------------------- -- Handling of Type'Size Values -- ---------------------------------- diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 5314837..f6bd342 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -6652,7 +6652,7 @@ package body Exp_Aggr is -- aggregate. If the declaration has a subtype mark, use it, -- otherwise use the itype of the aggregate. - Set_Ekind (Tmp, E_Variable); + Mutate_Ekind (Tmp, E_Variable); if not Is_Constrained (Typ) then Build_Constrained_Type (Positional => False); @@ -9476,7 +9476,7 @@ package body Exp_Aggr is -- type Res_Typ is access all Comp_Typ; Res_Typ := Make_Temporary (Loc, 'A'); - Set_Ekind (Res_Typ, E_General_Access_Type); + Mutate_Ekind (Res_Typ, E_General_Access_Type); Set_Directly_Designated_Type (Res_Typ, Comp_Typ); Add_Item @@ -9496,7 +9496,7 @@ package body Exp_Aggr is -- its lifetime is bounded by the current array or record component. Res_Id := Make_Temporary (Loc, 'R'); - Set_Ekind (Res_Id, E_Constant); + Mutate_Ekind (Res_Id, E_Constant); Set_Etype (Res_Id, Res_Typ); -- Mark the transient object as successfully processed to avoid double diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 9aecf6d..da9d61a 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -389,7 +389,7 @@ package body Exp_Attr is -- Stmts -- end Func_Id; - Set_Ekind (Func_Id, E_Function); + Mutate_Ekind (Func_Id, E_Function); Set_Is_Internal (Func_Id); Set_Is_Pure (Func_Id); @@ -832,7 +832,7 @@ package body Exp_Attr is -- Stmts -- end Func_Id; - Set_Ekind (Func_Id, E_Function); + Mutate_Ekind (Func_Id, E_Function); Set_Is_Internal (Func_Id); Set_Is_Pure (Func_Id); @@ -4838,7 +4838,7 @@ package body Exp_Attr is -- Set the entity kind now in order to mark the temporary as a -- handler of attribute 'Old's prefix. - Set_Ekind (Temp, E_Constant); + Mutate_Ekind (Temp, E_Constant); Set_Stores_Attribute_Old_Prefix (Temp); -- Push the scope of the related subprogram where _Postcondition diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb index 7c24da1..529eae4 100644 --- a/gcc/ada/exp_ch11.adb +++ b/gcc/ada/exp_ch11.adb @@ -1701,7 +1701,7 @@ package body Exp_Ch11 is if No (Choice_Parameter (Ehand)) then E := Make_Temporary (Loc, 'E'); Set_Choice_Parameter (Ehand, E); - Set_Ekind (E, E_Variable); + Mutate_Ekind (E, E_Variable); Set_Etype (E, RTE (RE_Exception_Occurrence)); Set_Scope (E, Current_Scope); end if; diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 6843069..d0446ff0 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -885,7 +885,7 @@ package body Exp_Ch3 is Make_Handled_Sequence_Of_Statements (Loc, Statements => Body_Stmts))); - Set_Ekind (Proc_Id, E_Procedure); + Mutate_Ekind (Proc_Id, E_Procedure); Set_Is_Public (Proc_Id, Is_Public (A_Type)); Set_Is_Internal (Proc_Id); Set_Has_Completion (Proc_Id); @@ -1080,7 +1080,7 @@ package body Exp_Ch3 is Statements => New_List ( Build_Case_Statement (Case_Id, Variant)))); - Set_Ekind (Func_Id, E_Function); + Mutate_Ekind (Func_Id, E_Function); Set_Mechanism (Func_Id, Default_Mechanism); Set_Is_Inlined (Func_Id, True); Set_Is_Pure (Func_Id, True); @@ -2376,7 +2376,7 @@ package body Exp_Ch3 is New_Occurrence_Of (Iface_Comp, Loc)), Attribute_Name => Name_Position)))))); - Set_Ekind (Func_Id, E_Function); + Mutate_Ekind (Func_Id, E_Function); Set_Mechanism (Func_Id, Default_Mechanism); Set_Is_Internal (Func_Id, True); @@ -2491,7 +2491,7 @@ package body Exp_Ch3 is Make_Defining_Identifier (Loc, Chars => Make_TSS_Name (Rec_Type, TSS_CPP_Init_Proc)); - Set_Ekind (Proc_Id, E_Procedure); + Mutate_Ekind (Proc_Id, E_Procedure); Set_Is_Internal (Proc_Id); Set_Defining_Unit_Name (Proc_Spec_Node, Proc_Id); @@ -2545,7 +2545,7 @@ package body Exp_Ch3 is begin Body_Stmts := New_List; Body_Node := New_Node (N_Subprogram_Body, Loc); - Set_Ekind (Proc_Id, E_Procedure); + Mutate_Ekind (Proc_Id, E_Procedure); Proc_Spec_Node := New_Node (N_Procedure_Specification, Loc); Set_Defining_Unit_Name (Proc_Spec_Node, Proc_Id); @@ -7276,10 +7276,10 @@ package body Exp_Ch3 is Link_Entities (New_Id, Next_Entity (Def_Id)); Link_Entities (Def_Id, Next_Temp); - Set_Chars (Defining_Identifier (N), Chars (Def_Id)); + Set_Chars (Defining_Identifier (N), Chars (Def_Id)); Set_Homonym (Defining_Identifier (N), Homonym (Def_Id)); - Set_Ekind (Defining_Identifier (N), Ekind (Def_Id)); - Set_Sloc (Defining_Identifier (N), Sloc (Def_Id)); + Mutate_Ekind (Defining_Identifier (N), Ekind (Def_Id)); + Set_Sloc (Defining_Identifier (N), Sloc (Def_Id)); Set_Comes_From_Source (Def_Id, False); @@ -7536,7 +7536,7 @@ package body Exp_Ch3 is Level_Expr : Node_Id; begin - Set_Ekind (Level, Ekind (Def_Id)); + Mutate_Ekind (Level, Ekind (Def_Id)); Set_Etype (Level, Standard_Natural); Set_Scope (Level, Scope (Def_Id)); @@ -9706,7 +9706,7 @@ package body Exp_Ch3 is -- primitive operations list. We add the minimum decoration needed -- to override interface primitives. - Set_Ekind (Defining_Unit_Name (Func_Spec), E_Function); + Mutate_Ekind (Defining_Unit_Name (Func_Spec), E_Function); Override_Dispatching_Operation (Tag_Typ, Subp, New_Op => Defining_Unit_Name (Func_Spec), diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 9b403af..7a51afd 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -3407,7 +3407,7 @@ package body Exp_Ch5 is Analyze (Init_Decl); Init_Name := Defining_Identifier (Init_Decl); - Set_Ekind (Init_Name, E_Loop_Parameter); + Mutate_Ekind (Init_Name, E_Loop_Parameter); -- The cursor was marked as a loop parameter to prevent user assignments -- to it, however this renders the advancement step illegal as it is not @@ -3483,7 +3483,7 @@ package body Exp_Ch5 is (N, Container, Cursor, Init, Advance, New_Loop); Append_To (Stats, Advance); - Set_Ekind (Cursor, E_Variable); + Mutate_Ekind (Cursor, E_Variable); Insert_Action (N, Init); -- The loop parameter is declared by an object declaration, but within @@ -4484,7 +4484,7 @@ package body Exp_Ch5 is (Container_Typ, Aspect_Variable_Indexing)) or else not Is_Variable (Original_Node (Container)) then - Set_Ekind (Id, E_Constant); + Mutate_Ekind (Id, E_Constant); end if; Prepend_To (Stats, Decl); @@ -4620,7 +4620,7 @@ package body Exp_Ch5 is Set_Assignment_OK (Cursor_Decl); Insert_Action (N, Cursor_Decl); - Set_Ekind (Cursor, Id_Kind); + Mutate_Ekind (Cursor, Id_Kind); end; -- If the range of iteration is given by a function call that returns @@ -5081,7 +5081,7 @@ package body Exp_Ch5 is -- identifier, since there may be references in the loop body. Set_Analyzed (Loop_Id, False); - Set_Ekind (Loop_Id, E_Variable); + Mutate_Ekind (Loop_Id, E_Variable); -- In most loops the loop variable is assigned in various -- alternatives in the body. However, in the rare case when diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 4471f35..ab07224 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -5127,7 +5127,7 @@ package body Exp_Ch6 is -- Perform minor decoration in order to set the master and the -- storage pool attributes. - Set_Ekind (Ptr_Typ, E_Access_Type); + Mutate_Ekind (Ptr_Typ, E_Access_Type); Set_Finalization_Master (Ptr_Typ, Fin_Mas_Id); Set_Associated_Storage_Pool (Ptr_Typ, Pool_Id); @@ -7345,7 +7345,7 @@ package body Exp_Ch6 is Temp : Entity_Id; begin - Set_Ekind (Acc_Typ, E_Access_Type); + Mutate_Ekind (Acc_Typ, E_Access_Type); Set_Associated_Storage_Pool (Acc_Typ, RTE (RE_SS_Pool)); diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 2e06169..f21341a 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -2810,7 +2810,7 @@ package body Exp_Ch7 is -- Perform minor decoration in order to set the master and the -- storage pool attributes. - Set_Ekind (Ptr_Typ, E_Access_Type); + Mutate_Ekind (Ptr_Typ, E_Access_Type); Set_Finalization_Master (Ptr_Typ, Fin_Mas_Id); Set_Associated_Storage_Pool (Ptr_Typ, Pool_Id); diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 8d17db8..a80355f 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -739,9 +739,9 @@ package body Exp_Ch9 is Set_Debug_Info_Needed (New_F); if Ekind (Formal) = E_In_Parameter then - Set_Ekind (New_F, E_Constant); + Mutate_Ekind (New_F, E_Constant); else - Set_Ekind (New_F, E_Variable); + Mutate_Ekind (New_F, E_Variable); Set_Extra_Constrained (New_F, Extra_Constrained (Formal)); end if; @@ -1593,7 +1593,7 @@ package body Exp_Ch9 is begin Set_Corresponding_Record_Type (Ctyp, Rec_Ent); - Set_Ekind (Rec_Ent, E_Record_Type); + Mutate_Ekind (Rec_Ent, E_Record_Type); Set_Has_Delayed_Freeze (Rec_Ent, Has_Delayed_Freeze (Ctyp)); Set_Is_Concurrent_Record_Type (Rec_Ent, True); Set_Corresponding_Concurrent_Type (Rec_Ent, Ctyp); @@ -2453,9 +2453,9 @@ package body Exp_Ch9 is -- Sem_Ch6.Override_Dispatching_Operation. if Ekind (Subp_Id) = E_Function then - Set_Ekind (Wrapper_Id, E_Function); + Mutate_Ekind (Wrapper_Id, E_Function); else - Set_Ekind (Wrapper_Id, E_Procedure); + Mutate_Ekind (Wrapper_Id, E_Procedure); end if; Set_Is_Primitive_Wrapper (Wrapper_Id); @@ -3893,7 +3893,7 @@ package body Exp_Ch9 is if Unprotected then Set_Protected_Formal (Formal, Defining_Identifier (New_Param)); - Set_Ekind (Defining_Identifier (New_Param), Ekind (Formal)); + Mutate_Ekind (Defining_Identifier (New_Param), Ekind (Formal)); end if; Append (New_Param, New_Plist); @@ -3964,14 +3964,14 @@ package body Exp_Ch9 is -- Sem_Ch4.Names_Match). if Mode = Dispatching_Mode then - Set_Ekind (New_Id, Ekind (Def_Id)); + Mutate_Ekind (New_Id, Ekind (Def_Id)); Set_Original_Protected_Subprogram (New_Id, Def_Id); end if; -- Link the protected or unprotected version to the original subprogram -- it emulates. - Set_Ekind (New_Id, Ekind (Def_Id)); + Mutate_Ekind (New_Id, Ekind (Def_Id)); Set_Protected_Subprogram (New_Id, Def_Id); -- The unprotected operation carries the user code, and debugging @@ -6007,9 +6007,9 @@ package body Exp_Ch9 is Set_Debug_Info_Needed (New_F); if Ekind (Formal) = E_In_Parameter then - Set_Ekind (New_F, E_Constant); + Mutate_Ekind (New_F, E_Constant); else - Set_Ekind (New_F, E_Variable); + Mutate_Ekind (New_F, E_Variable); Set_Extra_Constrained (New_F, Extra_Constrained (Formal)); end if; @@ -6693,7 +6693,7 @@ package body Exp_Ch9 is -- statement if any to initialize the declarations of the block. Blkent := Make_Temporary (Loc, 'A'); - Set_Ekind (Blkent, E_Block); + Mutate_Ekind (Blkent, E_Block); Set_Etype (Blkent, Standard_Void_Type); Set_Scope (Blkent, Current_Scope); @@ -10885,7 +10885,7 @@ package body Exp_Ch9 is -- Link the acceptor to the original receiving entry - Set_Ekind (PB_Ent, E_Procedure); + Mutate_Ekind (PB_Ent, E_Procedure); Set_Receiving_Entry (PB_Ent, Eent); if Comes_From_Source (Alt) then @@ -13820,9 +13820,9 @@ package body Exp_Ch9 is -- Minimal decoration if Ekind (Spec_Id) = E_Function then - Set_Ekind (Decl_Id, E_Constant); + Mutate_Ekind (Decl_Id, E_Constant); else - Set_Ekind (Decl_Id, E_Variable); + Mutate_Ekind (Decl_Id, E_Variable); end if; Set_Prival (Comp_Id, Decl_Id); @@ -13872,7 +13872,7 @@ package body Exp_Ch9 is begin -- Minimal decoration - Set_Ekind (Index_Con, E_Constant); + Mutate_Ekind (Index_Con, E_Constant); Set_Entry_Index_Constant (Index, Index_Con); Set_Discriminal_Link (Index_Con, Index); @@ -15144,7 +15144,7 @@ package body Exp_Ch9 is Make_Defining_Identifier (Sloc (D), Chars => New_External_Name (Chars (D), 'D')); - Set_Ekind (D_Minal, E_Constant); + Mutate_Ekind (D_Minal, E_Constant); Set_Etype (D_Minal, Etype (D)); Set_Scope (D_Minal, Pdef); Set_Discriminal (D, D_Minal); diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index d7102f6..f41eaf4 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -2247,7 +2247,7 @@ package body Exp_Disp is -- with GNATcoverage, as that tool relies on it to identify -- thunks and exclude them from source coverage analysis. - Set_Ekind (Thunk_Id, Ekind (Prim)); + Mutate_Ekind (Thunk_Id, Ekind (Prim)); Set_Is_Thunk (Thunk_Id); Set_Convention (Thunk_Id, Convention (Prim)); Set_Needs_Debug_Info (Thunk_Id, Needs_Debug_Info (Target)); @@ -4150,18 +4150,18 @@ package body Exp_Disp is -- dispatch tables. if not Building_Static_DT (Typ) then - Set_Ekind (Predef_Prims, E_Variable); - Set_Ekind (Iface_DT, E_Variable); + Mutate_Ekind (Predef_Prims, E_Variable); + Mutate_Ekind (Iface_DT, E_Variable); -- Statically allocated dispatch tables and related entities are -- constants. else - Set_Ekind (Predef_Prims, E_Constant); + Mutate_Ekind (Predef_Prims, E_Constant); Set_Is_Statically_Allocated (Predef_Prims); Set_Is_True_Constant (Predef_Prims); - Set_Ekind (Iface_DT, E_Constant); + Mutate_Ekind (Iface_DT, E_Constant); Set_Is_Statically_Allocated (Iface_DT); Set_Is_True_Constant (Iface_DT); end if; @@ -4898,7 +4898,7 @@ package body Exp_Disp is -- objects by making them volatile. Set_Is_Imported (Dummy_Object); - Set_Ekind (Dummy_Object, E_Constant); + Mutate_Ekind (Dummy_Object, E_Constant); Set_Is_True_Constant (Dummy_Object); Set_Related_Type (Dummy_Object, Typ); @@ -6898,7 +6898,7 @@ package body Exp_Disp is begin Set_Is_Imported (DT); - Set_Ekind (DT, E_Constant); + Mutate_Ekind (DT, E_Constant); Set_Related_Type (DT, Typ); -- The scope must be set now to call Get_External_Name @@ -7009,7 +7009,7 @@ package body Exp_Disp is -- Minimum decoration - Set_Ekind (DT_Ptr, E_Variable); + Mutate_Ekind (DT_Ptr, E_Variable); Set_Related_Type (DT_Ptr, Typ); -- Notify back end that the types are associated with a dispatch table @@ -7163,7 +7163,7 @@ package body Exp_Disp is Make_Defining_Identifier (Loc, Chars => New_External_Name (Typ_Name, 'P')); Set_Etype (Iface_DT_Ptr, RTE (RE_Interface_Tag)); - Set_Ekind (Iface_DT_Ptr, E_Variable); + Mutate_Ekind (Iface_DT_Ptr, E_Variable); Set_Is_Tag (Iface_DT_Ptr); Set_Has_Thunks (Iface_DT_Ptr); @@ -7212,7 +7212,7 @@ package body Exp_Disp is Make_Defining_Identifier (Loc, Chars => New_External_Name (Typ_Name, 'P')); Set_Etype (Iface_DT_Ptr, RTE (RE_Interface_Tag)); - Set_Ekind (Iface_DT_Ptr, E_Constant); + Mutate_Ekind (Iface_DT_Ptr, E_Constant); Set_Is_Tag (Iface_DT_Ptr); Set_Has_Thunks (Iface_DT_Ptr); Set_Is_Statically_Allocated (Iface_DT_Ptr, @@ -7250,7 +7250,7 @@ package body Exp_Disp is Make_Defining_Identifier (Loc, Chars => New_External_Name (Typ_Name, 'Y')); Set_Etype (Iface_DT_Ptr, RTE (RE_Address)); - Set_Ekind (Iface_DT_Ptr, E_Constant); + Mutate_Ekind (Iface_DT_Ptr, E_Constant); Set_Is_Tag (Iface_DT_Ptr); Set_Has_Thunks (Iface_DT_Ptr); Set_Is_Statically_Allocated (Iface_DT_Ptr, @@ -7267,7 +7267,7 @@ package body Exp_Disp is Make_Defining_Identifier (Loc, Chars => New_External_Name (Typ_Name, 'D')); Set_Etype (Iface_DT_Ptr, RTE (RE_Interface_Tag)); - Set_Ekind (Iface_DT_Ptr, E_Constant); + Mutate_Ekind (Iface_DT_Ptr, E_Constant); Set_Is_Tag (Iface_DT_Ptr); Set_Is_Statically_Allocated (Iface_DT_Ptr, Is_Library_Level_Tagged_Type (Typ)); @@ -7282,7 +7282,7 @@ package body Exp_Disp is Make_Defining_Identifier (Loc, Chars => New_External_Name (Typ_Name, 'Z')); Set_Etype (Iface_DT_Ptr, RTE (RE_Address)); - Set_Ekind (Iface_DT_Ptr, E_Constant); + Mutate_Ekind (Iface_DT_Ptr, E_Constant); Set_Is_Tag (Iface_DT_Ptr); Set_Is_Statically_Allocated (Iface_DT_Ptr, Is_Library_Level_Tagged_Type (Typ)); @@ -7392,9 +7392,9 @@ package body Exp_Disp is end if; if Is_CPP_Class (Root_Type (Typ)) then - Set_Ekind (DT_Ptr, E_Variable); + Mutate_Ekind (DT_Ptr, E_Variable); else - Set_Ekind (DT_Ptr, E_Constant); + Mutate_Ekind (DT_Ptr, E_Constant); end if; Set_Is_Tag (DT_Ptr); diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb index 1d1cd4c..6af66f3 100644 --- a/gcc/ada/exp_dist.adb +++ b/gcc/ada/exp_dist.adb @@ -1732,7 +1732,7 @@ package body Exp_Dist is New_Occurrence_Of ( Entity (Result_Definition (Spec)), Loc)); - Set_Ekind (Proc, E_Function); + Mutate_Ekind (Proc, E_Function); Set_Etype (Proc, New_Occurrence_Of (Entity (Result_Definition (Spec)), Loc)); @@ -1742,7 +1742,7 @@ package body Exp_Dist is Defining_Unit_Name => Proc, Parameter_Specifications => Param_Specs); - Set_Ekind (Proc, E_Procedure); + Mutate_Ekind (Proc, E_Procedure); Set_Etype (Proc, Standard_Void_Type); end if; @@ -1979,7 +1979,7 @@ package body Exp_Dist is Existing := False; Stub_Type := Make_Temporary (Loc, 'S'); - Set_Ekind (Stub_Type, E_Record_Type); + Mutate_Ekind (Stub_Type, E_Record_Type); Set_Is_RACW_Stub_Type (Stub_Type); Stub_Type_Access := Make_Defining_Identifier (Loc, @@ -2169,7 +2169,7 @@ package body Exp_Dist is Object_Definition => New_Occurrence_Of (Defining_Identifier (Last (Decls)), Loc))); - Set_Ekind (Object, E_Variable); + Mutate_Ekind (Object, E_Variable); -- Suppress default initialization: -- pragma Import (Ada, Object); @@ -2213,9 +2213,9 @@ package body Exp_Dist is Expression => Expr)); if Constant_Present (Last (Decls)) then - Set_Ekind (Object, E_Constant); + Mutate_Ekind (Object, E_Constant); else - Set_Ekind (Object, E_Variable); + Mutate_Ekind (Object, E_Variable); end if; end if; end Build_Actual_Object_Declaration; @@ -3727,7 +3727,7 @@ package body Exp_Dist is -- Set the kind and return type of the function to prevent -- ambiguities between Ras_Type and Fat_Type in subsequent analysis. - Set_Ekind (Proc, E_Function); + Mutate_Ekind (Proc, E_Function); Set_Etype (Proc, Fat_Type); Discard_Node ( @@ -6472,7 +6472,7 @@ package body Exp_Dist is -- Set the kind and return type of the function to prevent -- ambiguities between Ras_Type and Fat_Type in subsequent analysis. - Set_Ekind (Proc, E_Function); + Mutate_Ekind (Proc, E_Function); Set_Etype (Proc, Fat_Type); Discard_Node ( @@ -11348,10 +11348,10 @@ package body Exp_Dist is begin if Nkind (Spec) = N_Function_Specification then - Set_Ekind (Snam, E_Function); + Mutate_Ekind (Snam, E_Function); Set_Etype (Snam, Entity (Result_Definition (Spec))); else - Set_Ekind (Snam, E_Procedure); + Mutate_Ekind (Snam, E_Procedure); Set_Etype (Snam, Standard_Void_Type); end if; diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb index b7ae3cd..4e5e1b6 100644 --- a/gcc/ada/exp_imgv.adb +++ b/gcc/ada/exp_imgv.adb @@ -260,7 +260,7 @@ package body Exp_Imgv is H_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (E), 'H')); - Set_Ekind (H_Id, E_Function); + Mutate_Ekind (H_Id, E_Function); Set_Is_Internal (H_Id); if not Debug_Generated_Code then diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb index 66f3f2c..0cfe258 100644 --- a/gcc/ada/exp_intr.adb +++ b/gcc/ada/exp_intr.adb @@ -521,7 +521,7 @@ package body Exp_Intr is if No (Choice_Parameter (P)) then E := Make_Temporary (Loc, 'E'); Set_Choice_Parameter (P, E); - Set_Ekind (E, E_Variable); + Mutate_Ekind (E, E_Variable); Set_Etype (E, RTE (RE_Exception_Occurrence)); Set_Scope (E, Current_Scope); end if; diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index e503f6d..d7c301d 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -1570,7 +1570,7 @@ package body Exp_Prag is -- effects). Assign prefix value to temp on Eval_Statement -- list, so assignment will be executed conditionally. - Set_Ekind (Temp, E_Variable); + Mutate_Ekind (Temp, E_Variable); Set_Suppress_Initialization (Temp); Analyze (Decl); @@ -2272,7 +2272,7 @@ package body Exp_Prag is Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (Pack_Id), "Initial_Condition")); - Set_Ekind (Proc_Id, E_Procedure); + Mutate_Ekind (Proc_Id, E_Procedure); Set_Is_Initial_Condition_Procedure (Proc_Id); -- Generate: diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index f19a591..6e5d74e 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -191,7 +191,7 @@ package body Exp_Unst is begin Typ := Make_Temporary (Loc, 'S'); - Set_Ekind (Typ, E_General_Access_Type); + Mutate_Ekind (Typ, E_General_Access_Type); Set_Etype (Typ, Typ); Set_Scope (Typ, Scop); Set_Directly_Designated_Type (Typ, Etype (E)); @@ -1792,7 +1792,7 @@ package body Exp_Unst is -- Decorate the new formal entity Set_Scope (Form, STJ.Ent); - Set_Ekind (Form, E_In_Parameter); + Mutate_Ekind (Form, E_In_Parameter); Set_Etype (Form, STJE.ARECnPT); Set_Mechanism (Form, By_Copy); Set_Never_Set_In_Source (Form, True); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 8137afb..38eadef 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -2190,7 +2190,7 @@ package body Exp_Util is -- Perform minor decoration in case the body is not analyzed - Set_Ekind (Proc_Body_Id, E_Subprogram_Body); + Mutate_Ekind (Proc_Body_Id, E_Subprogram_Body); Set_Etype (Proc_Body_Id, Standard_Void_Type); Set_Scope (Proc_Body_Id, Current_Scope); Set_SPARK_Pragma (Proc_Body_Id, SPARK_Pragma (Proc_Id)); @@ -2357,7 +2357,7 @@ package body Exp_Util is -- Perform minor decoration in case the declaration is not analyzed - Set_Ekind (Proc_Id, E_Procedure); + Mutate_Ekind (Proc_Id, E_Procedure); Set_Etype (Proc_Id, Standard_Void_Type); Set_Is_DIC_Procedure (Proc_Id); Set_Scope (Proc_Id, Current_Scope); @@ -2409,7 +2409,7 @@ package body Exp_Util is -- Perform minor decoration in case the declaration is not analyzed - Set_Ekind (Obj_Id, E_In_Parameter); + Mutate_Ekind (Obj_Id, E_In_Parameter); Set_Etype (Obj_Id, Work_Typ); Set_Scope (Obj_Id, Proc_Id); @@ -3679,7 +3679,7 @@ package body Exp_Util is -- Perform minor decoration in case the body is not analyzed - Set_Ekind (Proc_Body_Id, E_Subprogram_Body); + Mutate_Ekind (Proc_Body_Id, E_Subprogram_Body); Set_Etype (Proc_Body_Id, Standard_Void_Type); Set_Scope (Proc_Body_Id, Current_Scope); @@ -3817,7 +3817,7 @@ package body Exp_Util is -- Perform minor decoration in case the declaration is not analyzed - Set_Ekind (Proc_Id, E_Procedure); + Mutate_Ekind (Proc_Id, E_Procedure); Set_Etype (Proc_Id, Standard_Void_Type); Set_Scope (Proc_Id, Current_Scope); @@ -3903,7 +3903,7 @@ package body Exp_Util is -- Perform minor decoration in case the declaration is not analyzed - Set_Ekind (Obj_Id, E_In_Parameter); + Mutate_Ekind (Obj_Id, E_In_Parameter); Set_Etype (Obj_Id, Obj_Typ); Set_Scope (Obj_Id, Proc_Id); @@ -4707,7 +4707,7 @@ package body Exp_Util is -- type Ptr_Typ is access all Desig_Typ; Ptr_Typ := Make_Temporary (Loc, 'A'); - Set_Ekind (Ptr_Typ, E_General_Access_Type); + Mutate_Ekind (Ptr_Typ, E_General_Access_Type); Set_Directly_Designated_Type (Ptr_Typ, Desig_Typ); Ptr_Decl := @@ -4724,7 +4724,7 @@ package body Exp_Util is -- Hook : Ptr_Typ := null; Hook_Id := Make_Temporary (Loc, 'T'); - Set_Ekind (Hook_Id, E_Variable); + Mutate_Ekind (Hook_Id, E_Variable); Set_Etype (Hook_Id, Ptr_Typ); Hook_Decl := @@ -9495,7 +9495,7 @@ package body Exp_Util is -- end Equiv_T; Equiv_Type := Make_Temporary (Loc, 'T'); - Set_Ekind (Equiv_Type, E_Record_Type); + Mutate_Ekind (Equiv_Type, E_Record_Type); Set_Parent_Subtype (Equiv_Type, Constr_Root); -- Set Is_Class_Wide_Equivalent_Type very early to trigger the special @@ -9987,7 +9987,7 @@ package body Exp_Util is -- Define the dummy private subtype - Set_Ekind (Priv_Subtyp, Subtype_Kind (Ekind (Unc_Typ))); + Mutate_Ekind (Priv_Subtyp, Subtype_Kind (Ekind (Unc_Typ))); Set_Etype (Priv_Subtyp, Base_Type (Unc_Typ)); Set_Scope (Priv_Subtyp, Full_Subtyp); Set_Is_Constrained (Priv_Subtyp); @@ -10913,7 +10913,7 @@ package body Exp_Util is Set_Associated_Node_For_Itype (Res, N); Set_Comes_From_Source (Res, False); - Set_Ekind (Res, E_Class_Wide_Subtype); + Mutate_Ekind (Res, E_Class_Wide_Subtype); Set_Etype (Res, Base_Type (CW_Typ)); Set_Freeze_Node (Res, Empty); Set_Is_Frozen (Res, False); diff --git a/gcc/ada/gen_il-gen.adb b/gcc/ada/gen_il-gen.adb index 137338c..5b2a17b 100644 --- a/gcc/ada/gen_il-gen.adb +++ b/gcc/ada/gen_il-gen.adb @@ -1322,8 +1322,8 @@ package body Gen_IL.Gen is Put_Getter_Decl (S, Ekind); Put (S, "function K (N : Entity_Id) return Entity_Kind renames Ekind;\n"); Put (S, "-- Shorthand for use in predicates and preconditions below\n"); - Put (S, "-- ????There is no procedure Set_Ekind here.\n"); - Put (S, "-- See Atree.\n\n"); + Put (S, "-- There is no procedure Set_Ekind here.\n"); + Put (S, "-- See Mutate_Ekind in Atree.\n\n"); when others => raise Program_Error; end case; diff --git a/gcc/ada/gen_il-gen.ads b/gcc/ada/gen_il-gen.ads index 13f8c59..2319086 100644 --- a/gcc/ada/gen_il-gen.ads +++ b/gcc/ada/gen_il-gen.ads @@ -143,14 +143,24 @@ package Gen_IL.Gen is -- (The matching Default_Value requirement is a simplification from the -- earlier hand-written version.) + -- When adding new node or entity kinds, or adding new fields, all back + -- ends must be made aware of the changes. In addition, the documentation + -- in Sinfo or Einfo needs to be updated. + -- To add a new node or entity type, add it to the enumeration type in -- Gen_IL.Types, taking care that it is in the approprate range -- (Abstract_Node, Abstract_Entity, Concrete_Node, or Concrete_Entity). -- Then add a call to one of the above type-creation procedures to - -- Sinfo.Nodes or Einfo.Entities. + -- Gen_IL.Gen.Gen_Nodes or Gen_IL.Gen.Gen_Entities. + -- + -- To add a new field to a type, add it to the enumeration type in + -- Gen_IL.Fields in the appropriate range. Then add a call to one of + -- the above field-creation procedures to Gen_IL.Gen.Gen_Nodes or + -- Gen_IL.Gen.Gen_Entities. -- - -- To add a new field to a type, add a call to one of the above field - -- creation procedures to Sinfo.Nodes or Einfo.Entities. + -- If a type or field name does not follow the usual Mixed_Case convention, + -- such as "SPARK_Pragma", then you have to add a special case to one of + -- the Image functions in Gen_IL.Utils. -- Forward references are not allowed. So if you say: -- diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 4bd7ea1..1c50787 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -1473,7 +1473,7 @@ package body Inline is end if; Set_Body_To_Inline (Decl, Original_Body); - Set_Ekind (Defining_Entity (Original_Body), Ekind (Spec_Id)); + Mutate_Ekind (Defining_Entity (Original_Body), Ekind (Spec_Id)); Set_Is_Inlined (Spec_Id); end Build_Body_To_Inline; @@ -2251,7 +2251,7 @@ package body Inline is pragma Assert (No (Body_To_Inline (Decl))); Set_Body_To_Inline (Decl, Original_Body); - Set_Ekind (Defining_Entity (Original_Body), Ekind (Spec_Id)); + Mutate_Ekind (Defining_Entity (Original_Body), Ekind (Spec_Id)); end Build_Body_To_Inline; -------------------------------- diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb index 38c9fd6..2f0b0ff 100644 --- a/gcc/ada/lib-writ.adb +++ b/gcc/ada/lib-writ.adb @@ -207,7 +207,7 @@ package body Lib.Writ is Style_Check := False; Initialize_Scanner (Units.Last, System_Source_File_Index); Discard_List (Par (Configuration_Pragmas => False)); - Set_Ekind (Cunit_Entity (Units.Last), E_Package); + Mutate_Ekind (Cunit_Entity (Units.Last), E_Package); Set_Scope (Cunit_Entity (Units.Last), Standard_Standard); Style_Check := Save_Style; Multiple_Unit_Index := Save_Mindex; diff --git a/gcc/ada/lib-xref-spark_specific.adb b/gcc/ada/lib-xref-spark_specific.adb index a56e005..fc05e16 100644 --- a/gcc/ada/lib-xref-spark_specific.adb +++ b/gcc/ada/lib-xref-spark_specific.adb @@ -296,7 +296,7 @@ package body SPARK_Specific is (Standard_Location, Name_Enter (Name_Of_Heap_Variable)); - Set_Ekind (Heap, E_Variable); + Mutate_Ekind (Heap, E_Variable); Set_Is_Internal (Heap, True); Set_Etype (Heap, Standard_Void_Type); Set_Scope (Heap, Standard_Standard); diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 123f9db..4fbaee7 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1681,7 +1681,7 @@ package body Sem_Aggr is Enter_Name (Id); Set_Etype (Id, Index_Typ); - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); Set_Scope (Id, Ent); -- Analyze expression without expansion, to verify legality. @@ -2863,7 +2863,7 @@ package body Sem_Aggr is Set_Etype (Id, Key_Type); end if; - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); Set_Scope (Id, Ent); Set_Referenced (Id); @@ -3203,7 +3203,7 @@ package body Sem_Aggr is if No (Scope (Id)) then Set_Etype (Id, Index_Type); - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); Set_Scope (Id, Ent); end if; Enter_Name (Id); diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index c1b9253..ccfecf4b 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -1647,7 +1647,7 @@ package body Sem_Ch10 is -- when we load the proper body. Set_Scope (Id, Current_Scope); - Set_Ekind (Id, E_Package_Body); + Mutate_Ekind (Id, E_Package_Body); Set_Etype (Id, Standard_Void_Type); if Has_Aspects (N) then @@ -1989,7 +1989,7 @@ package body Sem_Ch10 is Opts := Save_Config_Switches; Set_Scope (Id, Current_Scope); - Set_Ekind (Id, E_Protected_Body); + Mutate_Ekind (Id, E_Protected_Body); Set_Etype (Id, Standard_Void_Type); if Has_Aspects (N) then @@ -2500,7 +2500,7 @@ package body Sem_Ch10 is else Set_Scope (Id, Current_Scope); - Set_Ekind (Id, E_Task_Body); + Mutate_Ekind (Id, E_Task_Body); Set_Etype (Id, Standard_Void_Type); if Has_Aspects (N) then @@ -4120,7 +4120,8 @@ package body Sem_Ch10 is Set_Subtype_Indication (Decl, New_Occurrence_Of (Non_Lim_View, Sloc (Def_Id))); Set_Etype (Def_Id, Non_Lim_View); - Set_Ekind (Def_Id, Subtype_Kind (Ekind (Non_Lim_View))); + Mutate_Ekind + (Def_Id, Subtype_Kind (Ekind (Non_Lim_View))); Set_Analyzed (Decl, False); -- Reanalyze the declaration, suppressing the call to @@ -4986,7 +4987,7 @@ package body Sem_Ch10 is -- Minimum decoration - Set_Ekind (P, E_Package); + Mutate_Ekind (P, E_Package); Set_Etype (P, Standard_Void_Type); Set_Scope (P, Standard_Standard); Set_Is_Visible_Lib_Unit (P); @@ -5738,9 +5739,9 @@ package body Sem_Ch10 is -- The abstract view of a variable is a state, not another variable if Ekind (Ent) = E_Variable then - Set_Ekind (Shadow, E_Abstract_State); + Mutate_Ekind (Shadow, E_Abstract_State); else - Set_Ekind (Shadow, Ekind (Ent)); + Mutate_Ekind (Shadow, Ekind (Ent)); end if; Set_Is_Internal (Shadow); @@ -5785,7 +5786,7 @@ package body Sem_Ch10 is procedure Decorate_Package (Ent : Entity_Id; Scop : Entity_Id) is begin - Set_Ekind (Ent, E_Package); + Mutate_Ekind (Ent, E_Package); Set_Etype (Ent, Standard_Void_Type); Set_Scope (Ent, Scop); end Decorate_Package; @@ -5796,7 +5797,7 @@ package body Sem_Ch10 is procedure Decorate_State (Ent : Entity_Id; Scop : Entity_Id) is begin - Set_Ekind (Ent, E_Abstract_State); + Mutate_Ekind (Ent, E_Abstract_State); Set_Etype (Ent, Standard_Void_Type); Set_Scope (Ent, Scop); Set_Encapsulating_State (Ent, Empty); @@ -5818,7 +5819,7 @@ package body Sem_Ch10 is -- An unanalyzed type or a shadow entity of a type is treated as an -- incomplete type, and carries the corresponding attributes. - Set_Ekind (Ent, E_Incomplete_Type); + Mutate_Ekind (Ent, E_Incomplete_Type); Set_Etype (Ent, Ent); Set_Full_View (Ent, Empty); Set_Is_First_Subtype (Ent); @@ -5854,7 +5855,7 @@ package body Sem_Ch10 is Set_Parent (CW_Typ, Parent (Ent)); - Set_Ekind (CW_Typ, E_Class_Wide_Type); + Mutate_Ekind (CW_Typ, E_Class_Wide_Type); Set_Class_Wide_Type (CW_Typ, CW_Typ); Set_Etype (CW_Typ, Ent); Set_Equivalent_Type (CW_Typ, Empty); @@ -5874,7 +5875,7 @@ package body Sem_Ch10 is procedure Decorate_Variable (Ent : Entity_Id; Scop : Entity_Id) is begin - Set_Ekind (Ent, E_Variable); + Mutate_Ekind (Ent, E_Variable); Set_Etype (Ent, Standard_Void_Type); Set_Scope (Ent, Scop); end Decorate_Variable; @@ -6229,7 +6230,7 @@ package body Sem_Ch10 is -- must be minimally decorated. This ensures that the checks on unused -- with clauses also process limieted withs. - Set_Ekind (Pack, E_Package); + Mutate_Ekind (Pack, E_Package); Set_Etype (Pack, Standard_Void_Type); if Is_Entity_Name (Nam) then @@ -6251,7 +6252,7 @@ package body Sem_Ch10 is -- incomplete view of all types and packages declared within. Shadow_Pack := Make_Temporary (Sloc (N), 'Z'); - Set_Ekind (Shadow_Pack, E_Package); + Mutate_Ekind (Shadow_Pack, E_Package); Set_Is_Internal (Shadow_Pack); Set_Limited_View (Pack, Shadow_Pack); diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb index c250ed2..aea32c1 100644 --- a/gcc/ada/sem_ch11.adb +++ b/gcc/ada/sem_ch11.adb @@ -65,7 +65,7 @@ package body Sem_Ch11 is begin Generate_Definition (Id); Enter_Name (Id); - Set_Ekind (Id, E_Exception); + Mutate_Ekind (Id, E_Exception); Set_Etype (Id, Standard_Exception_Type); Set_Is_Statically_Allocated (Id); Set_Is_Pure (Id, PF); @@ -233,7 +233,7 @@ package body Sem_Ch11 is Set_Etype (H_Scope, Standard_Void_Type); Enter_Name (Choice); - Set_Ekind (Choice, E_Variable); + Mutate_Ekind (Choice, E_Variable); if RTE_Available (RE_Exception_Occurrence) then Set_Etype (Choice, RTE (RE_Exception_Occurrence)); diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 5303fb0..12e25b9 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -2351,7 +2351,7 @@ package body Sem_Ch12 is Set_Is_Generic_Type (Base); Set_Parent (Base, Parent (Def)); - Set_Ekind (T, E_Decimal_Fixed_Point_Subtype); + Mutate_Ekind (T, E_Decimal_Fixed_Point_Subtype); Set_Etype (T, Base); Set_Size_Info (T, Int_Base); Set_RM_Size (T, RM_Size (Int_Base)); @@ -2473,7 +2473,7 @@ package body Sem_Ch12 is begin Enter_Name (T); - Set_Ekind (T, E_Enumeration_Subtype); + Mutate_Ekind (T, E_Enumeration_Subtype); Set_Etype (T, Base); Init_Size (T, 8); Init_Alignment (T); @@ -2502,7 +2502,7 @@ package body Sem_Ch12 is Low_Bound => Lo, High_Bound => Hi)); - Set_Ekind (Base, E_Enumeration_Type); + Mutate_Ekind (Base, E_Enumeration_Type); Set_Etype (Base, Base); Init_Size (Base, 8); Init_Alignment (Base); @@ -2528,7 +2528,7 @@ package body Sem_Ch12 is -- the generic itself. Enter_Name (T); - Set_Ekind (T, E_Floating_Point_Subtype); + Mutate_Ekind (T, E_Floating_Point_Subtype); Set_Etype (T, Base); Set_Size_Info (T, (Standard_Float)); Set_RM_Size (T, RM_Size (Standard_Float)); @@ -2580,8 +2580,8 @@ package body Sem_Ch12 is -- signed integer types, and have the same attributes. Analyze_Formal_Signed_Integer_Type (T, Def); - Set_Ekind (T, E_Modular_Integer_Subtype); - Set_Ekind (Etype (T), E_Modular_Integer_Type); + Mutate_Ekind (T, E_Modular_Integer_Subtype); + Mutate_Ekind (Etype (T), E_Modular_Integer_Type); end Analyze_Formal_Modular_Type; @@ -2678,7 +2678,7 @@ package body Sem_Ch12 is end if; end if; - Set_Ekind (Id, K); + Mutate_Ekind (Id, K); Set_Etype (Id, T); -- Case of generic IN OUT parameter @@ -2688,7 +2688,7 @@ package body Sem_Ch12 is -- subtype, as is done for subprogram formals. In this fashion, all -- its uses can refer to specific bounds. - Set_Ekind (Id, K); + Mutate_Ekind (Id, K); Set_Etype (Id, T); if (Is_Array_Type (T) and then not Is_Constrained (T)) @@ -2741,7 +2741,7 @@ package body Sem_Ch12 is -- will never be used, since all properties of the type are non-static. Enter_Name (T); - Set_Ekind (T, E_Ordinary_Fixed_Point_Subtype); + Mutate_Ekind (T, E_Ordinary_Fixed_Point_Subtype); Set_Etype (T, Base); Set_Size_Info (T, Standard_Integer); Set_RM_Size (T, RM_Size (Standard_Integer)); @@ -3017,8 +3017,8 @@ package body Sem_Ch12 is exception when Instantiation_Error => Enter_Name (Formal); - Set_Ekind (Formal, E_Variable); - Set_Etype (Formal, Any_Type); + Mutate_Ekind (Formal, E_Variable); + Set_Etype (Formal, Any_Type); Restore_Hidden_Primitives (Vis_Prims_List); if Parent_Installed then @@ -3035,8 +3035,8 @@ package body Sem_Ch12 is Set_Is_Generic_Instance (Formal); Enter_Name (Formal); - Set_Ekind (Formal, E_Package); - Set_Etype (Formal, Standard_Void_Type); + Mutate_Ekind (Formal, E_Package); + Set_Etype (Formal, Standard_Void_Type); Set_Inner_Instances (Formal, New_Elmt_List); -- It is unclear that any aspects can apply to a formal package @@ -3094,7 +3094,7 @@ package body Sem_Ch12 is Renaming_In_Par := Make_Defining_Identifier (Loc, Chars (Gen_Unit)); - Set_Ekind (Renaming_In_Par, E_Package); + Mutate_Ekind (Renaming_In_Par, E_Package); Set_Etype (Renaming_In_Par, Standard_Void_Type); Set_Scope (Renaming_In_Par, Parent_Instance); Set_Parent (Renaming_In_Par, Parent (Formal)); @@ -3163,7 +3163,7 @@ package body Sem_Ch12 is -- Add semantic information to the original defining identifier. - Set_Ekind (Pack_Id, E_Package); + Mutate_Ekind (Pack_Id, E_Package); Set_Etype (Pack_Id, Standard_Void_Type); Set_Scope (Pack_Id, Scope (Formal)); Set_Has_Completion (Pack_Id, True); @@ -3207,7 +3207,7 @@ package body Sem_Ch12 is is begin Enter_Name (T); - Set_Ekind (T, E_Incomplete_Type); + Mutate_Ekind (T, E_Incomplete_Type); Set_Etype (T, T); Set_Private_Dependents (T, New_Elmt_List); @@ -3235,7 +3235,7 @@ package body Sem_Ch12 is begin Enter_Name (T); - Set_Ekind (T, E_Signed_Integer_Subtype); + Mutate_Ekind (T, E_Signed_Integer_Subtype); Set_Etype (T, Base); Set_Size_Info (T, Standard_Integer); Set_RM_Size (T, RM_Size (Standard_Integer)); @@ -3693,8 +3693,8 @@ package body Sem_Ch12 is Start_Generic; Enter_Name (Id); - Set_Ekind (Id, E_Generic_Package); - Set_Etype (Id, Standard_Void_Type); + Mutate_Ekind (Id, E_Generic_Package); + Set_Etype (Id, Standard_Void_Type); -- Set SPARK_Mode from context @@ -3870,9 +3870,9 @@ package body Sem_Ch12 is Analyze_Generic_Formal_Part (N); if Nkind (Spec) = N_Function_Specification then - Set_Ekind (Id, E_Generic_Function); + Mutate_Ekind (Id, E_Generic_Function); else - Set_Ekind (Id, E_Generic_Procedure); + Mutate_Ekind (Id, E_Generic_Procedure); end if; -- Set SPARK_Mode from context @@ -4189,7 +4189,7 @@ package body Sem_Ch12 is end if; Generate_Definition (Act_Decl_Id); - Set_Ekind (Act_Decl_Id, E_Package); + Mutate_Ekind (Act_Decl_Id, E_Package); -- Initialize list of incomplete actuals before analysis @@ -4316,7 +4316,7 @@ package body Sem_Ch12 is goto Leave; else - Set_Ekind (Inst_Id, E_Package); + Mutate_Ekind (Inst_Id, E_Package); Set_Scope (Inst_Id, Current_Scope); -- If the context of the instance is subject to SPARK_Mode "off" or @@ -5663,7 +5663,7 @@ package body Sem_Ch12 is Error_Msg_NE ("instantiation of & within itself", N, Gen_Unit); else - Set_Ekind (Inst_Id, K); + Mutate_Ekind (Inst_Id, K); Set_Scope (Inst_Id, Current_Scope); Set_Entity (Gen_Id, Gen_Unit); @@ -6055,7 +6055,7 @@ package body Sem_Ch12 is Func_Name := New_Occurrence_Of (Actual_Subp, Loc); Func := Make_Defining_Identifier (Loc, Chars (Formal_Subp)); - Set_Ekind (Func, E_Function); + Mutate_Ekind (Func, E_Function); Set_Is_Generic_Actual_Subprogram (Func); Actuals := New_List; @@ -6140,7 +6140,7 @@ package body Sem_Ch12 is R := New_Occurrence_Of (F2, Loc); Func := Make_Defining_Identifier (Loc, Chars (Formal_Subp)); - Set_Ekind (Func, E_Function); + Mutate_Ekind (Func, E_Function); Set_Is_Generic_Actual_Subprogram (Func); Spec := @@ -6255,7 +6255,7 @@ package body Sem_Ch12 is begin Subp := Make_Defining_Identifier (Loc, Chars (Formal_Subp)); - Set_Ekind (Subp, Ekind (Formal_Subp)); + Mutate_Ekind (Subp, Ekind (Formal_Subp)); Set_Is_Generic_Actual_Subprogram (Subp); Profile := Parameter_Specifications ( @@ -10885,7 +10885,7 @@ package body Sem_Ch12 is begin Set_Is_Internal (I_Pack); - Set_Ekind (I_Pack, E_Package); + Mutate_Ekind (I_Pack, E_Package); Set_Hidden_In_Formal_Instance (I_Pack, Hidden_Formals); Append_To (Decls, @@ -11022,7 +11022,7 @@ package body Sem_Ch12 is New_Subp := Make_Defining_Identifier (Loc, Chars (Formal_Sub)); end if; - Set_Ekind (New_Subp, Ekind (Analyzed_S)); + Mutate_Ekind (New_Subp, Ekind (Analyzed_S)); Set_Is_Generic_Actual_Subprogram (New_Subp); Set_Defining_Unit_Name (New_Spec, New_Subp); @@ -14214,7 +14214,7 @@ package body Sem_Ch12 is -- the local subtype must be treated as such. if From_Limited_With (Act_T) then - Set_Ekind (Subt, E_Incomplete_Subtype); + Mutate_Ekind (Subt, E_Incomplete_Subtype); Set_From_Limited_With (Subt); end if; @@ -14273,9 +14273,9 @@ package body Sem_Ch12 is Append_To (Decl_Nodes, Corr_Decl); if Ekind (Act_T) = E_Task_Type then - Set_Ekind (Subt, E_Task_Subtype); + Mutate_Ekind (Subt, E_Task_Subtype); else - Set_Ekind (Subt, E_Protected_Subtype); + Mutate_Ekind (Subt, E_Protected_Subtype); end if; Set_Corresponding_Record_Type (Subt, Corr_Rec); diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 4002d82..4a5273b 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10216,7 +10216,7 @@ package body Sem_Ch13 is FBody : Node_Id; begin - Set_Ekind (SIdB, E_Function); + Mutate_Ekind (SIdB, E_Function); Set_Is_Predicate_Function (SIdB); -- Build function body @@ -10350,7 +10350,7 @@ package body Sem_Ch13 is -- Build function declaration - Set_Ekind (SId, E_Function); + Mutate_Ekind (SId, E_Function); Set_Is_Predicate_Function_M (SId); Set_Predicate_Function_M (Typ, SId); @@ -10565,7 +10565,7 @@ package body Sem_Ch13 is Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (Typ), "Predicate")); - Set_Ekind (Func_Id, E_Function); + Mutate_Ekind (Func_Id, E_Function); Set_Etype (Func_Id, Standard_Boolean); Set_Is_Internal (Func_Id); Set_Is_Predicate_Function (Func_Id); diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 448a7ad..6b8fe6f 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -857,10 +857,10 @@ package body Sem_Ch3 is T_Def => Access_To_Subprogram_Definition (N)); if Ekind (Anon_Type) = E_Access_Protected_Subprogram_Type then - Set_Ekind + Mutate_Ekind (Anon_Type, E_Anonymous_Access_Protected_Subprogram_Type); else - Set_Ekind (Anon_Type, E_Anonymous_Access_Subprogram_Type); + Mutate_Ekind (Anon_Type, E_Anonymous_Access_Subprogram_Type); end if; Set_Can_Use_Internal_Rep @@ -1290,10 +1290,10 @@ package body Sem_Ch3 is Check_Delayed_Subprogram (Desig_Type); if Protected_Present (T_Def) then - Set_Ekind (T_Name, E_Access_Protected_Subprogram_Type); + Mutate_Ekind (T_Name, E_Access_Protected_Subprogram_Type); Set_Convention (Desig_Type, Convention_Protected); else - Set_Ekind (T_Name, E_Access_Subprogram_Type); + Mutate_Ekind (T_Name, E_Access_Subprogram_Type); end if; Set_Can_Use_Internal_Rep (T_Name, @@ -1365,7 +1365,7 @@ package body Sem_Ch3 is if From_Limited_With (Entity (S)) and then not Is_Class_Wide_Type (Entity (S)) then - Set_Ekind (T, E_Access_Type); + Mutate_Ekind (T, E_Access_Type); Build_Master_Entity (T); Build_Master_Renaming (T); end if; @@ -1408,9 +1408,9 @@ package body Sem_Ch3 is end if; if All_Present (Def) or Constant_Present (Def) then - Set_Ekind (T, E_General_Access_Type); + Mutate_Ekind (T, E_General_Access_Type); else - Set_Ekind (T, E_Access_Type); + Mutate_Ekind (T, E_Access_Type); end if; if not Error_Posted (T) then @@ -1541,7 +1541,7 @@ package body Sem_Ch3 is Analyze_Component_Declaration (Decl); Set_Analyzed (Decl); - Set_Ekind (Tag, E_Component); + Mutate_Ekind (Tag, E_Component); Set_Is_Tag (Tag); Set_Is_Aliased (Tag); Set_Is_Independent (Tag); @@ -1582,7 +1582,7 @@ package body Sem_Ch3 is Analyze_Component_Declaration (Decl); Set_Analyzed (Decl); - Set_Ekind (Offset, E_Component); + Mutate_Ekind (Offset, E_Component); Set_Is_Aliased (Offset); Set_Is_Independent (Offset); Set_Related_Type (Offset, Iface); @@ -3419,7 +3419,7 @@ package body Sem_Ch3 is T := Find_Type_Name (N); - Set_Ekind (T, E_Incomplete_Type); + Mutate_Ekind (T, E_Incomplete_Type); Set_Etype (T, T); Set_Is_First_Subtype (T); Init_Size_Align (T); @@ -3543,7 +3543,7 @@ package body Sem_Ch3 is Set_Etype (E, Universal_Integer); Set_Etype (Id, Universal_Integer); - Set_Ekind (Id, E_Named_Integer); + Mutate_Ekind (Id, E_Named_Integer); Set_Is_Frozen (Id, True); Set_Debug_Info_Needed (Id); @@ -3603,7 +3603,7 @@ package body Sem_Ch3 is if Is_Integer_Type (T) then Resolve (E, T); Set_Etype (Id, Universal_Integer); - Set_Ekind (Id, E_Named_Integer); + Mutate_Ekind (Id, E_Named_Integer); elsif Is_Real_Type (T) then @@ -3635,14 +3635,14 @@ package body Sem_Ch3 is Resolve (E, T); Set_Etype (Id, Universal_Real); - Set_Ekind (Id, E_Named_Real); + Mutate_Ekind (Id, E_Named_Real); else Wrong_Type (E, Any_Numeric); Resolve (E, T); Set_Etype (Id, T); - Set_Ekind (Id, E_Constant); + Mutate_Ekind (Id, E_Constant); Set_Never_Set_In_Source (Id, True); Set_Is_True_Constant (Id, True); return; @@ -4043,7 +4043,7 @@ package body Sem_Ch3 is T := Find_Type_Of_Object (Object_Definition (N), N); Set_Etype (Id, T); - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); goto Leave; end if; @@ -4069,7 +4069,7 @@ package body Sem_Ch3 is if Error_Posted (Id) then Set_Etype (Id, T); - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); goto Leave; end if; end if; @@ -4371,7 +4371,7 @@ package body Sem_Ch3 is and then In_Subrange_Of (Etype (Entity (E)), T) then Set_Is_Known_Valid (Id); - Set_Ekind (Id, E_Constant); + Mutate_Ekind (Id, E_Constant); Set_Actual_Subtype (Id, Etype (Entity (E))); end if; @@ -4587,9 +4587,9 @@ package body Sem_Ch3 is elsif Is_Unchecked_Union (T) then if Constant_Present (N) or else Nkind (E) = N_Function_Call then - Set_Ekind (Id, E_Constant); + Mutate_Ekind (Id, E_Constant); else - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); end if; -- If the expression is an aggregate it contains the required @@ -4770,11 +4770,11 @@ package body Sem_Ch3 is end if; if Constant_Present (N) then - Set_Ekind (Id, E_Constant); + Mutate_Ekind (Id, E_Constant); Set_Is_True_Constant (Id); else - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); -- A variable is set as shared passive if it appears in a shared -- passive package, and is at the outer level. This is not done for @@ -5102,7 +5102,7 @@ package body Sem_Ch3 is Parent_Base := Base_Type (Parent_Type); if Parent_Type = Any_Type or else Etype (Parent_Type) = Any_Type then - Set_Ekind (T, Ekind (Parent_Type)); + Mutate_Ekind (T, Ekind (Parent_Type)); Set_Etype (T, Any_Type); goto Leave; @@ -5121,7 +5121,7 @@ package body Sem_Ch3 is & "tagged type (RM 3.9.1 (3/1))", N); Set_Etype (T, Any_Type); - Set_Ekind (T, E_Limited_Private_Type); + Mutate_Ekind (T, E_Limited_Private_Type); Set_Private_Dependents (T, New_Elmt_List); Set_Error_Posted (T); goto Leave; @@ -5147,7 +5147,7 @@ package body Sem_Ch3 is Set_Is_Pure (T, Is_Pure (Current_Scope)); Set_Scope (T, Current_Scope); - Set_Ekind (T, E_Record_Type_With_Private); + Mutate_Ekind (T, E_Record_Type_With_Private); Init_Size_Align (T); Set_Default_SSO (T); Set_No_Reordering (T, No_Component_Reordering); @@ -5392,7 +5392,7 @@ package body Sem_Ch3 is -- (no aspects to examine on the generated declaration). if not Comes_From_Source (N) then - Set_Ekind (Id, Ekind (T)); + Mutate_Ekind (Id, Ekind (T)); if Present (Predicate_Function (Id)) then null; @@ -5418,11 +5418,11 @@ package body Sem_Ch3 is case Ekind (T) is when Array_Kind => - Set_Ekind (Id, E_Array_Subtype); + Mutate_Ekind (Id, E_Array_Subtype); Copy_Array_Subtype_Attributes (Id, T); when Decimal_Fixed_Point_Kind => - Set_Ekind (Id, E_Decimal_Fixed_Point_Subtype); + Mutate_Ekind (Id, E_Decimal_Fixed_Point_Subtype); Set_Digits_Value (Id, Digits_Value (T)); Set_Delta_Value (Id, Delta_Value (T)); Set_Scale_Value (Id, Scale_Value (T)); @@ -5434,7 +5434,7 @@ package body Sem_Ch3 is Set_RM_Size (Id, RM_Size (T)); when Enumeration_Kind => - Set_Ekind (Id, E_Enumeration_Subtype); + Mutate_Ekind (Id, E_Enumeration_Subtype); Set_First_Literal (Id, First_Literal (Base_Type (T))); Set_Scalar_Range (Id, Scalar_Range (T)); Set_Is_Character_Type (Id, Is_Character_Type (T)); @@ -5443,7 +5443,7 @@ package body Sem_Ch3 is Set_RM_Size (Id, RM_Size (T)); when Ordinary_Fixed_Point_Kind => - Set_Ekind (Id, E_Ordinary_Fixed_Point_Subtype); + Mutate_Ekind (Id, E_Ordinary_Fixed_Point_Subtype); Set_Scalar_Range (Id, Scalar_Range (T)); Set_Small_Value (Id, Small_Value (T)); Set_Delta_Value (Id, Delta_Value (T)); @@ -5452,7 +5452,7 @@ package body Sem_Ch3 is Set_RM_Size (Id, RM_Size (T)); when Float_Kind => - Set_Ekind (Id, E_Floating_Point_Subtype); + Mutate_Ekind (Id, E_Floating_Point_Subtype); Set_Scalar_Range (Id, Scalar_Range (T)); Set_Digits_Value (Id, Digits_Value (T)); Set_Is_Constrained (Id, Is_Constrained (T)); @@ -5461,21 +5461,21 @@ package body Sem_Ch3 is -- inherited subsequently when Analyze_Dimensions is called. when Signed_Integer_Kind => - Set_Ekind (Id, E_Signed_Integer_Subtype); + Mutate_Ekind (Id, E_Signed_Integer_Subtype); Set_Scalar_Range (Id, Scalar_Range (T)); Set_Is_Constrained (Id, Is_Constrained (T)); Set_Is_Known_Valid (Id, Is_Known_Valid (T)); Set_RM_Size (Id, RM_Size (T)); when Modular_Integer_Kind => - Set_Ekind (Id, E_Modular_Integer_Subtype); + Mutate_Ekind (Id, E_Modular_Integer_Subtype); Set_Scalar_Range (Id, Scalar_Range (T)); Set_Is_Constrained (Id, Is_Constrained (T)); Set_Is_Known_Valid (Id, Is_Known_Valid (T)); Set_RM_Size (Id, RM_Size (T)); when Class_Wide_Kind => - Set_Ekind (Id, E_Class_Wide_Subtype); + Mutate_Ekind (Id, E_Class_Wide_Subtype); Set_Class_Wide_Type (Id, Class_Wide_Type (T)); Set_Cloned_Subtype (Id, T); Set_Is_Tagged_Type (Id, True); @@ -5492,7 +5492,7 @@ package body Sem_Ch3 is when E_Record_Subtype | E_Record_Type => - Set_Ekind (Id, E_Record_Subtype); + Mutate_Ekind (Id, E_Record_Subtype); -- Subtype declarations introduced for formal type parameters -- in generic instantiations should inherit the Size value of @@ -5545,7 +5545,7 @@ package body Sem_Ch3 is end if; when Private_Kind => - Set_Ekind (Id, Subtype_Kind (Ekind (T))); + Mutate_Ekind (Id, Subtype_Kind (Ekind (T))); Set_Has_Discriminants (Id, Has_Discriminants (T)); Set_Is_Constrained (Id, Is_Constrained (T)); Set_First_Entity (Id, First_Entity (T)); @@ -5610,7 +5610,7 @@ package body Sem_Ch3 is end if; when Access_Kind => - Set_Ekind (Id, E_Access_Subtype); + Mutate_Ekind (Id, E_Access_Subtype); Set_Is_Constrained (Id, Is_Constrained (T)); Set_Is_Access_Constant (Id, Is_Access_Constant (T)); @@ -5633,7 +5633,7 @@ package body Sem_Ch3 is end if; when Concurrent_Kind => - Set_Ekind (Id, Subtype_Kind (Ekind (T))); + Mutate_Ekind (Id, Subtype_Kind (Ekind (T))); Set_Corresponding_Record_Type (Id, Corresponding_Record_Type (T)); Set_First_Entity (Id, First_Entity (T)); @@ -5661,7 +5661,7 @@ package body Sem_Ch3 is -- propagate indication. Note that we also have to include -- subtypes for Ada 2012 extended use of incomplete types. - Set_Ekind (Id, E_Incomplete_Subtype); + Mutate_Ekind (Id, E_Incomplete_Subtype); Set_Is_Tagged_Type (Id, Is_Tagged_Type (T)); Set_Private_Dependents (Id, New_Elmt_List); @@ -6197,7 +6197,7 @@ package body Sem_Ch3 is -- The constrained array type is a subtype of the unconstrained one - Set_Ekind (T, E_Array_Subtype); + Mutate_Ekind (T, E_Array_Subtype); Init_Size_Align (T); Set_Etype (T, Implicit_Base); Set_Scope (T, Current_Scope); @@ -6233,7 +6233,7 @@ package body Sem_Ch3 is pragma Assert (Ekind (T) = E_Void); end if; - Set_Ekind (T, E_Array_Type); + Mutate_Ekind (T, E_Array_Type); Init_Size_Align (T); Set_Etype (T, T); Set_Scope (T, Current_Scope); @@ -6506,7 +6506,7 @@ package body Sem_Ch3 is Scope_Stack.Append (Curr_Scope); end if; - Set_Ekind (Anon, E_Anonymous_Access_Protected_Subprogram_Type); + Mutate_Ekind (Anon, E_Anonymous_Access_Protected_Subprogram_Type); Set_Can_Use_Internal_Rep (Anon, not Always_Compatible_Rep_On_Target); return Anon; end Replace_Anonymous_Access_To_Protected_Subprogram; @@ -6679,7 +6679,7 @@ package body Sem_Ch3 is if Nkind (S) /= N_Subtype_Indication and then Subt /= Base_Type (Subt) then - Set_Ekind (Derived_Type, E_Access_Subtype); + Mutate_Ekind (Derived_Type, E_Access_Subtype); end if; if Ekind (Derived_Type) = E_Access_Subtype then @@ -6794,7 +6794,7 @@ package body Sem_Ch3 is Implicit_Base := Create_Itype (Ekind (Parent_Base), N, Derived_Type, 'B'); - Set_Ekind (Implicit_Base, Ekind (Parent_Base)); + Mutate_Ekind (Implicit_Base, Ekind (Parent_Base)); Set_Etype (Implicit_Base, Parent_Base); Copy_Array_Subtype_Attributes (Implicit_Base, Parent_Base); @@ -6808,7 +6808,7 @@ package body Sem_Ch3 is begin if not Is_Constrained (Parent_Type) then if Nkind (Indic) /= N_Subtype_Indication then - Set_Ekind (Derived_Type, E_Array_Type); + Mutate_Ekind (Derived_Type, E_Array_Type); Copy_Array_Subtype_Attributes (Derived_Type, Parent_Type); Copy_Array_Base_Type_Attributes (Derived_Type, Parent_Type); @@ -6835,7 +6835,7 @@ package body Sem_Ch3 is if Nkind (Indic) /= N_Subtype_Indication then Make_Implicit_Base; - Set_Ekind (Derived_Type, Ekind (Parent_Type)); + Mutate_Ekind (Derived_Type, Ekind (Parent_Type)); Set_Etype (Derived_Type, Implicit_Base); Copy_Array_Subtype_Attributes (Derived_Type, Parent_Type); @@ -7295,7 +7295,7 @@ package body Sem_Ch3 is New_Lit := Make_Defining_Identifier (Loc, Chars (Literal)); end if; - Set_Ekind (New_Lit, E_Enumeration_Literal); + Mutate_Ekind (New_Lit, E_Enumeration_Literal); Set_Enumeration_Pos (New_Lit, Enumeration_Pos (Literal)); Set_Enumeration_Rep (New_Lit, Enumeration_Rep (Literal)); Set_Enumeration_Rep_Expr (New_Lit, Empty); @@ -7315,7 +7315,7 @@ package body Sem_Ch3 is -- may be hidden by a previous explicit function definition (cf. -- c83031a). - Set_Ekind (Derived_Type, E_Enumeration_Subtype); + Mutate_Ekind (Derived_Type, E_Enumeration_Subtype); Set_Etype (Derived_Type, Implicit_Base); Type_Decl := @@ -7487,7 +7487,7 @@ package body Sem_Ch3 is Create_Itype (Ekind (Parent_Base), N, Derived_Type, 'B'); Set_Etype (Implicit_Base, Parent_Base); - Set_Ekind (Implicit_Base, Ekind (Parent_Base)); + Mutate_Ekind (Implicit_Base, Ekind (Parent_Base)); Set_Size_Info (Implicit_Base, Parent_Base); Set_First_Rep_Item (Implicit_Base, First_Rep_Item (Parent_Base)); Set_Parent (Implicit_Base, Parent (Derived_Type)); @@ -7527,7 +7527,7 @@ package body Sem_Ch3 is -- parent type (otherwise Process_Subtype has set the bounds) if No_Constraint then - Set_Ekind (Derived_Type, Subtype_Kind (Ekind (Parent_Type))); + Mutate_Ekind (Derived_Type, Subtype_Kind (Ekind (Parent_Type))); end if; -- If we did not have a range constraint, then set the range from the @@ -7956,7 +7956,7 @@ package body Sem_Ch3 is -- prevent spurious errors associated with missing overriding -- of abstract primitives (overridden only for Derived_Type). - Set_Ekind (Full_Der, E_Record_Type); + Mutate_Ekind (Full_Der, E_Record_Type); Set_Is_Underlying_Record_View (Full_Der); Set_Default_SSO (Full_Der); Set_No_Reordering (Full_Der, No_Component_Reordering); @@ -8856,7 +8856,7 @@ package body Sem_Ch3 is if Private_Extension then Type_Def := N; - Set_Ekind (Derived_Type, E_Record_Type_With_Private); + Mutate_Ekind (Derived_Type, E_Record_Type_With_Private); Set_Default_SSO (Derived_Type); Set_No_Reordering (Derived_Type, No_Component_Reordering); @@ -8871,7 +8871,7 @@ package body Sem_Ch3 is -- For untagged types we preserve the Ekind of the Parent_Base. if Present (Record_Extension_Part (Type_Def)) then - Set_Ekind (Derived_Type, E_Record_Type); + Mutate_Ekind (Derived_Type, E_Record_Type); Set_Default_SSO (Derived_Type); Set_No_Reordering (Derived_Type, No_Component_Reordering); @@ -8885,7 +8885,7 @@ package body Sem_Ch3 is end if; else - Set_Ekind (Derived_Type, Ekind (Parent_Base)); + Mutate_Ekind (Derived_Type, Ekind (Parent_Base)); end if; end if; @@ -9744,7 +9744,7 @@ package body Sem_Ch3 is Set_Scope (Derived_Type, Current_Scope); Set_Etype (Derived_Type, Parent_Base); - Set_Ekind (Derived_Type, Ekind (Parent_Base)); + Mutate_Ekind (Derived_Type, Ekind (Parent_Base)); Propagate_Concurrent_Flags (Derived_Type, Parent_Base); Set_Size_Info (Derived_Type, Parent_Type); @@ -9963,7 +9963,7 @@ package body Sem_Ch3 is D_Minal := Make_Defining_Identifier (Sloc (Discrim), Chars (Discrim)); - Set_Ekind (D_Minal, E_In_Parameter); + Mutate_Ekind (D_Minal, E_In_Parameter); Set_Mechanism (D_Minal, Default_Mechanism); Set_Etype (D_Minal, Etype (Discrim)); Set_Scope (D_Minal, Current_Scope); @@ -9982,7 +9982,7 @@ package body Sem_Ch3 is then CR_Disc := Make_Defining_Identifier (Sloc (Discrim), Chars (Discrim)); - Set_Ekind (CR_Disc, E_In_Parameter); + Mutate_Ekind (CR_Disc, E_In_Parameter); Set_Mechanism (CR_Disc, Default_Mechanism); Set_Etype (CR_Disc, Etype (Discrim)); Set_Scope (CR_Disc, Current_Scope); @@ -10373,7 +10373,7 @@ package body Sem_Ch3 is begin if Ekind (T) = E_Record_Type then - Set_Ekind (Def_Id, E_Record_Subtype); + Mutate_Ekind (Def_Id, E_Record_Subtype); -- Inherit preelaboration flag from base, for types for which it -- may have been set: records, private types, protected types. @@ -10382,15 +10382,15 @@ package body Sem_Ch3 is (Def_Id, Known_To_Have_Preelab_Init (T)); elsif Ekind (T) = E_Task_Type then - Set_Ekind (Def_Id, E_Task_Subtype); + Mutate_Ekind (Def_Id, E_Task_Subtype); elsif Ekind (T) = E_Protected_Type then - Set_Ekind (Def_Id, E_Protected_Subtype); + Mutate_Ekind (Def_Id, E_Protected_Subtype); Set_Known_To_Have_Preelab_Init (Def_Id, Known_To_Have_Preelab_Init (T)); elsif Is_Private_Type (T) then - Set_Ekind (Def_Id, Subtype_Kind (Ekind (T))); + Mutate_Ekind (Def_Id, Subtype_Kind (Ekind (T))); Set_Known_To_Have_Preelab_Init (Def_Id, Known_To_Have_Preelab_Init (T)); @@ -10399,7 +10399,7 @@ package body Sem_Ch3 is Set_Private_Dependents (Def_Id, New_Elmt_List); elsif Is_Class_Wide_Type (T) then - Set_Ekind (Def_Id, E_Class_Wide_Subtype); + Mutate_Ekind (Def_Id, E_Class_Wide_Subtype); else -- Incomplete type. Attach subtype to list of dependents, to be @@ -10412,9 +10412,9 @@ package body Sem_Ch3 is -- initialization procedure. if Ekind (T) = E_Incomplete_Type then - Set_Ekind (Def_Id, E_Incomplete_Subtype); + Mutate_Ekind (Def_Id, E_Incomplete_Subtype); else - Set_Ekind (Def_Id, Ekind (T)); + Mutate_Ekind (Def_Id, Ekind (T)); end if; if For_Access and then Within_Init_Proc then @@ -11533,9 +11533,9 @@ package body Sem_Ch3 is end if; if Ekind (Designated_Type (Anon_Access)) = E_Subprogram_Type then - Set_Ekind (Anon_Access, E_Anonymous_Access_Subprogram_Type); + Mutate_Ekind (Anon_Access, E_Anonymous_Access_Subprogram_Type); else - Set_Ekind (Anon_Access, E_Anonymous_Access_Type); + Mutate_Ekind (Anon_Access, E_Anonymous_Access_Type); end if; Set_Is_Local_Anonymous_Access (Anon_Access); @@ -12529,7 +12529,7 @@ package body Sem_Ch3 is -- Set common attributes for all subtypes: kind, convention, etc. - Set_Ekind (Full, Subtype_Kind (Ekind (Full_Base))); + Mutate_Ekind (Full, Subtype_Kind (Ekind (Full_Base))); Set_Convention (Full, Convention (Full_Base)); Set_Is_First_Subtype (Full, False); Set_Scope (Full, Scope (Priv)); @@ -13085,7 +13085,7 @@ package body Sem_Ch3 is Desig_Subtype := Create_Itype (E_Void, Related_Nod, Scope_Id => Scope (Desig_Type)); - Set_Ekind (Desig_Subtype, E_Record_Subtype); + Mutate_Ekind (Desig_Subtype, E_Record_Subtype); Def_Id := Entity (Subtype_Mark (S)); -- We indicate that the component has a per-object constraint @@ -13182,7 +13182,7 @@ package body Sem_Ch3 is if No (Def_Id) then Def_Id := Create_Itype (E_Access_Subtype, Related_Nod); else - Set_Ekind (Def_Id, E_Access_Subtype); + Mutate_Ekind (Def_Id, E_Access_Subtype); end if; if Constraint_OK then @@ -13316,7 +13316,7 @@ package body Sem_Ch3 is Set_Parent (Def_Id, Related_Nod); else - Set_Ekind (Def_Id, E_Array_Subtype); + Mutate_Ekind (Def_Id, E_Array_Subtype); end if; Set_Size_Info (Def_Id, (T)); @@ -13879,7 +13879,7 @@ package body Sem_Ch3 is Bound_Val : Ureal; begin - Set_Ekind (Def_Id, E_Decimal_Fixed_Point_Subtype); + Mutate_Ekind (Def_Id, E_Decimal_Fixed_Point_Subtype); if Nkind (C) = N_Range_Constraint then Range_Expr := Range_Expression (C); @@ -13963,7 +13963,7 @@ package body Sem_Ch3 is begin -- Set a reasonable Ekind for the entity, including incomplete types. - Set_Ekind (Def_Id, Subtype_Kind (Ekind (T))); + Mutate_Ekind (Def_Id, Subtype_Kind (Ekind (T))); -- Set Etype to the known type, to reduce chances of cascaded errors @@ -14089,7 +14089,7 @@ package body Sem_Ch3 is C : constant Node_Id := Constraint (S); begin - Set_Ekind (Def_Id, E_Enumeration_Subtype); + Mutate_Ekind (Def_Id, E_Enumeration_Subtype); Set_First_Literal (Def_Id, First_Literal (Base_Type (T))); @@ -14114,7 +14114,7 @@ package body Sem_Ch3 is Rais : Node_Id; begin - Set_Ekind (Def_Id, E_Floating_Point_Subtype); + Mutate_Ekind (Def_Id, E_Floating_Point_Subtype); Set_Etype (Def_Id, Base_Type (T)); Set_Size_Info (Def_Id, (T)); @@ -14289,13 +14289,13 @@ package body Sem_Ch3 is -- Complete construction of the Itype if Is_Modular_Integer_Type (T) then - Set_Ekind (Def_Id, E_Modular_Integer_Subtype); + Mutate_Ekind (Def_Id, E_Modular_Integer_Subtype); elsif Is_Integer_Type (T) then - Set_Ekind (Def_Id, E_Signed_Integer_Subtype); + Mutate_Ekind (Def_Id, E_Signed_Integer_Subtype); else - Set_Ekind (Def_Id, E_Enumeration_Subtype); + Mutate_Ekind (Def_Id, E_Enumeration_Subtype); Set_Is_Character_Type (Def_Id, Is_Character_Type (T)); Set_First_Literal (Def_Id, First_Literal (T)); end if; @@ -14322,9 +14322,9 @@ package body Sem_Ch3 is Set_Scalar_Range_For_Subtype (Def_Id, Range_Expression (C), T); if Is_Modular_Integer_Type (T) then - Set_Ekind (Def_Id, E_Modular_Integer_Subtype); + Mutate_Ekind (Def_Id, E_Modular_Integer_Subtype); else - Set_Ekind (Def_Id, E_Signed_Integer_Subtype); + Mutate_Ekind (Def_Id, E_Signed_Integer_Subtype); end if; Set_Etype (Def_Id, Base_Type (T)); @@ -14344,7 +14344,7 @@ package body Sem_Ch3 is Rais : Node_Id; begin - Set_Ekind (Def_Id, E_Ordinary_Fixed_Point_Subtype); + Mutate_Ekind (Def_Id, E_Ordinary_Fixed_Point_Subtype); Set_Etype (Def_Id, Base_Type (T)); Set_Size_Info (Def_Id, (T)); Set_First_Rep_Item (Def_Id, First_Rep_Item (T)); @@ -14521,7 +14521,7 @@ package body Sem_Ch3 is -- appropriate choice, since it allowed the attributes to be set -- in the first place. This Ekind value will be modified later. - Set_Ekind (Full, Ekind (Priv)); + Mutate_Ekind (Full, Ekind (Priv)); -- Also set Etype temporarily to Any_Type, again, in the absence -- of errors, it will be properly reset, and if there are errors, @@ -15143,7 +15143,7 @@ package body Sem_Ch3 is -- chain ensures that SPARK-related pragmas are not clobbered when the -- decimal fixed point type acts as a full view of a private type. - Set_Ekind (T, E_Decimal_Fixed_Point_Subtype); + Mutate_Ekind (T, E_Decimal_Fixed_Point_Subtype); Set_Etype (T, Implicit_Base); Set_Size_Info (T, Implicit_Base); Inherit_Rep_Item_Chain (T, Implicit_Base); @@ -15535,7 +15535,7 @@ package body Sem_Ch3 is begin New_Subp := New_Entity (Nkind (Parent_Subp), Sloc (Derived_Type)); - Set_Ekind (New_Subp, Ekind (Parent_Subp)); + Mutate_Ekind (New_Subp, Ekind (Parent_Subp)); -- Check whether the inherited subprogram is a private operation that -- should be inherited but not yet made visible. Such subprograms can @@ -16597,7 +16597,7 @@ package body Sem_Ch3 is Conditional_Delay (Derived_Type, Parent_Type); - Set_Ekind (Derived_Type, E_Enumeration_Subtype); + Mutate_Ekind (Derived_Type, E_Enumeration_Subtype); Set_Etype (Derived_Type, Implicit_Base); Set_Size_Info (Derived_Type, Parent_Type); @@ -16846,7 +16846,7 @@ package body Sem_Ch3 is Error_Msg_N ("type cannot be used in its own definition", Indic); end if; - Set_Ekind (T, Ekind (Parent_Type)); + Mutate_Ekind (T, Ekind (Parent_Type)); Set_Etype (T, Any_Type); Set_Scalar_Range (T, Scalar_Range (Any_Type)); @@ -17187,7 +17187,7 @@ package body Sem_Ch3 is R_Node := New_Node (N_Range, Sloc (Def)); Set_Low_Bound (R_Node, B_Node); - Set_Ekind (T, E_Enumeration_Type); + Mutate_Ekind (T, E_Enumeration_Type); Set_First_Literal (T, L); Set_Etype (T, T); Set_Is_Constrained (T); @@ -17201,7 +17201,7 @@ package body Sem_Ch3 is while Present (L) loop if Ekind (L) /= E_Enumeration_Literal then - Set_Ekind (L, E_Enumeration_Literal); + Mutate_Ekind (L, E_Enumeration_Literal); Set_Enumeration_Pos (L, Ev); Set_Enumeration_Rep (L, Ev); Set_Is_Known_Valid (L, True); @@ -17578,7 +17578,7 @@ package body Sem_Ch3 is if Is_Tagged_Type (Prev) and then Present (Class_Wide_Type (Prev)) then - Set_Ekind (Id, Ekind (Prev)); -- will be reset later + Mutate_Ekind (Id, Ekind (Prev)); -- will be reset later Set_Class_Wide_Type (Id, Class_Wide_Type (Prev)); -- Type of the class-wide type is the current Id. Previously @@ -17872,7 +17872,7 @@ package body Sem_Ch3 is Subtype_Indication => Relocate_Node (Obj_Def)); begin Set_Etype (T, Base_T); - Set_Ekind (T, Subtype_Kind (Ekind (Base_T))); + Mutate_Ekind (T, Subtype_Kind (Ekind (Base_T))); Set_Parent (T, Obj_Def); if Ekind (T) = E_Array_Subtype then @@ -18174,7 +18174,7 @@ package body Sem_Ch3 is Set_Digits_Value (Implicit_Base, Digits_Value (Base_Typ)); Set_Float_Rep (Implicit_Base, Float_Rep (Base_Typ)); - Set_Ekind (T, E_Floating_Point_Subtype); + Mutate_Ekind (T, E_Floating_Point_Subtype); Set_Etype (T, Implicit_Base); Set_Size_Info (T, Implicit_Base); Set_RM_Size (T, RM_Size (Implicit_Base)); @@ -18661,7 +18661,7 @@ package body Sem_Ch3 is if Is_Tagged and then Ekind (New_C) = E_Component and then Nkind (N) /= N_Private_Extension_Declaration then - Set_Ekind (New_C, E_Void); + Mutate_Ekind (New_C, E_Void); end if; if Plain_Discrim then @@ -19230,7 +19230,7 @@ package body Sem_Ch3 is Reinit_Field_To_Zero (CW_Type, SPARK_Aux_Pragma_Inherited); end if; - Set_Ekind (CW_Type, E_Class_Wide_Type); + Mutate_Ekind (CW_Type, E_Class_Wide_Type); Set_Is_Tagged_Type (CW_Type, True); Set_Direct_Primitive_Operations (CW_Type, New_Elmt_List); Set_Is_Abstract_Type (CW_Type, False); @@ -19508,13 +19508,13 @@ package body Sem_Ch3 is Set_Etype (Def_Id, Base_Type (T)); if Is_Signed_Integer_Type (T) then - Set_Ekind (Def_Id, E_Signed_Integer_Subtype); + Mutate_Ekind (Def_Id, E_Signed_Integer_Subtype); elsif Is_Modular_Integer_Type (T) then - Set_Ekind (Def_Id, E_Modular_Integer_Subtype); + Mutate_Ekind (Def_Id, E_Modular_Integer_Subtype); else - Set_Ekind (Def_Id, E_Enumeration_Subtype); + Mutate_Ekind (Def_Id, E_Enumeration_Subtype); Set_Is_Character_Type (Def_Id, Is_Character_Type (T)); Set_First_Literal (Def_Id, First_Literal (T)); end if; @@ -19612,7 +19612,7 @@ package body Sem_Ch3 is Analyze_And_Resolve (Mod_Expr, Any_Integer); Set_Etype (T, T); - Set_Ekind (T, E_Modular_Integer_Type); + Mutate_Ekind (T, E_Modular_Integer_Type); Init_Alignment (T); Set_Is_Constrained (T); @@ -19726,7 +19726,7 @@ package body Sem_Ch3 is begin Op := Make_Defining_Operator_Symbol (Loc, Name_Op_Concat); - Set_Ekind (Op, E_Operator); + Mutate_Ekind (Op, E_Operator); Set_Scope (Op, Current_Scope); Set_Etype (Op, Typ); Set_Homonym (Op, Get_Name_Entity_Id (Name_Op_Concat)); @@ -20012,7 +20012,7 @@ package body Sem_Ch3 is -- chain ensures that SPARK-related pragmas are not clobbered when the -- ordinary fixed point type acts as a full view of a private type. - Set_Ekind (T, E_Ordinary_Fixed_Point_Subtype); + Mutate_Ekind (T, E_Ordinary_Fixed_Point_Subtype); Set_Etype (T, Implicit_Base); Init_Size_Align (T); Inherit_Rep_Item_Chain (T, Implicit_Base); @@ -20415,7 +20415,7 @@ package body Sem_Ch3 is Reinit_Field_To_Zero (Id, Discriminal_Link); end if; - Set_Ekind (Id, E_Discriminant); + Mutate_Ekind (Id, E_Discriminant); Init_Component_Location (Id); Init_Esize (Id); Set_Discriminant_Number (Id, Discr_Number); @@ -21302,7 +21302,7 @@ package body Sem_Ch3 is Reinit_Field_To_Zero (Priv_Dep, Private_Dependents, Old_Ekind => E_Incomplete_Subtype); - Set_Ekind (Priv_Dep, Subtype_Kind (Ekind (Full_T))); + Mutate_Ekind (Priv_Dep, Subtype_Kind (Ekind (Full_T))); Set_Etype (Priv_Dep, Full_T); Set_Analyzed (Parent (Priv_Dep), False); @@ -21877,7 +21877,7 @@ package body Sem_Ch3 is -- Set Ekind of orphan itype, to prevent cascaded errors if Present (Def_Id) then - Set_Ekind (Def_Id, Ekind (Any_Type)); + Mutate_Ekind (Def_Id, Ekind (Any_Type)); end if; -- Make recursive call, having got rid of the bogus constraint @@ -22068,7 +22068,7 @@ package body Sem_Ch3 is -- These flags must be initialized before calling Process_Discriminants -- because this routine makes use of them. - Set_Ekind (T, E_Record_Type); + Mutate_Ekind (T, E_Record_Type); Set_Etype (T, T); Init_Size_Align (T); Set_Interfaces (T, No_Elist); @@ -22172,7 +22172,7 @@ package body Sem_Ch3 is Tag_Comp := Make_Defining_Identifier (Sloc (Def), Name_uTag); Enter_Name (Tag_Comp); - Set_Ekind (Tag_Comp, E_Component); + Mutate_Ekind (Tag_Comp, E_Component); Set_Is_Tag (Tag_Comp); Set_Is_Aliased (Tag_Comp); Set_Is_Independent (Tag_Comp); @@ -22282,7 +22282,7 @@ package body Sem_Ch3 is if Ekind (Component) = E_Void and then not Is_Itype (Component) then - Set_Ekind (Component, E_Component); + Mutate_Ekind (Component, E_Component); Init_Component_Location (Component); end if; @@ -22503,9 +22503,9 @@ package body Sem_Ch3 is -- Reset the kind of the subtype during analysis of the range, to -- catch possible premature use in the bounds themselves. - Set_Ekind (Def_Id, E_Void); + Mutate_Ekind (Def_Id, E_Void); Process_Range_Expr_In_Decl (R, Subt, Subtyp => Def_Id); - Set_Ekind (Def_Id, Kind); + Mutate_Ekind (Def_Id, Kind); end Set_Scalar_Range_For_Subtype; -------------------------------------------------------- @@ -22681,7 +22681,7 @@ package body Sem_Ch3 is Set_First_Rep_Item (Implicit_Base, First_Rep_Item (Base_Typ)); Set_Scalar_Range (Implicit_Base, Scalar_Range (Base_Typ)); - Set_Ekind (T, E_Signed_Integer_Subtype); + Mutate_Ekind (T, E_Signed_Integer_Subtype); Set_Etype (T, Implicit_Base); Set_Size_Info (T, Implicit_Base); Inherit_Rep_Item_Chain (T, Implicit_Base); diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 9b34694..1f55af6 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -1323,7 +1323,7 @@ package body Sem_Ch5 is Reinit_Field_To_Zero (Ent, Enclosing_Scope); end if; - Set_Ekind (Ent, E_Block); + Mutate_Ekind (Ent, E_Block); Generate_Reference (Ent, N, ' '); Generate_Definition (Ent); @@ -1970,7 +1970,7 @@ package body Sem_Ch5 is Id : constant Node_Id := Defining_Identifier (N); begin Enter_Name (Id); - Set_Ekind (Id, E_Label); + Mutate_Ekind (Id, E_Label); Set_Etype (Id, Standard_Void_Type); Set_Enclosing_Scope (Id, Current_Scope); end Analyze_Implicit_Label_Declaration; @@ -2164,7 +2164,7 @@ package body Sem_Ch5 is -- Set the kind of the loop variable, which is not visible within the -- iterator name. - Set_Ekind (Def_Id, E_Variable); + Mutate_Ekind (Def_Id, E_Variable); -- Provide a link between the iterator variable and the container, for -- subsequent use in cross-reference and modification information. @@ -2433,7 +2433,7 @@ package body Sem_Ch5 is -- Prevent cascaded errors - Set_Ekind (Def_Id, E_Loop_Parameter); + Mutate_Ekind (Def_Id, E_Loop_Parameter); Set_Etype (Def_Id, Etype (First_Index (Typ))); end if; @@ -2445,7 +2445,7 @@ package body Sem_Ch5 is -- Iteration over a container else - Set_Ekind (Def_Id, E_Loop_Parameter); + Mutate_Ekind (Def_Id, E_Loop_Parameter); Error_Msg_Ada_2012_Feature ("container iterator", Sloc (N)); -- OF present @@ -2498,7 +2498,7 @@ package body Sem_Ch5 is -- element is a variable and is modifiable in the loop. if Has_Aspect (Typ, Aspect_Variable_Indexing) then - Set_Ekind (Def_Id, E_Variable); + Mutate_Ekind (Def_Id, E_Variable); end if; -- If the container is a constant, iterating over it @@ -2669,7 +2669,7 @@ package body Sem_Ch5 is procedure Analyze_Label_Entity (E : Entity_Id) is begin - Set_Ekind (E, E_Label); + Mutate_Ekind (E, E_Label); Set_Etype (E, Standard_Void_Type); Set_Enclosing_Scope (E, Current_Scope); Set_Reachable (E, True); @@ -3055,7 +3055,7 @@ package body Sem_Ch5 is -- subsequent analysis of the condition in a quantified -- expression. - Set_Ekind (Id, E_Loop_Parameter); + Mutate_Ekind (Id, E_Loop_Parameter); return; end; @@ -3118,7 +3118,7 @@ package body Sem_Ch5 is Make_Index (DS, N); end if; - Set_Ekind (Id, E_Loop_Parameter); + Mutate_Ekind (Id, E_Loop_Parameter); -- A quantified expression which appears in a pre- or post-condition may -- be analyzed multiple times. The analysis of the range creates several @@ -3746,7 +3746,7 @@ package body Sem_Ch5 is and then Ekind (Homonym (Ent)) = E_Label then Set_Entity (Id, Ent); - Set_Ekind (Ent, E_Loop); + Mutate_Ekind (Ent, E_Loop); end if; else @@ -3761,7 +3761,7 @@ package body Sem_Ch5 is if Ekind (Ent) = E_Label then Reinit_Field_To_Zero (Ent, Enclosing_Scope); - Set_Ekind (Ent, E_Loop); + Mutate_Ekind (Ent, E_Loop); if Nkind (Parent (Ent)) = N_Implicit_Label_Declaration then Set_Label_Construct (Parent (Ent), N); @@ -3925,7 +3925,7 @@ package body Sem_Ch5 is if not Of_Present (I_Spec) or else not Is_Variable (Name (I_Spec)) then - Set_Ekind (Id, E_Loop_Parameter); + Mutate_Ekind (Id, E_Loop_Parameter); end if; end; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index c2b5c4d..cbba916 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1796,7 +1796,7 @@ package body Sem_Ch6 is end if; if Nkind (N) = N_Subprogram_Body_Stub then - Set_Ekind (Defining_Entity (Specification (N)), Kind); + Mutate_Ekind (Defining_Entity (Specification (N)), Kind); else Set_Corresponding_Spec (N, Gen_Id); end if; @@ -1847,13 +1847,13 @@ package body Sem_Ch6 is -- Visible generic entity is callable within its own body - Set_Ekind (Gen_Id, Ekind (Body_Id)); + Mutate_Ekind (Gen_Id, Ekind (Body_Id)); Reinit_Field_To_Zero (Body_Id, Has_Out_Or_In_Out_Parameter, Old_Ekind => (E_Function | E_Procedure | E_Generic_Function | E_Generic_Procedure => True, others => False)); - Set_Ekind (Body_Id, E_Subprogram_Body); + Mutate_Ekind (Body_Id, E_Subprogram_Body); Set_Convention (Body_Id, Convention (Gen_Id)); Set_Is_Obsolescent (Body_Id, Is_Obsolescent (Gen_Id)); Set_Scope (Body_Id, Scope (Gen_Id)); @@ -1864,8 +1864,8 @@ package body Sem_Ch6 is -- No body to analyze, so restore state of generic unit - Set_Ekind (Gen_Id, Kind); - Set_Ekind (Body_Id, Kind); + Mutate_Ekind (Gen_Id, Kind); + Mutate_Ekind (Body_Id, Kind); if Present (First_Ent) then Set_First_Entity (Gen_Id, First_Ent); @@ -1931,7 +1931,7 @@ package body Sem_Ch6 is Reinit_Field_To_Zero (Gen_Id, Has_Nested_Subprogram, Old_Ekind => (E_Function | E_Procedure => True, others => False)); - Set_Ekind (Gen_Id, Kind); + Mutate_Ekind (Gen_Id, Kind); Generate_Reference (Gen_Id, Body_Id, 'b', Set_Ref => False); if Style_Check then @@ -2026,7 +2026,7 @@ package body Sem_Ch6 is if Present (Prev) and then Is_Generic_Subprogram (Prev) then Insert_Before (N, Null_Body); - Set_Ekind (Defining_Entity (N), Ekind (Prev)); + Mutate_Ekind (Defining_Entity (N), Ekind (Prev)); Rewrite (N, Make_Null_Statement (Loc)); Analyze_Generic_Subprogram_Body (Null_Body, Prev); @@ -4622,7 +4622,7 @@ package body Sem_Ch6 is Reinit_Field_To_Zero (Body_Id, Receiving_Entry); end if; - Set_Ekind (Body_Id, E_Subprogram_Body); + Mutate_Ekind (Body_Id, E_Subprogram_Body); if Nkind (N) = N_Subprogram_Body_Stub then Set_Corresponding_Spec_Of_Stub (N, Spec_Id); @@ -5787,10 +5787,10 @@ package body Sem_Ch6 is end if; if Nkind (N) = N_Function_Specification then - Set_Ekind (Designator, E_Function); + Mutate_Ekind (Designator, E_Function); Set_Mechanism (Designator, Default_Mechanism); else - Set_Ekind (Designator, E_Procedure); + Mutate_Ekind (Designator, E_Procedure); Set_Etype (Designator, Standard_Void_Type); end if; @@ -8796,7 +8796,7 @@ package body Sem_Ch6 is return Empty; end if; - Set_Ekind (EF, E_In_Parameter); + Mutate_Ekind (EF, E_In_Parameter); Set_Actual_Subtype (EF, Typ); Set_Etype (EF, Typ); Set_Scope (EF, Scope); @@ -12984,30 +12984,30 @@ package body Sem_Ch6 is end if; if In_Present (Spec) then - Set_Ekind (Formal_Id, E_In_Out_Parameter); + Mutate_Ekind (Formal_Id, E_In_Out_Parameter); else - Set_Ekind (Formal_Id, E_Out_Parameter); + Mutate_Ekind (Formal_Id, E_Out_Parameter); end if; -- But not in earlier versions of Ada else Error_Msg_N ("functions can only have IN parameters", Spec); - Set_Ekind (Formal_Id, E_In_Parameter); + Mutate_Ekind (Formal_Id, E_In_Parameter); end if; elsif In_Present (Spec) then - Set_Ekind (Formal_Id, E_In_Out_Parameter); + Mutate_Ekind (Formal_Id, E_In_Out_Parameter); else - Set_Ekind (Formal_Id, E_Out_Parameter); + Mutate_Ekind (Formal_Id, E_Out_Parameter); Set_Never_Set_In_Source (Formal_Id, True); Set_Is_True_Constant (Formal_Id, False); Set_Current_Value (Formal_Id, Empty); end if; else - Set_Ekind (Formal_Id, E_In_Parameter); + Mutate_Ekind (Formal_Id, E_In_Parameter); end if; -- Set Is_Known_Non_Null for access parameters since the language diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 2f65ff2..b71a26c 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -843,7 +843,7 @@ package body Sem_Ch7 is -- unannotated body will be used in all instantiations. Body_Id := Defining_Entity (N); - Set_Ekind (Body_Id, E_Package_Body); + Mutate_Ekind (Body_Id, E_Package_Body); Set_Scope (Body_Id, Scope (Spec_Id)); Set_Is_Obsolescent (Body_Id, Is_Obsolescent (Spec_Id)); Set_Body_Entity (Spec_Id, Body_Id); @@ -875,7 +875,7 @@ package body Sem_Ch7 is -- current node otherwise. Note that N was rewritten above, so we must -- be sure to get the latest Body_Id value. - Set_Ekind (Body_Id, E_Package_Body); + Mutate_Ekind (Body_Id, E_Package_Body); Set_Body_Entity (Spec_Id, Body_Id); Set_Spec_Entity (Body_Id, Spec_Id); @@ -1161,7 +1161,7 @@ package body Sem_Ch7 is Generate_Definition (Id); Enter_Name (Id); - Set_Ekind (Id, E_Package); + Mutate_Ekind (Id, E_Package); Set_Etype (Id, Standard_Void_Type); -- Set SPARK_Mode from context @@ -2558,9 +2558,9 @@ package body Sem_Ch7 is end if; if Limited_Present (Def) then - Set_Ekind (Id, E_Limited_Private_Type); + Mutate_Ekind (Id, E_Limited_Private_Type); else - Set_Ekind (Id, E_Private_Type); + Mutate_Ekind (Id, E_Private_Type); end if; Set_Etype (Id, Id); @@ -2592,7 +2592,7 @@ package body Sem_Ch7 is Set_Private_Dependents (Id, New_Elmt_List); if Tagged_Present (Def) then - Set_Ekind (Id, E_Record_Type_With_Private); + Mutate_Ekind (Id, E_Record_Type_With_Private); Set_Direct_Primitive_Operations (Id, New_Elmt_List); Set_Is_Abstract_Type (Id, Abstract_Present (Def)); Set_Is_Limited_Record (Id, Limited_Present (Def)); diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index b88a36a..127896e 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -572,7 +572,7 @@ package body Sem_Ch8 is Enter_Name (Id); Analyze (Nam); - Set_Ekind (Id, E_Exception); + Mutate_Ekind (Id, E_Exception); Set_Etype (Id, Standard_Exception_Type); Set_Is_Pure (Id, Is_Pure (Current_Scope)); @@ -701,7 +701,7 @@ package body Sem_Ch8 is end if; Enter_Name (New_P); - Set_Ekind (New_P, K); + Mutate_Ekind (New_P, K); if Etype (Old_P) = Any_Type then null; @@ -984,7 +984,7 @@ package body Sem_Ch8 is Error_Msg_N ("object name or value expected in renaming", Nam); - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); Set_Etype (Id, Any_Type); return; @@ -1032,7 +1032,7 @@ package body Sem_Ch8 is Error_Msg_N ("object name or value expected in renaming", Nam); - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); Set_Etype (Id, Any_Type); return; @@ -1145,7 +1145,7 @@ package body Sem_Ch8 is and then Comes_From_Source (N) then Set_Etype (Id, T); - Set_Ekind (Id, E_Constant); + Mutate_Ekind (Id, E_Constant); Rewrite (N, Make_Object_Declaration (Loc, Defining_Identifier => Id, @@ -1458,7 +1458,7 @@ package body Sem_Ch8 is -- want to change it to a variable. if Ekind (Id) /= E_Constant then - Set_Ekind (Id, E_Variable); + Mutate_Ekind (Id, E_Variable); end if; Init_Object_Size_Align (Id); @@ -1536,7 +1536,7 @@ package body Sem_Ch8 is Set_Etype (Id, T2); if not Is_Variable (Nam) then - Set_Ekind (Id, E_Constant); + Mutate_Ekind (Id, E_Constant); Set_Never_Set_In_Source (Id, True); Set_Is_True_Constant (Id, True); end if; @@ -1632,7 +1632,7 @@ package body Sem_Ch8 is -- Set basic attributes to minimize cascaded errors - Set_Ekind (New_P, E_Package); + Mutate_Ekind (New_P, E_Package); Set_Etype (New_P, Standard_Void_Type); elsif Present (Renamed_Entity (Old_P)) @@ -1647,7 +1647,7 @@ package body Sem_Ch8 is -- Set basic attributes to minimize cascaded errors - Set_Ekind (New_P, E_Package); + Mutate_Ekind (New_P, E_Package); Set_Etype (New_P, Standard_Void_Type); -- Here for OK package renaming @@ -1657,7 +1657,7 @@ package body Sem_Ch8 is -- entity. The simplest implementation is to have both packages share -- the entity list. - Set_Ekind (New_P, E_Package); + Mutate_Ekind (New_P, E_Package); Set_Etype (New_P, Standard_Void_Type); if Present (Renamed_Object (Old_P)) then @@ -3281,7 +3281,7 @@ package body Sem_Ch8 is Reinit_Field_To_Zero (New_S, Has_Out_Or_In_Out_Parameter); Reinit_Field_To_Zero (New_S, Needs_No_Actuals, Old_Ekind => (E_Function | E_Procedure => True, others => False)); - Set_Ekind (New_S, E_Subprogram_Body); + Mutate_Ekind (New_S, E_Subprogram_Body); New_S := Rename_Spec; Set_Has_Completion (Rename_Spec, False); diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index c8962a9..dd5f6e1 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -1232,9 +1232,9 @@ package body Sem_Ch9 is Analyze (Formals); if Present (Entry_Index_Specification (Formals)) then - Set_Ekind (Id, E_Entry_Family); + Mutate_Ekind (Id, E_Entry_Family); else - Set_Ekind (Id, E_Entry); + Mutate_Ekind (Id, E_Entry); end if; Set_Etype (Id, Standard_Void_Type); @@ -1551,13 +1551,13 @@ package body Sem_Ch9 is -- Case of no discrete subtype definition if No (D_Sdef) then - Set_Ekind (Def_Id, E_Entry); + Mutate_Ekind (Def_Id, E_Entry); -- Processing for discrete subtype definition present else Enter_Name (Def_Id); - Set_Ekind (Def_Id, E_Entry_Family); + Mutate_Ekind (Def_Id, E_Entry_Family); Analyze (D_Sdef); Make_Index (D_Sdef, N, Def_Id); @@ -1722,11 +1722,11 @@ package body Sem_Ch9 is Make_Index (Def, N); end if; - Set_Ekind (Loop_Id, E_Loop); + Mutate_Ekind (Loop_Id, E_Loop); Set_Scope (Loop_Id, Current_Scope); Push_Scope (Loop_Id); Enter_Name (Iden); - Set_Ekind (Iden, E_Entry_Index_Parameter); + Mutate_Ekind (Iden, E_Entry_Index_Parameter); Set_Etype (Iden, Etype (Def)); end Analyze_Entry_Index_Specification; @@ -1808,7 +1808,7 @@ package body Sem_Ch9 is Freeze_Previous_Contracts (N); Tasking_Used := True; - Set_Ekind (Body_Id, E_Protected_Body); + Mutate_Ekind (Body_Id, E_Protected_Body); Set_Etype (Body_Id, Standard_Void_Type); Spec_Id := Find_Concurrent_Spec (Body_Id); @@ -2024,7 +2024,7 @@ package body Sem_Ch9 is Set_Completion_Referenced (T); end if; - Set_Ekind (T, E_Protected_Type); + Mutate_Ekind (T, E_Protected_Type); Set_Is_First_Subtype (T); Init_Size_Align (T); Set_Etype (T, T); @@ -2138,7 +2138,7 @@ package body Sem_Ch9 is E := First_Entity (Current_Scope); while Present (E) loop if Ekind (E) = E_Void then - Set_Ekind (E, E_Component); + Mutate_Ekind (E, E_Component); Init_Component_Location (E); end if; @@ -2775,12 +2775,12 @@ package body Sem_Ch9 is -- its own body. Enter_Name (Typ); - Set_Ekind (Typ, E_Protected_Type); + Mutate_Ekind (Typ, E_Protected_Type); Set_Etype (Typ, Typ); Set_Anonymous_Object (Typ, Obj_Id); Enter_Name (Obj_Id); - Set_Ekind (Obj_Id, E_Variable); + Mutate_Ekind (Obj_Id, E_Variable); Set_Etype (Obj_Id, Typ); Set_SPARK_Pragma (Obj_Id, SPARK_Mode_Pragma); Set_SPARK_Pragma_Inherited (Obj_Id); @@ -2861,12 +2861,12 @@ package body Sem_Ch9 is -- in its own body. Enter_Name (Typ); - Set_Ekind (Typ, E_Task_Type); + Mutate_Ekind (Typ, E_Task_Type); Set_Etype (Typ, Typ); Set_Anonymous_Object (Typ, Obj_Id); Enter_Name (Obj_Id); - Set_Ekind (Obj_Id, E_Variable); + Mutate_Ekind (Obj_Id, E_Variable); Set_Etype (Obj_Id, Typ); Set_SPARK_Pragma (Obj_Id, SPARK_Mode_Pragma); Set_SPARK_Pragma_Inherited (Obj_Id); @@ -2922,7 +2922,7 @@ package body Sem_Ch9 is Tasking_Used := True; Set_Scope (Body_Id, Current_Scope); - Set_Ekind (Body_Id, E_Task_Body); + Mutate_Ekind (Body_Id, E_Task_Body); Set_Etype (Body_Id, Standard_Void_Type); Spec_Id := Find_Concurrent_Spec (Body_Id); @@ -3139,12 +3139,12 @@ package body Sem_Ch9 is Set_Completion_Referenced (T); else - Set_Ekind (T, E_Task_Type); + Mutate_Ekind (T, E_Task_Type); Set_Corresponding_Record_Type (T, Empty); end if; end if; - Set_Ekind (T, E_Task_Type); + Mutate_Ekind (T, E_Task_Type); Set_Is_First_Subtype (T, True); Set_Has_Task (T, True); Init_Size_Align (T); diff --git a/gcc/ada/sem_dist.adb b/gcc/ada/sem_dist.adb index 15767cf..ff76c75 100644 --- a/gcc/ada/sem_dist.adb +++ b/gcc/ada/sem_dist.adb @@ -660,7 +660,7 @@ package body Sem_Dist is -- Corresponding_Remote_Type attribute, whose presence indicates that -- this is the record type used to implement a RAS. - Set_Ekind (Fat_Type, E_Record_Type); + Mutate_Ekind (Fat_Type, E_Record_Type); Set_Corresponding_Remote_Type (Fat_Type, User_Type); Insert_After_And_Analyze (Subpkg_Body, Fat_Type_Decl); diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index ac99e1d..2142983 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -11887,7 +11887,7 @@ package body Sem_Elab is -- Partially decorate the elaboration procedure because it will not -- be insertred into the tree and analyzed. - Set_Ekind (Proc_Id, E_Procedure); + Mutate_Ekind (Proc_Id, E_Procedure); Set_Etype (Proc_Id, Standard_Void_Type); Set_Scope (Proc_Id, Unique_Entity (Main_Unit_Entity)); @@ -12012,7 +12012,7 @@ package body Sem_Elab is -- it will not be inserted into the tree and analyzed. Task_Obj := Make_Temporary (Loc, 'T'); - Set_Ekind (Task_Obj, E_Variable); + Mutate_Ekind (Task_Obj, E_Variable); Set_Etype (Task_Obj, Task_Typ); -- Associate the dummy task object with the activation call diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 4eb2732..5b1173c 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -11978,7 +11978,7 @@ package body Sem_Prag is Set_Comes_From_Source (State_Id, not Is_Null); Set_Parent (State_Id, State); - Set_Ekind (State_Id, E_Abstract_State); + Mutate_Ekind (State_Id, E_Abstract_State); Set_Etype (State_Id, Standard_Void_Type); Set_Encapsulating_State (State_Id, Empty); diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 5c1368e..3b5775e 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -8553,7 +8553,7 @@ package body Sem_Util is -- will be detected. Any_Type insures that no cascaded errors will occur else - Set_Ekind (Def_Id, E_Void); + Mutate_Ekind (Def_Id, E_Void); Set_Etype (Def_Id, Any_Type); end if; @@ -24441,7 +24441,7 @@ package body Sem_Util is (Chars (Related_Id), Suffix, Suffix_Index, Prefix)); begin - Set_Ekind (N, Kind); + Mutate_Ekind (N, Kind); Set_Is_Internal (N, True); Append_Entity (N, Scope_Id); Set_Public_Status (N); @@ -24466,7 +24466,7 @@ package body Sem_Util is N : constant Entity_Id := Make_Temporary (Sloc_Value, Id_Char); begin - Set_Ekind (N, Kind); + Mutate_Ekind (N, Kind); Set_Is_Internal (N, True); Append_Entity (N, Scope_Id); @@ -31242,9 +31242,9 @@ package body Sem_Util is (Loc, Access_Type_Id, Type_Definition => Access_Type_Def); begin - Set_Ekind (Temp_Id, E_Variable); + Mutate_Ekind (Temp_Id, E_Variable); Set_Etype (Temp_Id, Access_Type_Id); - Set_Ekind (Access_Type_Id, E_Access_Type); + Mutate_Ekind (Access_Type_Id, E_Access_Type); if Append_Decls_In_Reverse_Order then Append_Item (Temp_Decl, Is_Eval_Stmt => False); diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 6a155be..9101abb 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -23,7 +23,7 @@ -- -- ------------------------------------------------------------------------------ --- This package defines the structure of the abstract syntax tree. The Tree +-- This package documents the structure of the abstract syntax tree. The Atree -- package provides a basic tree structure. Sinfo describes how this structure -- is used to represent the syntax of an Ada program. @@ -37,8 +37,15 @@ -- would normally be regarded as the symbol table information. In addition a -- number of the tree nodes contain semantic information. --- WARNING: Several files are automatically generated from this package. --- See below for details. +-- See the spec of Gen_IL.Gen for instructions on making changes to this file. +-- Note that the official definition of what nodes have what fields is in +-- Gen_IL.Gen.Gen_Nodes; if there is a discrepancy between that and the +-- comments here, Gen_IL.Gen.Gen_Nodes wins. +-- +-- Offsets of each field are given in parentheses below, but this information +-- is obsolete, and should be completely ignored. The actual field offsets are +-- determined by the Gen_IL program. We might want to remove these comments at +-- some point. pragma Warnings (Off); -- with/use clauses for children with Namet; use Namet; @@ -49,84 +56,67 @@ pragma Warnings (On); package Sinfo is - -- ????Comments below are partly obsolete - - --------------------------------- - -- Making Changes to This File -- - --------------------------------- - - -- If changes are made to this file, a number of related steps must be - -- carried out to ensure consistency. First, if a field access function is - -- added, it appears in these places: - - -- In sinfo.ads: - -- The documentation associated with the field (if semantic) - -- The documentation associated with the node - -- The spec of the access function - -- The spec of the set procedure - -- The entries in Is_Syntactic_Field - -- The pragma Inline for the access function - -- The pragma Inline for the set procedure - -- In sinfo.adb: - -- The body of the access function - -- The body of the set procedure - - -- The field chosen must be consistent in all places, and, for a node that - -- is a subexpression, must not overlap any of the standard expression - -- fields. - - -- In addition, if any of the standard expression fields is changed, then - -- the utility program which creates the Treeprs spec (in file treeprs.ads) - -- must be updated appropriately, since it special cases expression fields. - - -- If a new tree node is added, then the following changes are made: - - -- Add it to the documentation in the appropriate place - -- Add its fields to this documentation section - -- Define it in the appropriate classification in Node_Kind - -- Add an entry in Is_Syntactic_Field - -- In the body (sinfo), add entries to the access functions for all - -- its fields (except standard expression fields) to include the new - -- node in the checks. - -- Add an appropriate section to the case statement in sprint.adb - -- Add an appropriate section to the case statement in sem.adb - -- Add an appropriate section to the case statement in exp_util.adb - -- (Insert_Actions procedure) - -- For a subexpression, add an appropriate section to the case - -- statement in sem_eval.adb - -- For a subexpression, add an appropriate section to the case - -- statement in sem_res.adb - - -- All back ends must be made aware of the new node kind. - - -- Finally, four utility programs must be run: - - -- (Optional.) Run CSinfo to check that you have made the changes - -- consistently. It checks most of the rules given above. This utility - -- reads sinfo.ads and sinfo.adb and generates a report to standard - -- output. This step is optional because XSinfo runs CSinfo. - - -- Run XSinfo to create sinfo.h, the corresponding C header. This - -- utility reads sinfo.ads and generates sinfo.h. Note that it does - -- not need to read sinfo.adb, since the contents of the body are - -- algorithmically determinable from the spec. - - -- Run XTreeprs to create treeprs.ads, an updated version of the module - -- that is used to drive the tree print routine. This utility reads (but - -- does not modify) treeprs.adt, the template that provides the basic - -- structure of the file, and then fills in the data from the comments - -- in sinfo.ads. - - -- Run XNmake to create nmake.ads and nmake.adb, the package body and - -- spec of the Nmake package which contains functions for constructing - -- nodes. - - -- The above steps are done automatically by the build scripts when you do - -- a full bootstrap. - - -- Note: sometime we could write a utility that actually generated the body - -- of sinfo from the spec instead of simply checking it, since, as noted - -- above, the contents of the body can be determined from the spec. + ---------------------------------------- + -- Definitions of fields in tree node -- + ---------------------------------------- + + -- The following fields are common to all nodes: + + -- Nkind Indicates the kind of the node. This field is present + -- in all nodes. + + -- Sloc Location (Source_Ptr) of the corresponding token + -- in the Source buffer. The individual node definitions + -- show which token is referenced by this pointer. + + -- In_List A flag used to indicate if the node is a member + -- of a node list (see package Nlists). + + -- Rewrite_Ins A flag set if a node is marked as a rewrite inserted + -- node as a result of a call to Mark_Rewrite_Insertion. + + -- Small_Paren_Count + -- A 2-bit count used in subexpression nodes to indicate + -- the level of parentheses. The settings are 0,1,2 and + -- 3 for many. If the value is 3, then an auxiliary table + -- is used to indicate the real value, which is computed by + -- Paren_Count. Set to zero for nonsubexpression nodes. + + -- Note: the required parentheses surrounding conditional + -- and quantified expressions count as a level of parens + -- for this purpose, so e.g. in X := (if A then B else C); + -- Paren_Count for the right side will be 1. + + -- Comes_From_Source + -- This flag is present in all nodes. It is set if the + -- node is built by the scanner or parser, and clear if + -- the node is built by the analyzer or expander. It + -- indicates that the node corresponds to a construct + -- that appears in the original source program. + + -- Analyzed This flag is present in all nodes. It is set when + -- a node is analyzed, and is used to avoid analyzing + -- the same node twice. Analysis includes expansion if + -- expansion is active, so in this case if the flag is + -- set it means the node has been analyzed and expanded. + + -- Error_Posted This flag is present in all nodes. It is set when + -- an error message is posted which is associated with + -- the flagged node. This is used to avoid posting more + -- than one message on the same node. + + -- Link For a node, points to the Parent. For a list, points + -- to the list header. Note that in the latter case, a + -- client cannot modify the link field. This field is + -- private to the Atree package (but is also modified + -- by the Nlists package). + + -- The following additional fields are common to all entities (that is, + -- nodes whose Nkind is in N_Entity): + + -- Ekind Entity type. + + -- Convention Entity convention (Convention_Id value) -------------------------------- -- Implicit Nodes in the Tree -- @@ -1328,7 +1318,7 @@ package Sinfo is -- expansion of aggregates is also used for in-place array aggregate -- assignment or initialization. When the full context is known, the -- target of the assignment or initialization is used to generate the - -- left-hand side of individual assignment to each sub-component. + -- left-hand side of individual assignment to each subcomponent. -- Expression_Copy (Node2-Sem) -- Present in N_Pragma_Argument_Association nodes. Contains a copy of the -- 2.7.4