[Ada] Use high-level Make_Character_Literal instead of low-level New_Node
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 20 Jan 2021 11:41:16 +0000 (12:41 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 6 May 2021 07:51:36 +0000 (03:51 -0400)
gcc/ada/

* sem_case.adb (Missing_Choice): Fix typo in comment.
(Lit_Of): Simplify with Make_Character_Literal.
(Check_Choices): Remove extra spaces in parameter
specifications.
* sem_case.ads: Same reformatting.

gcc/ada/sem_case.adb
gcc/ada/sem_case.ads

index df30610..f4a0716 100644 (file)
@@ -696,7 +696,7 @@ package body Sem_Case is
          elsif Value1 > Value2 then
             return;
 
-         --  If predicate is already known to be violated, do no check for
+         --  If predicate is already known to be violated, do not check for
          --  coverage error, to prevent cascaded messages.
 
          elsif Predicate_Error then
@@ -1069,9 +1069,10 @@ package body Sem_Case is
 
          if Is_Standard_Character_Type (Choice_Type) then
             Set_Character_Literal_Name (Char_Code (UI_To_Int (Value)));
-            Lit := New_Node (N_Character_Literal, Loc);
-            Set_Chars (Lit, Name_Find);
-            Set_Char_Literal_Value (Lit, Value);
+            Lit :=
+              Make_Character_Literal (Loc,
+                Chars              => Name_Find,
+                Char_Literal_Value => Value);
             Set_Etype (Lit, Choice_Type);
             Set_Is_Static_Expression (Lit, True);
             return Lit;
@@ -1319,10 +1320,10 @@ package body Sem_Case is
       -------------------
 
       procedure Check_Choices
-        (N                        : Node_Id;
-         Alternatives             : List_Id;
-         Subtyp                   : Entity_Id;
-         Others_Present           : out Boolean)
+        (N              : Node_Id;
+         Alternatives   : List_Id;
+         Subtyp         : Entity_Id;
+         Others_Present : out Boolean)
       is
          E : Entity_Id;
 
index 00b7dd3..7bde09d 100644 (file)
@@ -125,10 +125,10 @@ package Sem_Case is
    package Generic_Check_Choices is
 
       procedure Check_Choices
-        (N                        : Node_Id;
-         Alternatives             : List_Id;
-         Subtyp                   : Entity_Id;
-         Others_Present           : out Boolean);
+        (N              : Node_Id;
+         Alternatives   : List_Id;
+         Subtyp         : Entity_Id;
+         Others_Present : out Boolean);
       --  From a case expression, case statement, or record variant N, this
       --  routine analyzes the corresponding list of discrete choices which
       --  appear in each element of the list Alternatives (for the variant