浏览代码

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

git-svn-id: trunk@35085 -
Jonas Maebe 8 年之前
父节点
当前提交
472b5228fe
共有 5 个文件被更改,包括 26 次插入23 次删除
  1. 1 1
      compiler/expunix.pas
  2. 0 19
      compiler/ncgutil.pas
  3. 2 2
      compiler/ngenutil.pas
  4. 1 1
      compiler/pkgutil.pas
  5. 22 0
      compiler/symdef.pas

+ 1 - 1
compiler/expunix.pas

@@ -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;

+ 0 - 19
compiler/ncgutil.pas

@@ -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;

+ 2 - 2
compiler/ngenutil.pas

@@ -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;

+ 1 - 1
compiler/pkgutil.pas

@@ -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))

+ 22 - 0
compiler/symdef.pas

@@ -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