diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2024-12-23 10:05:47 +0100 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2025-01-10 10:39:56 +0100 |
commit | c43a53307d2e26663e9a2aca39672aea39c25e7b (patch) | |
tree | 687dd0ebf8c36edeeea02b4d4a5fb6bcb1e2f5e4 | |
parent | 8c850ddf0f2648e9be6067bb76cc2322c1a8b6a5 (diff) | |
download | gcc-c43a53307d2e26663e9a2aca39672aea39c25e7b.zip gcc-c43a53307d2e26663e9a2aca39672aea39c25e7b.tar.gz gcc-c43a53307d2e26663e9a2aca39672aea39c25e7b.tar.bz2 |
ada: Set syntactic node properties immediately when crating the nodes
When creating a node, we can directly set its syntactic properties.
Code cleanup; semantics is unaffected.
gcc/ada/ChangeLog:
* contracts.adb (Build_Call_Helper_Decl): Tune whitespace.
* exp_attr.adb (Analyze_Attribute): Set Of_Present while
creating the node; reorder setting Subtype_Indication to match the
syntax order.
* exp_ch3.adb (Build_Equivalent_Aggregate): Likewise for Box_Present
and Expression properties.
* sem_ch12.adb (Analyze_Formal_Derived_Type): Set type properties
when creating the nodes.
* sem_ch3.adb (Check_Anonymous_Access_Component): Likewise.
-rw-r--r-- | gcc/ada/contracts.adb | 4 | ||||
-rw-r--r-- | gcc/ada/exp_attr.adb | 8 | ||||
-rw-r--r-- | gcc/ada/exp_ch3.adb | 5 | ||||
-rw-r--r-- | gcc/ada/sem_ch12.adb | 15 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 13 |
5 files changed, 19 insertions, 26 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 1c9161b..8b94a67 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -4066,8 +4066,8 @@ package body Contracts is begin Spec := Build_Call_Helper_Spec (Helper_Id); - Set_Must_Override (Spec, False); - Set_Must_Not_Override (Spec, False); + Set_Must_Override (Spec, False); + Set_Must_Not_Override (Spec, False); Set_Is_Inlined (Helper_Id); Set_Is_Public (Helper_Id); diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index cc42d64..b896228 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -6422,10 +6422,10 @@ package body Exp_Attr is begin Iter := Make_Iterator_Specification (Loc, - Defining_Identifier => Elem, - Name => Relocate_Node (Prefix (N)), - Subtype_Indication => Empty); - Set_Of_Present (Iter); + Defining_Identifier => Elem, + Subtype_Indication => Empty, + Of_Present => True, + Name => Relocate_Node (Prefix (N))); New_Loop := Make_Loop_Statement (Loc, Iteration_Scheme => diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index d95b917..0dfd810 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -1349,9 +1349,8 @@ package body Exp_Ch3 is Append_To (Component_Associations (Aggr), Make_Component_Association (Loc, - Choices => New_List (Make_Others_Choice (Loc)), - Expression => Empty)); - Set_Box_Present (Last (Component_Associations (Aggr))); + Choices => New_List (Make_Others_Choice (Loc)), + Box_Present => True)); if Typ /= Full_Typ then Analyze_And_Resolve (Aggr, Full_View (Base_Type (Full_Typ))); diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 088a9cc..dad8c73 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -3097,13 +3097,11 @@ package body Sem_Ch12 is Defining_Identifier => T, Discriminant_Specifications => Discriminant_Specifications (N), Unknown_Discriminants_Present => Unk_Disc, + Abstract_Present => Abstract_Present (Def), + Limited_Present => Limited_Present (Def), Subtype_Indication => Subtype_Mark (Def), + Synchronized_Present => Synchronized_Present (Def), Interface_List => Interface_List (Def)); - - Set_Abstract_Present (New_N, Abstract_Present (Def)); - Set_Limited_Present (New_N, Limited_Present (Def)); - Set_Synchronized_Present (New_N, Synchronized_Present (Def)); - else New_N := Make_Full_Type_Declaration (Loc, @@ -3112,12 +3110,9 @@ package body Sem_Ch12 is Discriminant_Specifications (Parent (T)), Type_Definition => Make_Derived_Type_Definition (Loc, + Abstract_Present => Abstract_Present (Def), + Limited_Present => Limited_Present (Def), Subtype_Indication => Subtype_Mark (Def))); - - Set_Abstract_Present - (Type_Definition (New_N), Abstract_Present (Def)); - Set_Limited_Present - (Type_Definition (New_N), Limited_Present (Def)); end if; Rewrite (N, New_N); diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index cf6ab68..64e3f85 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -1409,10 +1409,10 @@ package body Sem_Ch3 is begin Decl := Make_Subtype_Declaration (Loc, - Defining_Identifier => Nam, - Subtype_Indication => + Defining_Identifier => Nam, + Null_Exclusion_Present => True, + Subtype_Indication => New_Occurrence_Of (Entity (S), Loc)); - Set_Null_Exclusion_Present (Decl); Insert_Before (Parent (Def), Decl); Analyze (Decl); Set_Entity (S, Nam); @@ -12191,11 +12191,10 @@ package body Sem_Ch3 is else Type_Def := Make_Access_To_Object_Definition (Loc, + All_Present => All_Present (Access_Def), + Constant_Present => Constant_Present (Access_Def), Subtype_Indication => - Relocate_Node (Subtype_Mark (Access_Def))); - - Set_Constant_Present (Type_Def, Constant_Present (Access_Def)); - Set_All_Present (Type_Def, All_Present (Access_Def)); + Relocate_Node (Subtype_Mark (Access_Def))); end if; Set_Null_Exclusion_Present |