@@ -12,20 +12,15 @@ with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
12
12
with Ada.Text_IO ; use Ada.Text_IO;
13
13
14
14
with GNAT.Directory_Operations ; use GNAT.Directory_Operations;
15
- with GNAT.Expect ; use GNAT.Expect;
16
15
with GNAT.OS_Lib ; use GNAT.OS_Lib;
17
- with GNAT.String_Split ; use GNAT.String_Split;
18
16
with GNAT.Table ;
19
17
with GNAT.Task_Lock ;
20
18
21
- with Gnatcheck.Compiler ; use Gnatcheck.Compiler;
22
19
with Gnatcheck.Diagnoses ; use Gnatcheck.Diagnoses;
23
20
with Gnatcheck.Ids ; use Gnatcheck.Ids;
24
21
with Gnatcheck.Output ; use Gnatcheck.Output;
25
22
with Gnatcheck.String_Utilities ; use Gnatcheck.String_Utilities;
26
23
27
- with GNATCOLL.VFS ; use GNATCOLL.VFS;
28
-
29
24
with GPR2.Build.Source ;
30
25
with GPR2.Path_Name ;
31
26
with GPR2.Project.Tree ;
@@ -34,7 +29,6 @@ with GPR2.Project.View;
34
29
with Langkit_Support.Generic_API.Introspection ;
35
30
36
31
with Libadalang.Analysis ; use Libadalang.Analysis;
37
- with Libadalang.Auto_Provider ; use Libadalang.Auto_Provider;
38
32
with Libadalang.Project_Provider ; use Libadalang.Project_Provider;
39
33
with Libadalang.Iterators ;
40
34
with Libadalang.Generic_API ; use Libadalang.Generic_API;
@@ -1400,134 +1394,11 @@ package body Gnatcheck.Source_Table is
1400
1394
Partition : GPR2_Provider_And_Projects_Array_Access;
1401
1395
1402
1396
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
-
1488
1397
Charset : constant String := To_String (Arg.Charset.Get);
1489
-
1398
+ Ctx : Checker_App.Lkql_Context;
1490
1399
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
1531
1402
if Partition = null then
1532
1403
Partition :=
1533
1404
Create_Project_Unit_Providers (Gnatcheck_Prj.Tree);
0 commit comments