Ver Fonte

* when inserting a reference to an external procdef, also process its
parameter types in case it hasn't been called (because in that case
the defs of those parameters won't have been used and hence they
won't have been recorded for writing either)

git-svn-id: branches/debug_eh@40413 -

Jonas Maebe há 6 anos atrás
pai
commit
d363acbe77
1 ficheiros alterados com 15 adições e 0 exclusões
  1. 15 0
      compiler/llvm/llvmtype.pas

+ 15 - 0
compiler/llvm/llvmtype.pas

@@ -433,6 +433,7 @@ implementation
     procedure TLLVMTypeInfo.maybe_insert_extern_sym_decl(toplevellist: tasmlist; sym: tasmsymbol; def: tdef);
       var
         sec: tasmsectiontype;
+        i: longint;
       begin
         { Necessery for "external" declarations for symbols not declared in the
           current unit. We can't create these declarations when the alias is
@@ -450,6 +451,20 @@ 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));
+                record_def(llvmgetcgparadef(tprocdef(def).funcretloc[callerside],true));
+              end;
           end;
       end;