aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2010-06-22 07:11:35 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-22 09:11:35 +0200
commit196379c6f705582c047916b79e0ea1feded3b9cf (patch)
treebb1f6d153df51a982dba32067afdaeffdb5f2a79 /gcc
parentf0d103851aea8fdb96bde64a44b8bac395ef6384 (diff)
downloadgcc-196379c6f705582c047916b79e0ea1feded3b9cf.zip
gcc-196379c6f705582c047916b79e0ea1feded3b9cf.tar.gz
gcc-196379c6f705582c047916b79e0ea1feded3b9cf.tar.bz2
sem_res.adb (Resolve_Call): If the call is rewritten as an indexed of a parameterless function call...
2010-06-22 Ed Schonberg <schonberg@adacore.com> * 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/exp_util.adb11
-rw-r--r--gcc/ada/sem_attr.adb1
-rw-r--r--gcc/ada/sem_res.adb3
4 files changed, 26 insertions, 0 deletions
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 <schonberg@adacore.com>
+
+ * 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 <dismukes@adacore.com>
* 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);