codegen: sanitise spaces in mangled symbol names

A generic instantiated over a metaclass type argument (e.g.
TList<class of TFoo>) carries a space in its type name ('class of TFoo'),
which flowed unescaped into emitted assembler labels like
_FieldCleanup_TListEnumerator_class of TFoo — rejected by the assembler.
Map space to '_' in both the native x86_64 and QBE name manglers, alongside
the existing < > , $ @ ^ handling, so metaclass-typed generic instantiations
emit valid labels.
This commit is contained in:
Graeme Geldenhuys 2026-06-23 19:45:44 +01:00
parent c904bf321d
commit bee059143c
2 changed files with 3 additions and 1 deletions

View file

@ -1593,6 +1593,7 @@ begin
60: Result := Result + '_'; { '<' }
62: ; { '>' — skip }
44: Result := Result + '_'; { ',' }
32: Result := Result + '_'; { ' ' — e.g. 'class of T' }
36: Result := Result + '_D_'; { '$' }
64: Result := Result + '_V_'; { '@' }
94: Result := Result + '_P_'; { '^' }

View file

@ -13123,7 +13123,7 @@ begin
begin
C := StrAt(AName, I);
if (C = 60) or (C = 62) or (C = 44) or (C = 36) or (C = 64) or
(C = 94) then
(C = 94) or (C = 32) then
begin
Clean := False;
break;
@ -13139,6 +13139,7 @@ begin
60: Result := Result + '_'; { '<' }
62: ; { '>' — skip }
44: Result := Result + '_'; { ',' }
32: Result := Result + '_'; { ' ' — e.g. 'class of T' }
36: Result := Result + '_D_'; { '$' — overload delimiter }
64: Result := Result + '_V_'; { '@' — var-param prefix }
94: Result := Result + '_P_'; { '^' — pointer prefix }