* integrate the functionality to create an address-only procvardef from a

procdef into tprocdef.getcopyas()

git-svn-id: branches/hlcgllvm@28474 -
This commit is contained in:
Jonas Maebe 2014-08-19 20:22:06 +00:00
parent 6f01bb56d6
commit 63a3ff3c7f
2 changed files with 13 additions and 4 deletions

View File

@ -1992,6 +1992,7 @@ implementation
function ttypeconvnode.typecheck_proc_to_procvar : tnode;
var
pd : tabstractprocdef;
copytype : tproccopytyp;
begin
result:=nil;
pd:=tabstractprocdef(left.resultdef);
@ -2005,15 +2006,17 @@ implementation
resultdef:=totypedef
else
begin
resultdef:=pd.getcopyas(procvardef,pc_normal);
{ only need the address of the method? this is needed
for @tobject.create. In this case there will be a loadn without
a methodpointer. }
if (left.nodetype=loadn) and
not assigned(tloadnode(left).left) and
(not(m_nested_procvars in current_settings.modeswitches) or
not is_nested_pd(tprocvardef(resultdef))) then
include(tprocvardef(resultdef).procoptions,po_addressonly);
not is_nested_pd(tabstractprocdef(tloadnode(left).resultdef))) then
copytype:=pc_address_only
else
copytype:=pc_normal;
resultdef:=pd.getcopyas(procvardef,copytype);
end;
end;

View File

@ -546,7 +546,10 @@ interface
tproccopytyp = (pc_normal,
{ always creates a top-level function, removes all
special parameters (self, vmt, parentfp, ...) }
pc_bareproc
pc_bareproc,
{ creates a procvardef describing only the code pointer
of a method/netsted function/... }
pc_address_only
);
tabstractprocdef = class(tstoreddef)
@ -4554,6 +4557,9 @@ implementation
tabstractprocdef(result).procoptions:=tabstractprocdef(result).procoptions*[po_explicitparaloc,po_hascallingconvention,po_varargs,po_iocheck,po_has_importname,po_has_importdll];
if newtyp=procvardef then
tabstractprocdef(result).procoptions:=tabstractprocdef(result).procoptions-[po_has_importname,po_has_importdll];
if copytyp=pc_address_only then
include(tabstractprocdef(result).procoptions,po_addressonly);
tabstractprocdef(result).callerargareasize:=callerargareasize;
tabstractprocdef(result).calleeargareasize:=calleeargareasize;
tabstractprocdef(result).maxparacount:=maxparacount;