Skip to content

Commit d523319

Browse files
pmderodatJugst3r
authored andcommittedSep 19, 2022
Revert "project.adb: workaround a GNATCOLL.Projects bug"
The GNATCOLL.Projects bug is fixed on its master branch, so the workaround can go away on gnatcov's edge branch. TN: V816-018 Change-Id: I4c73ee3e9ef0e5aee219f14cc7da077d42aadc97
1 parent defa8f8 commit d523319

File tree

1 file changed

+20
-62
lines changed

1 file changed

+20
-62
lines changed
 

Diff for: ‎tools/gnatcov/project.adb

+20-62
Original file line numberDiff line numberDiff line change
@@ -536,74 +536,32 @@ package body Project is
536536
(List => Lib_Info, ALI_Ext => "^.*\.sid$");
537537
for LI of Lib_Info loop
538538

539-
-- GNATCOLL.Projects.Library_Files has several bugs wrt. the
540-
-- enumeration of LI files for C++ units. Filter out these LI
541-
-- files and implement our own enumerations for C++. TODO???
542-
-- This has been fixed in GNATcoll's development branch: remove
543-
-- this workaround during the next stable bump.
539+
-- If the unit for this SID file is in Unit_Map, this is a unit of
540+
-- interest, so use it.
544541

545-
if LI.Source.Language /= "c++" then
546-
547-
-- If the unit for this SID file is in Unit_Map, this is a unit
548-
-- of interest, so use it.
549-
550-
declare
551-
use Unit_Maps;
552-
553-
LI_Source_Unit : constant String := LI.Source.Unit_Name;
554-
LI_Source_File : constant String :=
555-
+LI.Source.File.Base_Name;
556-
557-
U : constant String :=
558-
(if LI_Source_Unit'Length > 0
559-
then LI_Source_Unit
560-
else LI_Source_File);
561-
-- For unit-based languages (Ada), retrieve unit name from
562-
-- SID file. For file-based languages (C), fall back to
563-
-- translation unit source file name instead.
542+
declare
543+
use Unit_Maps;
564544

565-
Cur : constant Cursor := Unit_Map.Find (U);
566-
begin
567-
if Has_Element (Cur) then
568-
Callback.all (+LI.Library_File.Full_Name);
569-
Unit_Map.Reference (Cur).LI_Seen := True;
570-
end if;
571-
end;
572-
end if;
573-
end loop;
574-
Lib_Info.Clear;
545+
LI_Source_Unit : constant String := LI.Source.Unit_Name;
546+
LI_Source_File : constant String := +LI.Source.File.Base_Name;
575547

576-
-- Implement our own enumeration for C++ units (see above). TODO???
577-
-- Remove this bit too during the next stable bump.
548+
U : constant String :=
549+
(if LI_Source_Unit'Length > 0
550+
then LI_Source_Unit
551+
else LI_Source_File);
552+
-- For unit-based languages (Ada), retrieve unit name from SID
553+
-- file. For file-based languages (C), fall back to translation
554+
-- unit source file name instead.
578555

579-
if Prj_Info.Project.Has_Language ("C++") then
580-
declare
581-
Obj_Dir : constant String :=
582-
+Prj_Info.Project.Object_Dir.Full_Name;
583-
Sources : File_Array_Access := Prj_Info.Project.Source_Files;
584-
FI : File_Info;
556+
Cur : constant Cursor := Unit_Map.Find (U);
585557
begin
586-
for S of Sources.all loop
587-
FI := Prj_Tree.Info (S);
588-
if To_Lower (FI.Language) = "c++" then
589-
declare
590-
use Unit_Maps;
591-
592-
Src_File : constant String := +S.Base_Name;
593-
SID_Name : constant String :=
594-
Compose (Obj_Dir, Src_File & ".sid");
595-
Cur : constant Cursor := Unit_Map.Find (Src_File);
596-
begin
597-
if Has_Element (Cur) and then Exists (SID_Name) then
598-
Callback.all (SID_Name);
599-
Unit_Map.Reference (Cur).LI_Seen := True;
600-
end if;
601-
end;
602-
end if;
603-
end loop;
604-
Unchecked_Free (Sources);
558+
if Has_Element (Cur) then
559+
Callback.all (+LI.Library_File.Full_Name);
560+
Unit_Map.Reference (Cur).LI_Seen := True;
561+
end if;
605562
end;
606-
end if;
563+
end loop;
564+
Lib_Info.Clear;
607565
end loop;
608566

609567
-- Now warn about units of interest that have no SID

0 commit comments

Comments
 (0)
Please sign in to comment.