Skip to content

Commit 6c7463c

Browse files
committed
Instrument: create SID files in the most extending project
This mimics where GNAT+GPRbuild create ALI/object files, and makes sure that the created SID files are the ones "gnatcov coverage" will pick up: the ones in the extending project tree take precedence over the ones in the extended project tree. TN: V824-005 Change-Id: Iee85d897ca773da256b03b86ae651abab7fc3672
1 parent 5bca564 commit 6c7463c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tools/gnatcov/instrument.adb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,19 @@ package body Instrument is
225225
-- basename for the SID file to create. Mimic how GNAT creates ALI
226226
-- files: use the project of the main source of the library unit, start
227227
-- from the basename of that source file, replace the last extension
228-
-- with ".sid".
228+
-- with ".sid". Also make sure to use the most extending project in the
229+
-- hierarchy, which is where GPRbuild puts ALI/object files.
229230

230231
SID_Basename : US.Unbounded_String;
231232

232233
Use_Spec : constant Boolean :=
233234
Info.Body_Project = GPR.No_Project;
234235
Project : constant GPR.Project_Type :=
235-
(if Use_Spec
236-
then Info.Spec_Project
237-
else Info.Body_Project);
236+
GPR.Extending_Project
237+
(Project => (if Use_Spec
238+
then Info.Spec_Project
239+
else Info.Body_Project),
240+
Recurse => True);
238241
pragma Assert (Project /= GPR.No_Project);
239242

240243
Output_Directory : constant Virtual_File :=

0 commit comments

Comments
 (0)