Pārlūkot izejas kodu

compiler, rtl: some rtti related changes:
- write pint instead of 32 bit for record field offset (compiler uses aintsize = pint in TRecordDef), use PtrInt in RTL for record reading
- add tkRecord to TTypeData (field and type names are taken from Delphi help)
- add tkProcedure as alias to tkProcVar

git-svn-id: trunk@24424 -

paul 12 gadi atpakaļ
vecāks
revīzija
e23534eec4
3 mainītis faili ar 17 papildinājumiem un 2 dzēšanām
  1. 1 1
      compiler/ncgrtti.pas
  2. 1 1
      rtl/inc/rtti.inc
  3. 15 0
      rtl/objpas/typinfo.pp

+ 1 - 1
compiler/ncgrtti.pas

@@ -175,7 +175,7 @@ implementation
                not is_objc_class_or_protocol(tfieldvarsym(sym).vardef) then
               begin
                 current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(tfieldvarsym(sym).vardef,rt)));
-                current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tfieldvarsym(sym).fieldoffset));
+                current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_pint(tfieldvarsym(sym).fieldoffset));
                 inc(fieldcnt);
               end;
           end;

+ 1 - 1
rtl/inc/rtti.inc

@@ -20,7 +20,7 @@ type
   PRecordElement=^TRecordElement;
   TRecordElement=packed record
     TypeInfo: Pointer;
-    Offset: Longint;
+    Offset: PtrInt;
   end;
 
   PRecordInfo=^TRecordInfo;

+ 15 - 0
rtl/objpas/typinfo.pp

@@ -152,6 +152,12 @@ unit typinfo;
                UnitName : ShortString
                // here the properties follow as array of TPropInfo
               );
+            tkRecord:
+              (
+                RecSize: Integer;
+                ManagedFldCount: Integer;
+                {ManagedFields: array[1..ManagedFldCount] of TManagedField}
+              );
             tkHelper:
               (HelperParent : PTypeInfo;
                ExtendedInfo : PTypeInfo;
@@ -213,6 +219,14 @@ unit typinfo;
       end;
 
       // unsed, just for completeness
+      TManagedField =
+      {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
+      packed
+      {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
+      record
+        TypeRef: PTypeInfo;
+        FldOffset: PtrInt;
+      end;
       TPropData =
 {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
       packed
@@ -249,6 +263,7 @@ unit typinfo;
       TPropList = array[0..65535] of PPropInfo;
 
    const
+      tkProcedure = tkProcVar; // for compatibility with Delphi
       tkAny = [Low(TTypeKind)..High(TTypeKind)];
       tkMethods = [tkMethod];
       tkProperties = tkAny-tkMethods-[tkUnknown];