1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2009, Free Software Foundation, Inc. --
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. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
31 procedure Output_Range
(T
: SCO_Table_Entry
);
32 -- Outputs T.From and T.To in line:col-line:col format
34 procedure Output_Source_Location
(Loc
: Source_Location
);
35 -- Output source location in line:col format
41 procedure Output_Range
(T
: SCO_Table_Entry
) is
43 Output_Source_Location
(T
.From
);
44 Write_Info_Char
('-');
45 Output_Source_Location
(T
.To
);
48 ----------------------------
49 -- Output_Source_Location --
50 ----------------------------
52 procedure Output_Source_Location
(Loc
: Source_Location
) is
54 Write_Info_Nat
(Nat
(Loc
.Line
));
55 Write_Info_Char
(':');
56 Write_Info_Nat
(Nat
(Loc
.Col
));
57 end Output_Source_Location
;
59 -- Start of processing for Put_SCOs
62 -- Loop through entries in SCO_Unit_Table
64 for U
in 1 .. SCO_Unit_Table
.Last
loop
66 SUT
: SCO_Unit_Table_Entry
renames SCO_Unit_Table
.Table
(U
);
75 -- Write unit header (omitted if no SCOs are generated for this unit)
78 Write_Info_Initiate
('C');
79 Write_Info_Char
(' ');
80 Write_Info_Nat
(SUT
.Dep_Num
);
81 Write_Info_Char
(' ');
83 for N
in SUT
.File_Name
'Range loop
84 Write_Info_Char
(SUT
.File_Name
(N
));
90 -- Loop through SCO entries for this unit
93 exit when Start
= Stop
+ 1;
94 pragma Assert
(Start
<= Stop
);
96 Output_SCO_Line
: declare
97 T
: SCO_Table_Entry
renames SCO_Table
.Table
(Start
);
105 Write_Info_Initiate
('C');
106 Write_Info_Char
('S');
110 Write_Info_Char
(' ');
112 if SCO_Table
.Table
(Start
).C2
/= ' ' then
113 Write_Info_Char
(SCO_Table
.Table
(Start
).C2
);
116 Output_Range
(SCO_Table
.Table
(Start
));
117 exit when SCO_Table
.Table
(Start
).Last
;
120 pragma Assert
(SCO_Table
.Table
(Start
).C1
= 's');
124 -- Up to 6 items on a line, if more than 6 items,
125 -- continuation lines are marked Cs.
128 Write_Info_Terminate
;
129 Write_Info_Initiate
('C');
130 Write_Info_Char
('s');
135 Write_Info_Terminate
;
137 -- Statement continuations should not occur since they
138 -- are supposed to have been handled in the loop above.
145 when 'I' |
'E' |
'P' |
'W' |
'X' =>
148 -- For disabled pragma, skip decision output
150 if T
.C1
= 'P' and then T
.C2
= 'd' then
151 while not SCO_Table
.Table
(Start
).Last
loop
155 -- For all other cases output decision line
158 Write_Info_Initiate
('C');
159 Write_Info_Char
(T
.C1
);
162 Write_Info_Char
(' ');
163 Output_Source_Location
(T
.From
);
166 -- Loop through table entries for this decision
171 renames SCO_Table
.Table
(Start
);
174 Write_Info_Char
(' ');
176 if T
.C1
= '!' or else
180 Write_Info_Char
(T
.C1
);
181 Output_Source_Location
(T
.From
);
184 Write_Info_Char
(T
.C2
);
193 Write_Info_Terminate
;