浏览代码

* LLVM: ensure that the parameter types are processed of procdefs that are
declared when they get first called
o fixes compilation of several tests/test/tobjc* tests after r46675

git-svn-id: trunk@47160 -

Jonas Maebe 4 年之前
父节点
当前提交
6d0ce1c4b6
共有 1 个文件被更改,包括 16 次插入15 次删除
  1. 16 15
      compiler/llvm/llvmtype.pas

+ 16 - 15
compiler/llvm/llvmtype.pas

@@ -186,10 +186,25 @@ implementation
 
 
     function TLLVMTypeInfo.record_def(def:tdef): tdef;
+      var
+        i: longint;
       begin
         result:=def;
         if def.stab_number<>0 then
           exit;
+        { the external symbol may never be called, in which case the types
+          of its parameters will never be process -> do it here }
+        if (def.typ=procdef) then
+          begin
+            { can't use this condition to determine whether or not we need
+              to generate the argument defs, because this information does
+              not get reset when multiple units are compiled during a
+              single compiler invocation }
+            tprocdef(def).init_paraloc_info(callerside);
+            for i:=0 to tprocdef(def).paras.count-1 do
+              record_def(llvmgetcgparadef(tparavarsym(tprocdef(def).paras[i]).paraloc[callerside],true,calleeside));
+            record_def(llvmgetcgparadef(tprocdef(def).funcretloc[callerside],true,calleeside));
+          end;
         def.stab_number:=1;
         { this is an internal llvm type }
         if def=llvm_metadatatype then
@@ -505,20 +520,6 @@ implementation
               sec:=sec_data;
             toplevellist.Concat(taillvmdecl.createdecl(sym,def,nil,sec,def.alignment));
             record_asmsym_def(sym,def,true);
-            { the external symbol may never be called, in which case the types
-              of its parameters will never be process -> do it here }
-            if (def.typ=procdef) then
-              begin
-                { can't use this condition to determine whether or not we need
-                  to generate the argument defs, because this information does
-                  not get reset when multiple units are compiled during a
-                  single compiler invocation }
-                if (tprocdef(def).has_paraloc_info=callnoside) then
-                  tprocdef(def).init_paraloc_info(callerside);
-                for i:=0 to tprocdef(def).paras.count-1 do
-                  record_def(llvmgetcgparadef(tparavarsym(tprocdef(def).paras[i]).paraloc[callerside],true,calleeside));
-                record_def(llvmgetcgparadef(tprocdef(def).funcretloc[callerside],true,calleeside));
-              end;
           end;
       end;
 
@@ -716,7 +717,7 @@ implementation
         defnumberlist:=TFPObjectList.create(false);
         deftowritelist:=TFPObjectList.create(false);
 
-        { write all global/static variables, part of flaggin all required tdefs  }
+        { write all global/static variables, part of flagging all required tdefs  }
         if assigned(current_module.globalsymtable) then
           write_symtable_syms(current_asmdata.asmlists[al_start],current_module.globalsymtable);
         if assigned(current_module.localsymtable) then