From c83fc67e32e8584ef67362e163d3d48ad7b494c9 Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 1 Jan 2010 20:22:02 +0000 Subject: [PATCH] compiler: write correct method kind for constructors,destructors and class methods git-svn-id: trunk@14512 - --- compiler/ncgrtti.pas | 27 ++++++++++++++++++++++----- rtl/objpas/typinfo.pp | 4 ++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/compiler/ncgrtti.pas b/compiler/ncgrtti.pas index c1a8bc43a3..28ffbe9feb 100644 --- a/compiler/ncgrtti.pas +++ b/compiler/ncgrtti.pas @@ -697,11 +697,28 @@ implementation if (tf_requires_proper_alignment in target_info.flags) then current_asmdata.asmlists[al_rtti].concat(cai_align.Create(sizeof(TConstPtrUInt))); - { write kind of method (can only be function or procedure)} - if def.returndef = voidtype then - methodkind := mkProcedure + { write kind of method } + case def.proctypeoption of + potype_constructor: methodkind:=mkConstructor; + potype_destructor: methodkind:=mkDestructor; + potype_procedure: + if po_classmethod in def.procoptions then + methodkind:=mkClassProcedure + else + methodkind:=mkProcedure; + potype_function: + if po_classmethod in def.procoptions then + methodkind:=mkClassFunction + else + methodkind:=mkFunction; else - methodkind := mkFunction; + begin + if def.returndef = voidtype then + methodkind:=mkProcedure + else + methodkind:=mkFunction; + end; + end; current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(methodkind)); { write parameter info. The parameters must be written in reverse order @@ -711,7 +728,7 @@ implementation for i:=0 to def.paras.count-1 do write_para(tparavarsym(def.paras[i])); - if methodkind=mkFunction then + if (methodkind=mkFunction) or (methodkind=mkClassFunction) then begin { write name of result type } write_rtti_name(def.returndef); diff --git a/rtl/objpas/typinfo.pp b/rtl/objpas/typinfo.pp index 242c076bb5..5bdb00ca88 100644 --- a/rtl/objpas/typinfo.pp +++ b/rtl/objpas/typinfo.pp @@ -137,8 +137,8 @@ unit typinfo; TypeName : ShortString; end; followed by - ResultType : ShortString // for mkFunction only - ResultTypeRef : PPTypeInfo; // for mkFunction only + ResultType : ShortString // for mkFunction, mkClassFunction only + ResultTypeRef : PPTypeInfo; // for mkFunction, mkClassFunction only CC : TCallConv; ParamTypeRefs : array[1..ParamCount] of PPTypeInfo;} );