Skip to content

Commit 9434173

Browse files
committed
Remove the Inputs.Inputs_Type type and associated primitives
At this point, this type is just an awkward layer around a container, making iteration complicated. Just use a mere string vector instead, and use a dedicated container for the only use case that needs it (Trace_Inputs, responsible for the "qualifier" feature of Inputs.Inputs_Type).
1 parent 0ea4ac7 commit 9434173

15 files changed

+386
-678
lines changed

tools/gnatcov/cfg_dump.adb

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ with Highlighting;
4242
with Outputs; use Outputs;
4343
with Qemu_Traces;
4444
with SC_Obligations;
45-
with Strings; use Strings;
4645
with Support_Files;
4746
with Traces; use Traces;
4847
with Traces_Dbase;
4948
with Traces_Elf; use Traces_Elf;
50-
with Traces_Files;
5149

5250
package body CFG_Dump is
5351

@@ -266,7 +264,7 @@ package body CFG_Dump is
266264
procedure Tag_Executed_Instructions
267265
(Context : Context_Access;
268266
Exec_Path : String;
269-
Traces_Files_List : Inputs.Inputs_Type);
267+
Traces_Files_List : Requested_Trace_Vectors.Vector);
270268
-- Extract traces from each file and use them to tag instructions if they
271269
-- have been executed. This pass works on the CFG.
272270

@@ -799,11 +797,10 @@ package body CFG_Dump is
799797
procedure Tag_Executed_Instructions
800798
(Context : Context_Access;
801799
Exec_Path : String;
802-
Traces_Files_List : Inputs.Inputs_Type)
800+
Traces_Files_List : Requested_Trace_Vectors.Vector)
803801
is
804802
use type Interfaces.Unsigned_8;
805803
use Traces_Dbase;
806-
use Traces_Files;
807804

808805
Base : Traces_Base;
809806

@@ -984,7 +981,9 @@ package body CFG_Dump is
984981
-- Import all trace entries to the database, so that they are sorted by
985982
-- address
986983

987-
Inputs.Iterate (Traces_Files_List, Import_Traces'Access);
984+
for RT of Traces_Files_List loop
985+
Import_Traces (+RT.Filename);
986+
end loop;
988987

989988
-- And then, use them to tag instructions
990989

@@ -1726,20 +1725,18 @@ package body CFG_Dump is
17261725
Locations : User_Locations;
17271726
Output : String_Access;
17281727
Format : Output_Format;
1729-
SCO_Files_List : Inputs.Inputs_Type;
1730-
Traces_Files_List : Inputs.Inputs_Type;
1728+
SCO_Files_List : String_Vectors.Vector;
1729+
Traces_Files_List : Requested_Trace_Vectors.Vector;
17311730
Keep_Edges : Boolean)
17321731
is
1733-
use Ada.Containers;
1734-
17351732
Context : aliased Context_Type;
17361733
Ctx : constant Context_Access :=
17371734
Context'Unrestricted_Access;
17381735
Output_File : aliased File_Type;
17391736
begin
1740-
Context.Group_By_Condition := Inputs.Length (SCO_Files_List) > 0;
1737+
Context.Group_By_Condition := not SCO_Files_List.Is_Empty;
17411738
Context.Keep_Edges := Keep_Edges;
1742-
Context.Tag_Executed := Inputs.Length (Traces_Files_List) > 0;
1739+
Context.Tag_Executed := not Traces_Files_List.Is_Empty;
17431740

17441741
CFG_Dump_Trace.Trace ("Dumping code from: " & Exec_Path);
17451742
CFG_Dump_Trace.Trace
@@ -1767,7 +1764,9 @@ package body CFG_Dump is
17671764
if Context.Group_By_Condition then
17681765
Coverage.Set_Coverage_Levels ("stmt+mcdc");
17691766
CFG_Dump_Trace.Trace ("Loading ALI files...");
1770-
Inputs.Iterate (SCO_Files_List, Load_SCOs'Access);
1767+
for SCO_File of SCO_Files_List loop
1768+
Load_SCOs (+SCO_File);
1769+
end loop;
17711770
Coverage.Source.Initialize_SCI;
17721771

17731772
CFG_Dump_Trace.Trace ("Reading routine names...");

tools/gnatcov/cfg_dump.ads

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
with GNAT.Strings; use GNAT.Strings;
2020

21-
with Inputs;
2221
with Logging;
2322
with Object_Locations; use Object_Locations;
2423
with Slocs; use Slocs;
24+
with Strings; use Strings;
25+
with Traces_Files; use Traces_Files;
2526

2627
package CFG_Dump is
2728

@@ -36,8 +37,8 @@ package CFG_Dump is
3637
Locations : User_Locations;
3738
Output : String_Access;
3839
Format : Output_Format;
39-
SCO_Files_List : Inputs.Inputs_Type;
40-
Traces_Files_List : Inputs.Inputs_Type;
40+
SCO_Files_List : String_Vectors.Vector;
41+
Traces_Files_List : Requested_Trace_Vectors.Vector;
4142
Keep_Edges : Boolean);
4243

4344
end CFG_Dump;

0 commit comments

Comments
 (0)