aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-10-26 14:28:37 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-26 14:28:37 +0200
commit1c1289e7fb2fe9b3b3912c7effa1ce46c66160ad (patch)
tree7a5bc172e7a2a453a56a41318fa5aa392df35a3a /gcc/ada/sem_ch6.adb
parent3019e9b6be184ca563cf76bc70b03c2012095dc7 (diff)
downloadgcc-1c1289e7fb2fe9b3b3912c7effa1ce46c66160ad.zip
gcc-1c1289e7fb2fe9b3b3912c7effa1ce46c66160ad.tar.gz
gcc-1c1289e7fb2fe9b3b3912c7effa1ce46c66160ad.tar.bz2
[multiple changes]
2010-10-26 Javier Miranda <miranda@adacore.com> * sem_ch6.adb (Check_Overriding_Indicator, New_Overloaded_Entity): When setting attribute Overridden_Operation do not reference the entities generated by Derive_Subprograms but their aliased entity (which is the primitive inherited from the parent type). 2010-10-26 Bob Duff <duff@adacore.com> * namet.adb, namet.ads: Minor cleanup. From-SVN: r165948
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb38
1 files changed, 36 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 920706b..8abe3cd 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -4672,7 +4672,25 @@ package body Sem_Ch6 is
end if;
elsif Is_Subprogram (Subp) then
- Set_Overridden_Operation (Subp, Overridden_Subp);
+ if No (Overridden_Operation (Subp)) then
+
+ -- For entities generated by Derive_Subprograms the overridden
+ -- operation is the inherited primitive (which is available
+ -- through the attribute alias)
+
+ if (Is_Dispatching_Operation (Subp)
+ or else Is_Dispatching_Operation (Overridden_Subp))
+ and then not Comes_From_Source (Overridden_Subp)
+ and then Find_Dispatching_Type (Overridden_Subp)
+ = Find_Dispatching_Type (Subp)
+ and then Present (Alias (Overridden_Subp))
+ and then Comes_From_Source (Alias (Overridden_Subp))
+ then
+ Set_Overridden_Operation (Subp, Alias (Overridden_Subp));
+ else
+ Set_Overridden_Operation (Subp, Overridden_Subp);
+ end if;
+ end if;
end if;
-- If primitive flag is set or this is a protected operation, then
@@ -8142,7 +8160,23 @@ package body Sem_Ch6 is
end if;
Enter_Overloaded_Entity (S);
- Set_Overridden_Operation (S, E);
+
+ -- For entities generated by Derive_Subprograms the
+ -- overridden operation is the inherited primitive
+ -- (which is available through the attribute alias).
+
+ if not (Comes_From_Source (E))
+ and then Is_Dispatching_Operation (E)
+ and then Find_Dispatching_Type (E)
+ = Find_Dispatching_Type (S)
+ and then Present (Alias (E))
+ and then Comes_From_Source (Alias (E))
+ then
+ Set_Overridden_Operation (S, Alias (E));
+ else
+ Set_Overridden_Operation (S, E);
+ end if;
+
Check_Overriding_Indicator (S, E, Is_Primitive => True);
-- If S is a user-defined subprogram or a null procedure