aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-10-13 14:55:07 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-10-13 14:55:07 +0200
commit07820c51656042bbed6eb9661d33d4bec1f04c47 (patch)
tree151e716580440504bdb8f192bc8c81b637af905f /gcc
parent5dc203d228f3bafc063278e4b6ef7954300b3908 (diff)
downloadgcc-07820c51656042bbed6eb9661d33d4bec1f04c47.zip
gcc-07820c51656042bbed6eb9661d33d4bec1f04c47.tar.gz
gcc-07820c51656042bbed6eb9661d33d4bec1f04c47.tar.bz2
Code cleanup.
From-SVN: r241113
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/contracts.adb13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index e26b28d..cd74cfcd 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -2030,11 +2030,13 @@ package body Contracts is
-- A protection field renaming appears as
-- Prot : ... := _object._object;
+ -- A renamed private component is just a component of
+ -- _object, with an arbitrary name.
+
elsif Ekind (Obj) = E_Variable
and then Nkind (Pref) = N_Identifier
and then Chars (Pref) = Name_uObject
and then Nkind (Sel) = N_Identifier
- and then Chars (Sel) = Name_uObject
then
return True;
end if;
@@ -2307,9 +2309,16 @@ package body Contracts is
-- Certain internally generated object renamings such as those
-- for discriminants and protection fields must be elaborated
-- before the preconditions are evaluated, as their expressions
- -- may mention the discriminants.
+ -- may mention the discriminants. The renamings include those
+ -- for private components so we need to find the last such.
elsif Is_Prologue_Renaming (Decl) then
+ while Present (Next (Decl))
+ and then Is_Prologue_Renaming (Next (Decl))
+ loop
+ Next (Decl);
+ end loop;
+
Insert_Node := Decl;
-- Otherwise the declaration does not come from source. This