mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-09 22:06:08 +02:00
Several adjustments because virtual methods in helpers are just normal methods and a VMT isn't generated for them either.
* $CPU/cgcpu.pas: disable the generation of VMT loading code * dbgstabs.pas, dbgdwarf.pas: treat virtual methods of helpers as normal methods * ncgcal.pas: don't register virtual helper methods for WPO * ncgrtti.pas: write virtual helper methods as normal methods to RTTI * nobj.pas: correctly handle final and override cases in helpers * pdecvar.pas: property getters * rautils.pas: no VMT offset in records git-svn-id: branches/svenbarth/classhelpers@17150 -
This commit is contained in:
parent
42129251da
commit
96116a6c3a
@ -2488,7 +2488,8 @@ unit cgcpu;
|
|||||||
g_adjust_self_value(list,procdef,ioffset);
|
g_adjust_self_value(list,procdef,ioffset);
|
||||||
|
|
||||||
{ case 4 }
|
{ case 4 }
|
||||||
if po_virtualmethod in procdef.procoptions then
|
if (po_virtualmethod in procdef.procoptions) and
|
||||||
|
not is_objectpascal_helper(procdef.struct) then
|
||||||
begin
|
begin
|
||||||
loadvmttor12;
|
loadvmttor12;
|
||||||
op_onr12methodaddr;
|
op_onr12methodaddr;
|
||||||
|
@ -2081,7 +2081,8 @@ implementation
|
|||||||
append_attribute(DW_AT_external,DW_FORM_flag,[true]);
|
append_attribute(DW_AT_external,DW_FORM_flag,[true]);
|
||||||
{ Abstract or virtual/overriding method. }
|
{ Abstract or virtual/overriding method. }
|
||||||
if (([po_abstractmethod, po_virtualmethod, po_overridingmethod] * def.procoptions) <> []) and
|
if (([po_abstractmethod, po_virtualmethod, po_overridingmethod] * def.procoptions) <> []) and
|
||||||
not is_objc_class_or_protocol(def.struct) then
|
not is_objc_class_or_protocol(def.struct) and
|
||||||
|
not is_objectpascal_helper(def.struct) then
|
||||||
begin
|
begin
|
||||||
if not(po_abstractmethod in def.procoptions) then
|
if not(po_abstractmethod in def.procoptions) then
|
||||||
append_attribute(DW_AT_virtuality,DW_FORM_data1,[ord(DW_VIRTUALITY_virtual)])
|
append_attribute(DW_AT_virtuality,DW_FORM_data1,[ord(DW_VIRTUALITY_virtual)])
|
||||||
|
@ -414,7 +414,8 @@ implementation
|
|||||||
if tsym(p).typ = procsym then
|
if tsym(p).typ = procsym then
|
||||||
begin
|
begin
|
||||||
pd :=tprocdef(tprocsym(p).ProcdefList[0]);
|
pd :=tprocdef(tprocsym(p).ProcdefList[0]);
|
||||||
if (po_virtualmethod in pd.procoptions) then
|
if (po_virtualmethod in pd.procoptions) and
|
||||||
|
not is_objectpascal_helper(pd.struct) then
|
||||||
begin
|
begin
|
||||||
lindex := pd.extnumber;
|
lindex := pd.extnumber;
|
||||||
{doesnt seem to be necessary
|
{doesnt seem to be necessary
|
||||||
|
@ -662,7 +662,8 @@ unit cgcpu;
|
|||||||
{ set param1 interface to self }
|
{ set param1 interface to self }
|
||||||
g_adjust_self_value(list,procdef,ioffset);
|
g_adjust_self_value(list,procdef,ioffset);
|
||||||
|
|
||||||
if po_virtualmethod in procdef.procoptions then
|
if (po_virtualmethod in procdef.procoptions) and
|
||||||
|
not is_objectpascal_helper(procdef.struct) then
|
||||||
begin
|
begin
|
||||||
if (procdef.proccalloption=pocall_register) then
|
if (procdef.proccalloption=pocall_register) then
|
||||||
begin
|
begin
|
||||||
|
@ -1605,7 +1605,8 @@ unit cgcpu;
|
|||||||
// g_adjust_self_value(list,procdef,ioffset);
|
// g_adjust_self_value(list,procdef,ioffset);
|
||||||
|
|
||||||
{ case 4 }
|
{ case 4 }
|
||||||
if po_virtualmethod in procdef.procoptions then
|
if (po_virtualmethod in procdef.procoptions) and
|
||||||
|
not is_objectpascal_helper(procdef.struct) then
|
||||||
begin
|
begin
|
||||||
// loadvmttor11;
|
// loadvmttor11;
|
||||||
// op_onr11methodaddr;
|
// op_onr11methodaddr;
|
||||||
|
@ -1679,7 +1679,8 @@ begin
|
|||||||
{ set param1 interface to self }
|
{ set param1 interface to self }
|
||||||
g_adjust_self_value(list, procdef, ioffset);
|
g_adjust_self_value(list, procdef, ioffset);
|
||||||
|
|
||||||
if po_virtualmethod in procdef.procoptions then
|
if (po_virtualmethod in procdef.procoptions) and
|
||||||
|
not is_objectpascal_helper(procdef.struct) then
|
||||||
begin
|
begin
|
||||||
loadvmttor24;
|
loadvmttor24;
|
||||||
op_onr24methodaddr;
|
op_onr24methodaddr;
|
||||||
|
@ -688,6 +688,7 @@ implementation
|
|||||||
otherwise optimised called methods are no longer registered)
|
otherwise optimised called methods are no longer registered)
|
||||||
}
|
}
|
||||||
if (po_virtualmethod in procdefinition.procoptions) and
|
if (po_virtualmethod in procdefinition.procoptions) and
|
||||||
|
not is_objectpascal_helper(tprocdef(procdefinition).struct) and
|
||||||
assigned(methodpointer) and
|
assigned(methodpointer) and
|
||||||
(methodpointer.nodetype<>typen) and
|
(methodpointer.nodetype<>typen) and
|
||||||
(not assigned(current_procinfo) or
|
(not assigned(current_procinfo) or
|
||||||
|
@ -338,7 +338,8 @@ implementation
|
|||||||
{ When there was an error then procdef is not assigned }
|
{ When there was an error then procdef is not assigned }
|
||||||
if not assigned(propaccesslist.procdef) then
|
if not assigned(propaccesslist.procdef) then
|
||||||
exit;
|
exit;
|
||||||
if not(po_virtualmethod in tprocdef(propaccesslist.procdef).procoptions) then
|
if not(po_virtualmethod in tprocdef(propaccesslist.procdef).procoptions) or
|
||||||
|
is_objectpascal_helper(tprocdef(propaccesslist.procdef).struct) then
|
||||||
begin
|
begin
|
||||||
current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(propaccesslist.procdef).mangledname,0));
|
current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(propaccesslist.procdef).mangledname,0));
|
||||||
typvalue:=1;
|
typvalue:=1;
|
||||||
|
@ -270,7 +270,8 @@ implementation
|
|||||||
|
|
||||||
{ check that we are not trying to override a final method }
|
{ check that we are not trying to override a final method }
|
||||||
if (po_finalmethod in vmtpd.procoptions) and
|
if (po_finalmethod in vmtpd.procoptions) and
|
||||||
hasequalpara and (po_overridingmethod in pd.procoptions) and is_class(_class) then
|
hasequalpara and (po_overridingmethod in pd.procoptions) and
|
||||||
|
(is_class(_class) or is_objectpascal_helper(_class)) then
|
||||||
MessagePos1(pd.fileinfo,parser_e_final_can_no_be_overridden,pd.fullprocname(false))
|
MessagePos1(pd.fileinfo,parser_e_final_can_no_be_overridden,pd.fullprocname(false))
|
||||||
else
|
else
|
||||||
{ old definition has virtual
|
{ old definition has virtual
|
||||||
@ -281,8 +282,11 @@ implementation
|
|||||||
(
|
(
|
||||||
{ new one does not have reintroduce in case of an objccategory }
|
{ new one does not have reintroduce in case of an objccategory }
|
||||||
(is_objccategory(_class) and not(po_reintroduce in pd.procoptions)) or
|
(is_objccategory(_class) and not(po_reintroduce in pd.procoptions)) or
|
||||||
{ new one does not have override in case of objpas/objc class/intf/proto }
|
{ new one does not have override in case of objpas/objc class/helper/intf/proto }
|
||||||
(is_class_or_interface_or_objc(_class) and not is_objccategory(_class) and not(po_overridingmethod in pd.procoptions))
|
(
|
||||||
|
(is_class_or_interface_or_objc(_class) or is_objectpascal_helper(_class)) and
|
||||||
|
not is_objccategory(_class) and not(po_overridingmethod in pd.procoptions)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
) then
|
) then
|
||||||
begin
|
begin
|
||||||
|
@ -844,7 +844,8 @@ implementation
|
|||||||
case p.propaccesslist[palt_read].firstsym^.sym.typ of
|
case p.propaccesslist[palt_read].firstsym^.sym.typ of
|
||||||
procsym :
|
procsym :
|
||||||
begin
|
begin
|
||||||
if (po_virtualmethod in tprocdef(p.propaccesslist[palt_read].procdef).procoptions) then
|
if (po_virtualmethod in tprocdef(p.propaccesslist[palt_read].procdef).procoptions) and
|
||||||
|
not is_objectpascal_helper(tprocdef(p.propaccesslist[palt_read].procdef).struct) then
|
||||||
ImplIntf.IType:=etVirtualMethodResult
|
ImplIntf.IType:=etVirtualMethodResult
|
||||||
else
|
else
|
||||||
ImplIntf.IType:=etStaticMethodResult;
|
ImplIntf.IType:=etStaticMethodResult;
|
||||||
|
@ -718,7 +718,8 @@ unit cgppc;
|
|||||||
g_adjust_self_value(list,procdef,ioffset);
|
g_adjust_self_value(list,procdef,ioffset);
|
||||||
|
|
||||||
{ case 4 }
|
{ case 4 }
|
||||||
if po_virtualmethod in procdef.procoptions then
|
if (po_virtualmethod in procdef.procoptions) and
|
||||||
|
not is_objectpascal_helper(procdef.struct) then
|
||||||
begin
|
begin
|
||||||
loadvmttor11;
|
loadvmttor11;
|
||||||
op_onr11methodaddr;
|
op_onr11methodaddr;
|
||||||
|
@ -1392,7 +1392,8 @@ Begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ can only get the vmtoffset of virtual methods }
|
{ can only get the vmtoffset of virtual methods }
|
||||||
if not(po_virtualmethod in procdef.procoptions) then
|
if not(po_virtualmethod in procdef.procoptions) or
|
||||||
|
is_objectpascal_helper(procdef.struct) then
|
||||||
Message1(asmr_e_no_vmtoffset_possible,FullTypeName(procdef,nil))
|
Message1(asmr_e_no_vmtoffset_possible,FullTypeName(procdef,nil))
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
@ -1375,7 +1375,8 @@ implementation
|
|||||||
{ set param1 interface to self }
|
{ set param1 interface to self }
|
||||||
g_adjust_self_value(list,procdef,ioffset);
|
g_adjust_self_value(list,procdef,ioffset);
|
||||||
|
|
||||||
if po_virtualmethod in procdef.procoptions then
|
if (po_virtualmethod in procdef.procoptions) and
|
||||||
|
not is_objectpascal_helper(procdef.struct) then
|
||||||
begin
|
begin
|
||||||
if (procdef.extnumber=$ffff) then
|
if (procdef.extnumber=$ffff) then
|
||||||
Internalerror(200006139);
|
Internalerror(200006139);
|
||||||
|
@ -168,7 +168,8 @@ unit cgcpu;
|
|||||||
{ set param1 interface to self }
|
{ set param1 interface to self }
|
||||||
g_adjust_self_value(list,procdef,ioffset);
|
g_adjust_self_value(list,procdef,ioffset);
|
||||||
|
|
||||||
if po_virtualmethod in procdef.procoptions then
|
if (po_virtualmethod in procdef.procoptions) and
|
||||||
|
not is_objectpascal_helper(procdef.struct) then
|
||||||
begin
|
begin
|
||||||
if (procdef.extnumber=$ffff) then
|
if (procdef.extnumber=$ffff) then
|
||||||
Internalerror(200006139);
|
Internalerror(200006139);
|
||||||
|
Loading…
Reference in New Issue
Block a user