Skip to content

Commit 6944370

Browse files
committed
Move $.Parsers' implementation to a new $.Parsers_Impl unit
Recent developments in Libadalang/GNAT increased the number of such symbols, and now Libadalang shared libraries cannot be built anymore on Windows because the DLL file format limit for exported symbols has been reached. The goal of this refactoring is to reduce the number of exported symbols for shared libraries: unlike $.Parsers, $.Parsers_Impl can be excluded from the list of "interfaces" at the GPR level, and so its symbols do not need to be exported.
1 parent 61a27c6 commit 6944370

File tree

8 files changed

+456
-339
lines changed

8 files changed

+456
-339
lines changed

langkit/emitter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ def __init__(self,
553553
unparser=True, is_interface=False),
554554
# Unit for all parsers
555555
Unit('parsers/pkg_main', 'Parsers'),
556+
Unit('parsers/pkg_impl', 'Parsers_Impl', is_interface=False),
556557
# Units for the lexer
557558
Unit('pkg_lexer', 'Lexer'),
558559
Unit('pkg_lexer_impl', 'Lexer_Implementation'),

langkit/parsers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,10 +1263,9 @@ def _eval_type(self) -> Optional[CompiledType]:
12631263

12641264
def generate_code(self) -> str:
12651265
return """
1266-
Parser.Private_Part.Dont_Skip.Append
1267-
({dontskip_parser_fn}'Access);
1266+
PP.Dont_Skip.Append ({dontskip_parser_fn}'Access);
12681267
{subparser_code}
1269-
Parser.Private_Part.Dont_Skip.Delete_Last;
1268+
PP.Dont_Skip.Delete_Last;
12701269
""".format(
12711270
subparser_code=self.subparser.generate_code(),
12721271
dontskip_parser_fn=self.dontskip_parser.gen_fn_name

langkit/templates/parsers/fn_code_ada.mako

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<%
44
ret_type = parser.type.storage_type_name
5-
memo = 'Parser.Private_Part.{}_Memo'.format(parser.gen_fn_name)
5+
memo = 'PP.{}_Memo'.format(parser.gen_fn_name)
66
%>
77

88
function ${parser.gen_fn_name}
@@ -28,7 +28,8 @@ is
2828
Mem_Res : ${ret_type} := ${parser.type.storage_nullexpr};
2929
% endif
3030

31-
M : Memo_Entry := Get (${memo}, Pos);
31+
PP : constant Parser_Private_Part := +Parser.Private_Part;
32+
M : Memo_Entry := Get (${memo}, Pos);
3233

3334
begin
3435
if M.State = Success then

0 commit comments

Comments
 (0)