From: Piotr Trojanek Date: Wed, 30 May 2018 08:57:33 +0000 (+0000) Subject: [Ada] Reuse Is_Rewrite_Substitution where possible X-Git-Tag: upstream/12.2.0~31356 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc67cfeaec73c486ae9018c75710feb3b94545bd;p=platform%2Fupstream%2Fgcc.git [Ada] Reuse Is_Rewrite_Substitution where possible Use a high-level Is_Rewrite_Substitution instead of a low-level inequality, with the intention to improve the code easier to read. Semantics unaffected, so no test provided. 2018-05-30 Piotr Trojanek gcc/ada/ * errout.adb, exp_aggr.adb, exp_ch7.adb, exp_util.adb, lib.adb, sem_ch13.adb, sem_ch4.adb, sem_res.adb, sem_util.adb (Has_Original_Node): Refactor to use Is_Rewrite_Substitution. From-SVN: r260935 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c6bd08b..8a5b510 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,11 @@ 2018-05-30 Piotr Trojanek + * errout.adb, exp_aggr.adb, exp_ch7.adb, exp_util.adb, lib.adb, + sem_ch13.adb, sem_ch4.adb, sem_res.adb, sem_util.adb + (Has_Original_Node): Refactor to use Is_Rewrite_Substitution. + +2018-05-30 Piotr Trojanek + * sem_prag.adb (Analyze_Pragma): Remove conjuncts that are always true. 2018-05-30 Hristian Kirtchev diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 0c661b6..587dcfe 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -2387,7 +2387,7 @@ package body Errout is end loop; if Nkind (N) = N_Raise_Constraint_Error - and then Original_Node (N) /= N + and then Is_Rewrite_Substitution (N) and then No (Condition (N)) then -- Warnings may have been posted on subexpressions of the original diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 691ba4b..e01d374 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -6089,7 +6089,7 @@ package body Exp_Aggr is -- that Convert_To_Positional succeeded and reanalyzed the rewritten -- aggregate. - elsif Analyzed (N) and then N /= Original_Node (N) then + elsif Analyzed (N) and then Is_Rewrite_Substitution (N) then return; end if; diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 59682de..37d1290 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -5255,7 +5255,7 @@ package body Exp_Ch7 is -- node. Inspect the original node to detect the initial placement -- of the call. - elsif Original_Node (N) /= N then + elsif Is_Rewrite_Substitution (N) then Detect_Subprogram_Call (Original_Node (N)); if Must_Hook then diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 0c1d4b8..0130307 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -4826,7 +4826,7 @@ package body Exp_Util is while Present (E) loop Force_Evaluation (E); - if Original_Node (E) /= E then + if Is_Rewrite_Substitution (E) then Set_Do_Range_Check (E, Do_Range_Check (Original_Node (E))); end if; diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb index 3e84f59..a052b34 100644 --- a/gcc/ada/lib.adb +++ b/gcc/ada/lib.adb @@ -1326,7 +1326,7 @@ package body Lib is Write_Str ("="); Write_Str (Node_Kind'Image (Nkind (Item))); - if Item /= Original_Node (Item) then + if Is_Rewrite_Substitution (Item) then Write_Str (", orig = "); Write_Int (Int (Original_Node (Item))); Write_Str ("="); diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index bdd9f4e..d9a0344 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -9643,7 +9643,7 @@ package body Sem_Ch13 is -- from the node, since we may have rewritten things and -- substituted an identifier representing the rewrite. - if Original_Node (Nod) /= Nod then + if Is_Rewrite_Substitution (Nod) then Check_Expr_Constants (Original_Node (Nod)); -- If the node is an object declaration without initial diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index f177417..1b8d8cb 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -1345,7 +1345,7 @@ package body Sem_Ch4 is -- parameter has been analyzed, but may need a subsequent -- dereference, so skip its analysis now. - if N /= Original_Node (N) + if Is_Rewrite_Substitution (N) and then Nkind (Original_Node (N)) = Nkind (N) and then Nkind (Name (N)) /= Nkind (Name (Original_Node (N))) and then Present (Parameter_Associations (N)) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index ca54ffc..a2788d9 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -12691,7 +12691,7 @@ package body Sem_Res is if Ada_Version >= Ada_2012 and then not Comes_From_Source (N) - and then N /= Original_Node (N) + and then Is_Rewrite_Substitution (N) and then Ekind (Target_Type) = E_General_Access_Type and then Ekind (Opnd_Type) = E_Anonymous_Access_Type then diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 7aafa8d..5004e32 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -15855,7 +15855,7 @@ package body Sem_Util is -- original node is a conversion, then Is_Variable will not be true -- but we still want to allow the conversion if it converts a variable). - elsif Original_Node (AV) /= AV then + elsif Is_Rewrite_Substitution (AV) then -- In Ada 2012, the explicit dereference may be a rewritten call to a -- Reference function.