aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-03-19 17:29:27 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2012-03-19 17:29:27 +0100
commit78c0f016063f856d4d35ba5591fbe825d7ab6544 (patch)
treea03face93f0687dec95d67ec03cef5955cc2aca5 /gcc/ada/sem_ch3.adb
parenta49565158271693fa8f994ba9b35f00b9ee25028 (diff)
downloadgcc-78c0f016063f856d4d35ba5591fbe825d7ab6544.zip
gcc-78c0f016063f856d4d35ba5591fbe825d7ab6544.tar.gz
gcc-78c0f016063f856d4d35ba5591fbe825d7ab6544.tar.bz2
[multiple changes]
2012-03-19 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch3.adb (Get_Discriminant_Value): Instead of looking at the immediate correcponsing discriminant, traverse a potential chain of discriminants produced by type derivations. (Root_Corresponding_Discriminant): Traverse a chain of inherited discriminants and return the topmost discriminant. 2012-03-19 Bob Duff <duff@adacore.com> * debug.adb: Minor comment change. * gnat_ugn.texi: Update documentation for elaboration regarding indirect calls. 2012-03-19 Gary Dismukes <dismukes@adacore.com> * exp_ch3.adb (Expand_N_Object_Declaration): In the case of an object of a class-wide interface type, where the declaration is rewritten as a renaming, call Set_Debug_Info_Needed on the renaming entity so that Materialize_Entity will be set. Also, change existing call (for other than interface cases) to call Set_Debug_Info_Needed rather than Set_Needs_Debug_Info (as specified for that flag). From-SVN: r185526
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb26
1 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 71b1fb4..443c2d1 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -15601,6 +15601,11 @@ package body Sem_Ch3 is
Typ_For_Constraint : Entity_Id;
Constraint : Elist_Id) return Node_Id
is
+ function Root_Corresponding_Discriminant
+ (Discr : Entity_Id) return Entity_Id;
+ -- Given a discriminant, traverse the chain of inherited discriminants
+ -- and return the topmost discriminant.
+
function Search_Derivation_Levels
(Ti : Entity_Id;
Discrim_Values : Elist_Id;
@@ -15608,6 +15613,23 @@ package body Sem_Ch3 is
-- This is the routine that performs the recursive search of levels
-- as described above.
+ -------------------------------------
+ -- Root_Corresponding_Discriminant --
+ -------------------------------------
+
+ function Root_Corresponding_Discriminant
+ (Discr : Entity_Id) return Entity_Id
+ is
+ D : Entity_Id := Discr;
+
+ begin
+ while Present (Corresponding_Discriminant (D)) loop
+ D := Corresponding_Discriminant (D);
+ end loop;
+
+ return D;
+ end Root_Corresponding_Discriminant;
+
------------------------------
-- Search_Derivation_Levels --
------------------------------
@@ -15782,7 +15804,7 @@ package body Sem_Ch3 is
-- ??? hack to disappear when this routine is gone
- if Nkind (Result) = N_Defining_Identifier then
+ if Nkind (Result) = N_Defining_Identifier then
declare
D : Entity_Id;
E : Elmt_Id;
@@ -15791,7 +15813,7 @@ package body Sem_Ch3 is
D := First_Discriminant (Typ_For_Constraint);
E := First_Elmt (Constraint);
while Present (D) loop
- if Corresponding_Discriminant (D) = Discriminant then
+ if Root_Corresponding_Discriminant (D) = Discriminant then
return Node (E);
end if;