Skip to content

Commit

Permalink
Merge branch 'eyraud/138' into 'master'
Browse files Browse the repository at this point in the history
[TGen] deal gracefully with Global => null aspect

Closes #138

See merge request eng/ide/libadalang-tools!172
  • Loading branch information
Jugst3r committed Dec 7, 2023
2 parents 8a56143 + a0c5c76 commit 2a8f13e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 31 deletions.
5 changes: 5 additions & 0 deletions src/tgen/tgen-types-translation.adb
Original file line number Diff line number Diff line change
Expand Up @@ -3111,6 +3111,11 @@ package body TGen.Types.Translation is
procedure Process_Global (N : LAL.Name) is
Global : constant Basic_Decl := N.P_Referenced_Decl;
begin
-- Ignore cases such as Global => null

if Global.Is_Null then
return;
end if;

if Kind (Global) = Ada_Object_Decl then
declare
Expand Down
68 changes: 37 additions & 31 deletions testsuite/tests/test/tgen_globals/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -30,51 +30,57 @@ Pkg.Supported_Global is 1954668933
Pkg.Supported_Global is 1954668933
Pkg.Supported_Global is 1954668933
Pkg.Supported_Global is 3
Pkg.Supported_Global is 18834966
Pkg.Supported_Global is 378901556
Pkg.Supported_Global is 5743901
Pkg.Supported_Global is -9
Pkg.Supported_Global is -280550153
Pkg.Supported_Global is 18183605
Pkg.Supported_Global is 8
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:24:4: info: corresponding test PASSED
pkg.ads:24:4: info: corresponding test PASSED
pkg.ads:24:4: info: corresponding test PASSED
pkg.ads:24:4: info: corresponding test PASSED
pkg.ads:24:4: info: corresponding test PASSED
pkg.ads:24:4: info: corresponding test PASSED
pkg.ads:21:4: info: corresponding test PASSED
pkg.ads:21:4: info: corresponding test PASSED
pkg.ads:21:4: info: corresponding test PASSED
pkg.ads:21:4: info: corresponding test PASSED
pkg.ads:21:4: info: corresponding test PASSED
pkg.ads:21:4: info: corresponding test PASSED
pkg.ads:27:4: info: corresponding test PASSED
pkg.ads:27:4: info: corresponding test PASSED
pkg.ads:27:4: info: corresponding test PASSED
pkg.ads:27:4: info: corresponding test PASSED
pkg.ads:27:4: info: corresponding test PASSED
pkg.ads:27:4: info: corresponding test PASSED
pkg.ads:12:4: info: corresponding test PASSED
pkg.ads:12:4: info: corresponding test PASSED
pkg.ads:12:4: info: corresponding test PASSED
pkg.ads:12:4: info: corresponding test PASSED
pkg.ads:12:4: info: corresponding test PASSED
pkg.ads:12:4: info: corresponding test PASSED
pkg.ads:22:4: info: corresponding test PASSED
pkg.ads:22:4: info: corresponding test PASSED
pkg.ads:22:4: info: corresponding test PASSED
pkg.ads:22:4: info: corresponding test PASSED
pkg.ads:22:4: info: corresponding test PASSED
pkg.ads:22:4: info: corresponding test PASSED
pkg.ads:19:4: info: corresponding test PASSED
pkg.ads:19:4: info: corresponding test PASSED
pkg.ads:19:4: info: corresponding test PASSED
pkg.ads:19:4: info: corresponding test PASSED
pkg.ads:19:4: info: corresponding test PASSED
pkg.ads:19:4: info: corresponding test PASSED
pkg.ads:25:4: info: corresponding test PASSED
pkg.ads:25:4: info: corresponding test PASSED
pkg.ads:25:4: info: corresponding test PASSED
pkg.ads:25:4: info: corresponding test PASSED
pkg.ads:25:4: info: corresponding test PASSED
pkg.ads:25:4: info: corresponding test PASSED
pkg.ads:18:4: info: corresponding test PASSED
pkg.ads:18:4: info: corresponding test PASSED
pkg.ads:18:4: info: corresponding test PASSED
pkg.ads:18:4: info: corresponding test PASSED
pkg.ads:18:4: info: corresponding test PASSED
pkg.ads:18:4: info: corresponding test PASSED
pkg.ads:16:4: info: corresponding test PASSED
pkg.ads:16:4: info: corresponding test PASSED
pkg.ads:16:4: info: corresponding test PASSED
pkg.ads:16:4: info: corresponding test PASSED
pkg.ads:16:4: info: corresponding test PASSED
pkg.ads:16:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:14:4: info: corresponding test PASSED
pkg.ads:12:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:45)
pkg.ads:14:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:66)
pkg.ads:16:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:87)
pkg.ads:19:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:108)
pkg.ads:22:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:129)
pkg.ads:25:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:150)
42 tests run: 36 passed; 6 failed; 0 crashed.
pkg.ads:18:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:108)
pkg.ads:21:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:129)
pkg.ads:24:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:150)
pkg.ads:27:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:171)
48 tests run: 41 passed; 7 failed; 0 crashed.
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/test/tgen_globals/test/pkg.adb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ with Ada.Text_IO; use Ada.Text_IO;

package body Pkg is

procedure Test_Null (B : Boolean) is null;
procedure Test_Cst (B : Boolean) is null;

procedure Test_Supported (B : Boolean) is
Expand Down
2 changes: 2 additions & 0 deletions testsuite/tests/test/tgen_globals/test/pkg.ads
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ package Pkg is

Cst : constant Integer := 2;

procedure Test_Null (B : Boolean) with Global => null;

procedure Test_Cst (B : Boolean) with Global => Cst;

procedure Test_Supported (B : Boolean) with Global => Supported_Global;
Expand Down

0 comments on commit 2a8f13e

Please sign in to comment.