Skip to content

Commit

Permalink
Merge branch 'topic/1231' into 'master'
Browse files Browse the repository at this point in the history
Handle SubpBody's DefiningName self reference in P_Gnat_Xref

Closes #1231

See merge request eng/libadalang/libadalang!1515
  • Loading branch information
thvnx committed Feb 8, 2024
2 parents 1146b67 + 813ad6d commit 80b544a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ada/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,9 @@ def gnat_xref():
)
),

bd.then(lambda bd: bd.is_a(T.BaseSubpBody)),
bd.cast(T.BaseSubpBody).subp_spec.subp_name,

Entity.cast(T.Name)._.gnat_xref_decl.then(
lambda ret:
Let(lambda dbd=ret.basic_decl: Cond(
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/name_resolution/gnat_xref_1/prj.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
project Prj is
for Source_Dirs use (".");
for Main use ("test.adb");
end Prj;
4 changes: 4 additions & 0 deletions testsuite/tests/name_resolution/gnat_xref_1/test.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
procedure P is
begin
null;
end P;
13 changes: 13 additions & 0 deletions testsuite/tests/name_resolution/gnat_xref_1/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
test.adb:1:11: warning: file name does not match unit name, should be "p.adb" [enabled by default]
== test.adb ==
test.adb:1:11 => test.adb:1:11 (LAL: ok)
test.adb:4:5 => test.adb:1:11 (LAL: ok)

Stats:
GNAT xrefs have 2 entries
LAL xrefs have:
* 2 OK entries (100.00%)
* 0 DIFFERENT entries (0.00%)
* 0 ERROR entries (0.00%)
* 0 MISSING entries (0.00%)
* 0 ADDITIONAL entries (0.00%)
2 changes: 2 additions & 0 deletions testsuite/tests/name_resolution/gnat_xref_1/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver: gnat-compare
project_file: prj.gpr

0 comments on commit 80b544a

Please sign in to comment.