From: Piotr Trojanek <[email protected]>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/contracts.adb | 4 ++--
gcc/ada/exp_attr.adb | 8 ++++----
gcc/ada/exp_ch3.adb | 5 ++---
gcc/ada/sem_ch12.adb | 15 +++++----------
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 1c9161b8a37..8b94a67639f 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 cc42d647060..b896228a70e 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 d95b9178030..0dfd8102df1 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 088a9ccfb58..dad8c73729e 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 cf6ab68d4e6..64e3f85c605 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
--
2.43.0