summaryrefslogtreecommitdiff
path: root/gcc/ada/lib-xref.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/lib-xref.adb')
-rw-r--r--gcc/ada/lib-xref.adb10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index 4367eb1720b..c49866f4af2 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -751,7 +751,7 @@ package body Lib.Xref is
if Sloc (Tref) = Standard_Location then
- -- For now, output only if speial -gnatdM flag set
+ -- For now, output only if special -gnatdM flag set
exit when not Debug_Flag_MM;
@@ -769,6 +769,14 @@ package body Lib.Xref is
exit when not (Debug_Flag_MM or else Left = '<');
+ -- Do not output type reference if referenced
+ -- entity is not in the main unit and is itself
+ -- not referenced, since otherwise the reference
+ -- will dangle.
+
+ exit when not Referenced (Tref)
+ and then not In_Extended_Main_Source_Unit (Tref);
+
-- Output the reference
Write_Info_Char (Left);