Skip to content

Commit 254f439

Browse files
committed
sc_obligations.adb: fix scope entities dump code for ignored src. files
Fix a crash when dumping scope entities that have identifiers whose source file is cleared because of the --ignore-source-files option.
1 parent 07b55fc commit 254f439

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/gnatcov/sc_obligations.adb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,14 +623,17 @@ package body SC_Obligations is
623623
-----------
624624

625625
function Image (SE : Scope_Entity) return String is
626+
Identifier_Image : constant String :=
627+
(if SE.Identifier.Decl_SFI = No_Source_File
628+
then "ignored"
629+
else "at " & Get_Simple_Name (SE.Identifier.Decl_SFI)
630+
& ":" & Img (SE.Identifier.Decl_Line));
626631
begin
627632
return
628633
"Scope for "
629634
& Ada.Strings.Unbounded.To_String (SE.Name)
630635
& "[" & Slocs.Image (SE.Sloc)
631-
& "], identifier at "
632-
& Get_Simple_Name (SE.Identifier.Decl_SFI)
633-
& ":" & Img (SE.Identifier.Decl_Line);
636+
& "], identifier " & Identifier_Image;
634637
end Image;
635638

636639
----------

0 commit comments

Comments
 (0)