https://gcc.gnu.org/g:10fcb9a8312df124c5ac054719fab951aeea34b5
commit r17-1332-g10fcb9a8312df124c5ac054719fab951aeea34b5 Author: Piotr Trojanek <[email protected]> Date: Mon May 18 20:19:07 2026 +0200 ada: Reuse Is_Rewrite_Substitution where possible 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. Diff: --- gcc/ada/errout.adb | 2 +- gcc/ada/exp_util.adb | 2 +- gcc/ada/sem_case.adb | 2 +- gcc/ada/sem_ch4.adb | 2 +- gcc/ada/sem_res.adb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index cf11a0a6c1ca..2263168bbba8 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -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 diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index d10bd801ef6e..7a19c6c1d045 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -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 diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb index b3c38999e3bd..7c29fbea3412 100644 --- a/gcc/ada/sem_case.adb +++ b/gcc/ada/sem_case.adb @@ -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)); diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 8eb017ee8385..1ea77679ef31 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -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 diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 9dc8afecd4f5..2d23b3f85679 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -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)))
