Debian Codegraph @

gcc/ada/diagnostics-utils.ads

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- D I A G N O S T I C S . U T I L S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2025, 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
26 package Diagnostics.Utils is
27
28 function Get_Human_Id (D : Diagnostic_Type) return String_Ptr;
29
30 function Sloc_To_String (Sptr : Source_Ptr; Ref : Source_Ptr) return String;
31 -- Convert the source pointer to a string and prefix it with the correct
32 -- preposition.
33 --
34 -- * If the location is in one of the standard locations,
35 -- then it yields "in package <LOCATION>". The explicit standard
36 -- locations are:
37 -- * System
38 -- * Standard
39 -- * Standard.ASCII
40 -- * if the location is missing the the sloc yields "at unknown location"
41 -- * if the location is in the same file as the current file,
42 -- then it yields "at line <line>".
43 -- * Otherwise sloc yields "at <file>:<line>:<column>"
44
45 function Sloc_To_String (N : Node_Or_Entity_Id;
46 Ref : Source_Ptr)
47 return String;
48 -- Converts the Sloc of the node or entity to a Sloc string.
49
50 function To_String (Sptr : Source_Ptr) return String;
51 -- Convert the source pointer to a string of the form: "file:line:column"
52
53 function To_File_Name (Sptr : Source_Ptr) return String;
54 -- Converts the file name of the Sptr to a string.
55
56 function Line_To_String (Sptr : Source_Ptr) return String;
57 -- Converts the logical line number of the Sptr to a string.
58
59 function Column_To_String (Sptr : Source_Ptr) return String;
60 -- Converts the column number of the Sptr to a string. Column values less
61 -- than 10 are prefixed with a 0.
62
63 function To_Full_Span (N : Node_Id) return Source_Span;
64
65 function To_String (Id : Diagnostic_Id) return String;
66 -- Convert the diagnostic ID to a 4 character string padded with 0-s.
67
68 function To_Name (E : Entity_Id) return String;
69
70 function To_Type_Name (E : Entity_Id) return String;
71
72 function Kind_To_String (D : Diagnostic_Type) return String;
73
74 function Kind_To_String
75 (D : Sub_Diagnostic_Type;
76 Parent : Diagnostic_Type) return String;
77
78 function Get_Primary_Labeled_Span (Spans : Labeled_Span_List)
79 return Labeled_Span_Type;
80
81 function Get_Doc_Switch (Diag : Diagnostic_Type) return String;
82
83 function Appears_Before (D1, D2 : Diagnostic_Type) return Boolean;
84
85 function Appears_Before (P1, P2 : Source_Ptr) return Boolean;
86
87 procedure Insert_Based_On_Location
88 (List : Diagnostic_List;
89 Diagnostic : Diagnostic_Type);
90
91 end Diagnostics.Utils;