Skip to content

Commit 91f856f

Browse files
committed
Remove the manual runtime files fetching from the driver
1 parent 2df1c75 commit 91f856f

File tree

3 files changed

+3
-151
lines changed

3 files changed

+3
-151
lines changed

lkql_checker/src/gnatcheck-compiler.adb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,22 +1519,6 @@ package body Gnatcheck.Compiler is
15191519
end if;
15201520
end GPRbuild_Exec;
15211521

1522-
----------------
1523-
-- Gnatls_Exec --
1524-
----------------
1525-
1526-
function Gnatls_Exec return String is
1527-
use Ada.Strings.Unbounded;
1528-
begin
1529-
if Has_Access_To_Codepeer then
1530-
return "codepeer-gnatls";
1531-
elsif To_String (Target) /= "" then
1532-
return To_String (Target) & "-gnatls";
1533-
else
1534-
return "gnatls";
1535-
end if;
1536-
end Gnatls_Exec;
1537-
15381522
-------------------------
15391523
-- Set_Compiler_Checks --
15401524
-------------------------

lkql_checker/src/gnatcheck-compiler.ads

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ package Gnatcheck.Compiler is
2626
function GPRbuild_Exec return String;
2727
-- Return the executable name to use in order to spawn a GPRBuild process
2828

29-
function Gnatls_Exec return String;
30-
-- Return the executable name to use in order to spawn a GNATLS process
31-
3229
--------------------------------------------------------
3330
-- Using in GNATCHECK checks performed by the compiler --
3431
--------------------------------------------------------

lkql_checker/src/gnatcheck-source_table.adb

Lines changed: 3 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,15 @@ with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
1212
with Ada.Text_IO; use Ada.Text_IO;
1313

1414
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
15-
with GNAT.Expect; use GNAT.Expect;
1615
with GNAT.OS_Lib; use GNAT.OS_Lib;
17-
with GNAT.String_Split; use GNAT.String_Split;
1816
with GNAT.Table;
1917
with GNAT.Task_Lock;
2018

21-
with Gnatcheck.Compiler; use Gnatcheck.Compiler;
2219
with Gnatcheck.Diagnoses; use Gnatcheck.Diagnoses;
2320
with Gnatcheck.Ids; use Gnatcheck.Ids;
2421
with Gnatcheck.Output; use Gnatcheck.Output;
2522
with Gnatcheck.String_Utilities; use Gnatcheck.String_Utilities;
2623

27-
with GNATCOLL.VFS; use GNATCOLL.VFS;
28-
2924
with GPR2.Build.Source;
3025
with GPR2.Path_Name;
3126
with GPR2.Project.Tree;
@@ -34,7 +29,6 @@ with GPR2.Project.View;
3429
with Langkit_Support.Generic_API.Introspection;
3530

3631
with Libadalang.Analysis; use Libadalang.Analysis;
37-
with Libadalang.Auto_Provider; use Libadalang.Auto_Provider;
3832
with Libadalang.Project_Provider; use Libadalang.Project_Provider;
3933
with Libadalang.Iterators;
4034
with Libadalang.Generic_API; use Libadalang.Generic_API;
@@ -1400,134 +1394,11 @@ package body Gnatcheck.Source_Table is
14001394
Partition : GPR2_Provider_And_Projects_Array_Access;
14011395

