Skip to content

Commit

Permalink
Merge branch 'topic/fix_fsf_build' into 'master'
Browse files Browse the repository at this point in the history
Fix GNAT FSF build by tweaking P_Call_Context's signature.

Closes #1230

See merge request eng/libadalang/libadalang!1534
  • Loading branch information
Roldak committed Feb 15, 2024
2 parents 6655ab6 + ef19122 commit 147d752
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ada/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,8 @@ def valid_keywords():
"when", "while", "with", "xor"
])

@langkit_property(public=True, return_type=T.AdaNode,
ignore_warn_on_node=True)
@langkit_property(return_type=T.AdaNode, ignore_warn_on_node=True,
warn_on_unused=False)
def call_context(ctx=T.LogicContext):
"""
Assuming that Self is the error location of a semantic diagnostic and
Expand Down
20 changes: 17 additions & 3 deletions extensions/src/libadalang-semantic_diagnostics.adb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ with Ada.Strings.Wide_Wide_Unbounded; use Ada.Strings.Wide_Wide_Unbounded;
with Langkit_Support.Slocs; use Langkit_Support.Slocs;

with Libadalang.Common; use Libadalang.Common;
with Libadalang.Implementation;
with Libadalang.Public_Converters;

package body Libadalang.Semantic_Diagnostics is

Expand Down Expand Up @@ -186,13 +188,25 @@ package body Libadalang.Semantic_Diagnostics is

for Diag of Kept loop
declare
Ctxs : constant Logic_Context_Array := Contexts (Diag);
use Libadalang.Implementation;
use Libadalang.Public_Converters;

Ctxs : constant Logic_Context_Array := Contexts (Diag);
Last_Ctx : constant Logic_Context := Ctxs (Ctxs'Last);
Internal_Ctx : constant Internal_Logic_Context :=
(Unwrap_Entity (Ref_Node (Last_Ctx)),
Unwrap_Entity (Decl_Node (Last_Ctx)));

Base_Loc : constant Ada_Node'Class := Location (Diag);
Contextual_Loc : constant Ada_Node := Wrap_Node
(Ada_Node_P_Call_Context
(Unwrap_Node (Base_Loc),
Internal_Ctx));
begin
Res.Contexts.Append (Render_Diagnostic
(Diag,
Render_Node,
Location (Diag).P_Call_Context
(Ctxs (Ctxs'Last))));
Contextual_Loc));
end;
exit when Res.Contexts.Length >= Max_Alt_Count;
end loop;
Expand Down

0 comments on commit 147d752

Please sign in to comment.