aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/lib-xref.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-04-12 15:19:15 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-04-12 15:19:15 +0200
commit489c6e198e9e78f635878bdec992ce4d9fa807a2 (patch)
treedee6613608262bd3a26f31a89d7813d8d30eabc4 /gcc/ada/lib-xref.adb
parenta7e68e7fa76aa33eab48a30186abcb4d3b291322 (diff)
downloadgcc-489c6e198e9e78f635878bdec992ce4d9fa807a2.zip
gcc-489c6e198e9e78f635878bdec992ce4d9fa807a2.tar.gz
gcc-489c6e198e9e78f635878bdec992ce4d9fa807a2.tar.bz2
[multiple changes]
2013-04-12 Robert Dewar <dewar@adacore.com> * checks.adb, sem_elab.adb, repinfo.adb, sem_ch4.adb, restrict.adb, restrict.ads: Minor reformatting. 2013-04-12 Ed Schonberg <schonberg@adacore.com> * lib-xref.adb: Retrieve original name of classwide type if any. 2013-04-12 Thomas Quinot <quinot@adacore.com> * exp_ch11.ads: Minor reformatting. From-SVN: r197910
Diffstat (limited to 'gcc/ada/lib-xref.adb')
-rw-r--r--gcc/ada/lib-xref.adb17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index bf3f035..28ae480 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -1364,6 +1364,23 @@ package body Lib.Xref is
then
Tref := Etype (Tref);
+ -- Another special case: an object of a classwide type
+ -- initialized with a tag-indeterminate call gets a subtype
+ -- of the classwide type during expansion. See if the original
+ -- type in the declaration is named, and return it instead
+ -- of going to the root type.
+
+ if Ekind (Tref) = E_Class_Wide_Subtype
+ and then Nkind (Parent (Ent)) = N_Object_Declaration
+ and then
+ Nkind (Original_Node (Object_Definition (Parent (Ent))))
+ = N_Identifier
+ then
+ Tref :=
+ Entity
+ (Original_Node ((Object_Definition (Parent (Ent)))));
+ end if;
+
-- For anything else, exit
else