]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Reuse Is_Rewrite_Substitution where possible
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 18 May 2026 18:19:07 +0000 (20:19 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 4 Jun 2026 08:42:24 +0000 (10:42 +0200)
Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* errout.adb, exp_util.adb, sem_case.adb, sem_ch4.adb, sem_res.adb:
Replace low-lever inequality with a high-level routine.

gcc/ada/errout.adb
gcc/ada/exp_util.adb
gcc/ada/sem_case.adb
gcc/ada/sem_ch4.adb
gcc/ada/sem_res.adb

index cf11a0a6c1cab280ef4579dba9fb91e0ac67b2b0..2263168bbba8eebe07985902a357e8a73d95ac60 100644 (file)
@@ -3752,7 +3752,7 @@ package body Errout is
             --  Handle direct attribute definitions
 
             if Parent_Kind (Node) in N_Subprogram_Specification
-              and then Original_Node (Parent (Node)) /= Parent (Node)
+              and then Is_Rewrite_Substitution (Parent (Node))
               and then Nkind (Defining_Unit_Name
                                (Original_Node (Parent (Node))))
                          = N_Attribute_Reference
index d10bd801ef6ec5cd3558f8b4b4cc357ea1725245..7a19c6c1d04568e2b8f5a9dfd7806c852715a973 100644 (file)
@@ -6829,7 +6829,7 @@ package body Exp_Util is
       --  early return if we have no more statements or they have been
       --  rewritten, which means that they were in the source code.
 
-      elsif No (Stmt) or else Original_Node (Stmt) /= Stmt then
+      elsif No (Stmt) or else Is_Rewrite_Substitution (Stmt) then
          return Last_Init;
 
       --  In all other cases the initialization calls follow the related
index b3c38999e3bde47fa277b3ac04cb5245d0175375..7c29fbea341220a65525e4f9a4e5431fe31301af 100644 (file)
@@ -1698,7 +1698,7 @@ package body Sem_Case is
                elsif Nkind (Expr) = N_Type_Conversion
                   and then not Comes_From_Source (Expr)
                then
-                  if Expr /= Original_Node (Expr) then
+                  if Is_Rewrite_Substitution (Expr) then
                      Traverse_Choice (Original_Node (Expr));
                   else
                      Traverse_Choice (Expression (Expr));
index 8eb017ee838583612b4e64e6247fc6e866cd9ea2..1ea77679ef315a6410a06cf34039cc3af3c42c87 100644 (file)
@@ -274,7 +274,7 @@ package body Sem_Ch4 is
    is (Is_Visible_Operator (N => N, Typ => Typ)
          or else
            --  test for a rewritten Foo."+" call
-           (N /= Original_Node (N)
+           (Is_Rewrite_Substitution (N)
              and then Is_Effectively_Visible_Operator
                         (N => Original_Node (N), Typ => Typ))
          or else Checking_Potentially_Static_Expression
index 9dc8afecd4f577432ec7d23470ed44314ba8b52e..2d23b3f856792a867a9e15c92990ad19b76b3db1 100644 (file)
@@ -2053,7 +2053,7 @@ package body Sem_Res is
       Parent_Id : Node_Id;
    begin
       if Nkind (IBT_Decl) = N_Full_Type_Declaration
-        and then Original_Node (IBT_Decl) /= IBT_Decl
+        and then Is_Rewrite_Substitution (IBT_Decl)
         and then Nkind (Original_Node (IBT_Decl)) =
                  N_Full_Type_Declaration
         and then Nkind (Type_Definition (Original_Node (IBT_Decl)))