14021396
function Create_Context return Checker_App.Lkql_Context is
1403-
Ctx : Checker_App.Lkql_Context;
1404-
Files : File_Array_Access;
1405-
Last : Natural := 0;
1406-
1407-
procedure Add_Runtime_Files;
1408-
-- Add to Files all the GNAT native runtime files, if found
1409-
1410-
-----------------------
1411-
-- Add_Runtime_Files --
1412-
-----------------------
1413-
1414-
procedure Add_Runtime_Files is
1415-
Gnatls : String_Access := Locate_Exec_On_Path (Gnatls_Exec);
1416-
Verbose : aliased String := "-v";
1417-
Status : aliased Integer;
1418-
1419-
begin
1420-
if Gnatls = null then
1421-
return;
1422-
end if;
1423-
1424-
-- Spawn gnatls -v
1425-
1426-
declare
1427-
use Ada.Directories;
1428-
1429-
Output : constant String :=
1430-
Get_Command_Output (Gnatls.all,
1431-
[Verbose'Unchecked_Access],
1432-
"", Status'Unchecked_Access, True);
1433-
Lines : String_List_Access;
1434-
Ada_Include_Path : String_Access;
1435-
Found : Boolean := False;
1436-
1437-
procedure Add_File (Dir : Directory_Entry_Type);
1438-
-- Add the given directory entry Dir to Files
1439-
1440-
--------------
1441-
-- Add_File --
1442-
--------------
1443-
1444-
procedure Add_File (Dir : Directory_Entry_Type) is
1445-
begin
1446-
Last := @ + 1;
1447-
Files (Last) := Create (+Full_Name (Dir));
1448-
end Add_File;
1449-
1450-
begin
1451-
if Status /= 0 then
1452-
Free (Gnatls);
1453-
return;
1454-
end if;
1455-
1456-
-- and look for the line containing "adainclude"
1457-
1458-
for Line of Create (Output, [ASCII.LF, ASCII.CR], Multiple)
1459-
loop
1460-
Found := Has_Suffix (Line, "adainclude");
1461-
1462-
if Found then
1463-
Ada_Include_Path :=
1464-
new String'(Remove_Spaces (Line));
1465-
exit;
1466-
end if;
1467-
end loop;
1468-
1469-
Free (Lines);
1470-
1471-
if not Found then
1472-
Free (Gnatls);
1473-
return;
1474-
end if;
1475-
1476-
-- We then list all the *.ads files.
1477-
-- We only need to process spec files, runtime body files are not
1478-
-- needed to analyze user code and will slow down the startup
1479-
-- phase.
1480-
1481-
Search (Ada_Include_Path.all, "*.ads",
1482-
Process => Add_File'Access);
1483-
Free (Ada_Include_Path);
1484-
Free (Gnatls);
1485-
end;
1486-
end Add_Runtime_Files;
1487-
14881397
Charset : constant String := To_String (Arg.Charset.Get);
1489-
1398+
Ctx : Checker_App.Lkql_Context;
14901399
begin
1491-
-- If no project specified, create an auto provider with all the source
1492-
-- files listed in the command line, stored in Temporary_File_Storage,
1493-
-- as well as all runtime files, these are needed for proper name
1494-
-- resolution.
1495-
1496-
if not Gnatcheck_Prj.Is_Specified then
1497-
declare
1498-
procedure Add_File (File_Name : String);
1499-
-- Add File_Name to Files
1500-
1501-
--------------
1502-
-- Add_File --
1503-
--------------
1504-
1505-
procedure Add_File (File_Name : String) is
1506-
begin
1507-
Last := @ + 1;
1508-
Files (Last) := Create (+File_Name);
1509-
end Add_File;
1510-
1511-
begin
1512-
Files := new File_Array
1513-
(1 .. Natural (Length (Temporary_File_Storage)) + 4096);
1514-
-- Enough to hold all files on the command line and all runtime
1515-
-- files.
1516-
1517-
Temp_Storage_Iterate (Add_File'Access);
1518-
Add_Runtime_Files;
1519-
Ctx.Analysis_Ctx := Create_Context
1520-
(Charset => Charset,
1521-
Unit_Provider => Create_Auto_Provider_Reference
1522-
(Files (1 .. Last), Charset),
1523-
Event_Handler => EHR_Object);
1524-
Unchecked_Free (Files);
1525-
end;
1526-
1527-
-- Otherwise use a project unit provider
1528-
1529-
elsif Gnatcheck_Prj.Tree.Is_Defined and then not In_Aggregate_Project
1530-
then
1400+
-- Use a project unit provider, even with the implicit project
1401+
if not In_Aggregate_Project then
15311402
if Partition = null then
15321403
Partition :=
15331404
Create_Project_Unit_Providers (Gnatcheck_Prj.Tree);

0 commit comments

Comments
 (0)