1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                           S P A R K _ X R E F S                          --
6--                                                                          --
7--                                 B o d y                                  --
8--                                                                          --
9--          Copyright (C) 2011-2021, Free Software Foundation, Inc.         --
10--                                                                          --
11-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12-- terms of the  GNU General Public License as published  by the Free Soft- --
13-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17-- for  more details.  You should have  received  a copy of the GNU General --
18-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
19-- http://www.gnu.org/licenses for a complete copy of the license.          --
20--                                                                          --
21-- GNAT was originally developed  by the GNAT team at  New York University. --
22-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23--                                                                          --
24------------------------------------------------------------------------------
25
26with Lib.Xref;
27with Output;   use Output;
28with Sem_Util; use Sem_Util;
29
30package body SPARK_Xrefs is
31
32   ------------
33   -- dspark --
34   ------------
35
36   procedure dspark is
37
38      procedure Dump (Index : Nat; AXR : SPARK_Xref_Record);
39
40      procedure Dump_SPARK_Xrefs is new
41        Lib.Xref.SPARK_Specific.Iterate_SPARK_Xrefs (Dump);
42
43      ----------
44      -- Dump --
45      ----------
46
47      procedure Dump (Index : Nat; AXR : SPARK_Xref_Record) is
48      begin
49         Write_Str  ("  ");
50         Write_Int  (Index);
51         Write_Char ('.');
52
53         Write_Str  (" Entity = " & Unique_Name (AXR.Entity));
54         Write_Str  (" (");
55         Write_Int  (Nat (AXR.Entity));
56         Write_Str  (")");
57
58         Write_Str  (" Scope = " & Unique_Name (AXR.Ref_Scope));
59         Write_Str  (" (");
60         Write_Int  (Nat (AXR.Ref_Scope));
61         Write_Str  (")");
62
63         Write_Str  (" Ref_Type = '" & AXR.Rtype & "'");
64
65         Write_Eol;
66      end Dump;
67
68   --  Start of processing for dspark
69
70   begin
71      --  Dump SPARK cross-reference table
72
73      Write_Eol;
74      Write_Line ("SPARK Xref Table");
75      Write_Line ("----------------");
76
77      Dump_SPARK_Xrefs;
78
79   end dspark;
80
81end SPARK_Xrefs;
82