From 196379c6f705582c047916b79e0ea1feded3b9cf Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Tue, 22 Jun 2010 07:11:35 +0000 Subject: sem_res.adb (Resolve_Call): If the call is rewritten as an indexed of a parameterless function call... 2010-06-22 Ed Schonberg * sem_res.adb (Resolve_Call): If the call is rewritten as an indexed of a parameterless function call, preserve parentheses of original expression, for proper handling by pretty printer. * sem_attr.adb (Analyze_Attribute, case 'Old): Add guard to Process procedure, to handle quietly identifiers that have no entity names. * exp_util.adb (Get_Current_Value_Condition): If the parent of an elsif_part is missing, it has been rewritten as a nested if, and there is no useful information on the current value of the variable. From-SVN: r161136 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/exp_util.adb | 11 +++++++++++ gcc/ada/sem_attr.adb | 1 + gcc/ada/sem_res.adb | 3 +++ 4 files changed, 26 insertions(+) (limited to 'gcc') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index fcc8c88..ec822d3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2010-06-22 Ed Schonberg + + * sem_res.adb (Resolve_Call): If the call is rewritten as an indexed of + a parameterless function call, preserve parentheses of original + expression, for proper handling by pretty printer. + * sem_attr.adb (Analyze_Attribute, case 'Old): Add guard to Process + procedure, to handle quietly identifiers that have no entity names. + * exp_util.adb (Get_Current_Value_Condition): If the parent of an + elsif_part is missing, it has been rewritten as a nested if, and there + is no useful information on the current value of the variable. + 2010-06-22 Gary Dismukes * sem_ch3.adb (Build_Discriminal): Set default scopes for newly created diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 1c4bc5b..f948ee1 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -2007,6 +2007,17 @@ package body Exp_Util is -- unknown before the ELSE part or after the IF statement. elsif Nkind (CV) = N_Elsif_Part then + + -- if the Elsif_Part had condition_actions, the elsif has been + -- rewritten as a nested if, and the original elsif_part is + -- detached from the tree, so there is no way to obtain useful + -- information on the current value of the variable. + -- Can this be improved ??? + + if No (Parent (CV)) then + return; + end if; + Stm := Parent (CV); -- Before start of ELSIF part diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index d27e528..a3dfdf0 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -3652,6 +3652,7 @@ package body Sem_Attr is function Process (N : Node_Id) return Traverse_Result is begin if Is_Entity_Name (N) + and then Present (Entity (N)) and then not Is_Formal (Entity (N)) and then Enclosing_Subprogram (Entity (N)) = Subp then diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index fcf5a2c9..89b5e1b 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -5085,7 +5085,10 @@ package body Sem_Res is -- Since we are correcting a node classification error made -- by the parser, we call Replace rather than Rewrite. + -- Preserve the parenthesis count of the node, for use by + -- tools. + Set_Paren_Count (Index_Node, Paren_Count (N)); Replace (N, Index_Node); Set_Etype (Prefix (N), Ret_Type); Set_Etype (N, Typ); -- cgit v1.1