* changed ncgutil.has_alias_name(pd,s) to a method of tprocdef

git-svn-id: trunk@35085 -
This commit is contained in:
Jonas Maebe 2016-12-09 13:39:28 +00:00
parent 4406ec7e68
commit 472b5228fe
5 changed files with 26 additions and 23 deletions

View File

@ -155,7 +155,7 @@ begin
for i:=0 to tprocsym(hp2.sym).procdeflist.count-1 do
begin
pd:=tprocdef(tprocsym(hp2.sym).procdeflist[i]);
anyhasalias:=has_alias_name(pd,hp2.name^);
anyhasalias:=pd.has_alias_name(hp2.name^);
if anyhasalias then
break;
end;

View File

@ -74,7 +74,6 @@ interface
procedure register_maybe_adjust_setbase(list: TAsmList; opdef: tdef; var l: tlocation; setbase: aint);
function has_alias_name(pd:tprocdef;const s:string):boolean;
procedure alloc_proc_symbol(pd: tprocdef);
procedure release_proc_symbol(pd:tprocdef);
procedure gen_proc_entry_code(list:TAsmList);
@ -1350,24 +1349,6 @@ implementation
Entry/Exit
****************************************************************************}
function has_alias_name(pd:tprocdef;const s:string):boolean;
var
item : TCmdStrListItem;
begin
result:=true;
if pd.mangledname=s then
exit;
item := TCmdStrListItem(pd.aliasnames.first);
while assigned(item) do
begin
if item.str=s then
exit;
item := TCmdStrListItem(item.next);
end;
result:=false;
end;
procedure alloc_proc_symbol(pd: tprocdef);
var
item : TCmdStrListItem;

View File

@ -936,12 +936,12 @@ implementation
for j:=0 to tprocsym(sym).procdeflist.count-1 do
begin
pd:=tprocdef(tprocsym(sym).procdeflist[j]);
if (nameinit<>'') and not foundinit and has_alias_name(pd,nameinit) then
if (nameinit<>'') and not foundinit and pd.has_alias_name(nameinit) then
begin
current_module.addimportedsym(sym);
foundinit:=true;
end;
if (namefini<>'') and not foundfini and has_alias_name(pd,namefini) then
if (namefini<>'') and not foundfini and pd.has_alias_name(namefini) then
begin
current_module.addimportedsym(sym);
foundfini:=true;

View File

@ -675,7 +675,7 @@ implementation
for k:=0 to tprocsym(psym).procdeflist.count-1 do
begin
pd:=tprocdef(tprocsym(psym).procdeflist[k]);
if has_alias_name(pd,symname) or
if pd.has_alias_name(symname) or
(
([po_external,po_has_importdll]*pd.procoptions=[po_external,po_has_importdll]) and
(symname=proc_get_importname(pd))

View File

@ -819,6 +819,10 @@ interface
procedure make_external;
procedure init_genericdecl;
{ returns whether the mangled name or any of its aliases is equal to
s }
function has_alias_name(const s: TSymStr):boolean;
{ aliases to fields only required when a function is implemented in
the current unit }
property resultname: PShortString read GetResultName write SetResultName;
@ -5865,6 +5869,24 @@ implementation
end;
function tprocdef.has_alias_name(const s: TSymStr): boolean;
var
item : TCmdStrListItem;
begin
result:=true;
if mangledname=s then
exit;
item:=TCmdStrListItem(aliasnames.first);
while assigned(item) do
begin
if item.str=s then
exit;
item:=TCmdStrListItem(item.next);
end;
result:=false;
end;
function tprocdef.GetSymtable(t:tGetSymtable):TSymtable;
begin
case t of