From 489c6e198e9e78f635878bdec992ce4d9fa807a2 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 12 Apr 2013 15:19:15 +0200 Subject: [multiple changes] 2013-04-12 Robert Dewar * checks.adb, sem_elab.adb, repinfo.adb, sem_ch4.adb, restrict.adb, restrict.ads: Minor reformatting. 2013-04-12 Ed Schonberg * lib-xref.adb: Retrieve original name of classwide type if any. 2013-04-12 Thomas Quinot * exp_ch11.ads: Minor reformatting. From-SVN: r197910 --- gcc/ada/lib-xref.adb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/ada/lib-xref.adb') 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 -- cgit v1.1