Browse Source

* Dump extended RTTI info from PPU

Ryan Joseph 2 years ago
parent
commit
b4ff9b71d3
1 changed files with 65 additions and 0 deletions
  1. 65 0
      compiler/utils/ppuutils/ppudump.pp

+ 65 - 0
compiler/utils/ppuutils/ppudump.pp

@@ -3302,6 +3302,67 @@ begin
 end;
 
 
+procedure readextendedrtti;
+type
+  tvisopt=record
+    mask : trtti_visibility;
+    str  : string[10];
+  end;
+const
+  visopt : array[0..ord(high(trtti_visibility))] of tvisopt=(
+     (mask:rv_private;    str:'Private'),
+     (mask:rv_protected;  str:'Protected'),
+     (mask:rv_public;     str:'Public'),
+     (mask:rv_published;  str:'Published')
+  );
+type
+  toptionopt=record
+    mask : trtti_option;
+    str  : string[10];
+  end;
+const
+  voptionopt : array[0..ord(high(trtti_option))] of toptionopt=(
+     (mask:ro_methods;    str:'Methods'),
+     (mask:ro_fields;     str:'Fields'),
+     (mask:ro_properties; str:'Properties')
+  );
+var
+  clause: string;
+  visibilities: trtti_visibilities;
+  first: boolean;
+  i, ro: integer;
+begin
+  clause:='';
+  case trtti_clause(ppufile.getbyte) of
+    rtc_none: clause:='None';
+    rtc_inherit: clause:='Inherit';
+    rtc_explicit: clause:='Explicit';
+  end;
+  writeln([space,'       Clause : ',clause]);
+
+  for ro:=0 to high(voptionopt) do
+    begin
+      ppufile.getset(tppuset1(visibilities));
+      if visibilities<>[] then
+        begin
+          write([space,'       ',voptionopt[ro].str,' : ']);
+          first:=true;
+          for i:=0 to high(visopt) do
+            if visopt[i].mask in visibilities then
+              begin
+                if first then
+                  first:=false
+                else
+                  write(', ');
+                write(visopt[i].str);
+              end;
+          if not first then
+            writeln;
+        end;
+    end;
+end;
+
+
 procedure readprocimploptions(const space: string; out implprocoptions: timplprocoptions);
 type
   tpiopt=record
@@ -4479,6 +4540,8 @@ begin
              writeln([space,'   Import lib/pkg : ',getstring]);
              write  ([space,'          Options : ']);
              readobjectdefoptions(objdef);
+             writeln([space,'    Extended RTTI : ']);
+             readextendedrtti;
              if (df_copied_def in defoptions) then
                begin
                  Include(TPpuRecordDef(def).Options, ooCopied);
@@ -4517,6 +4580,8 @@ begin
              writeln([space,'   Import lib/pkg : ',getstring]);
              write  ([space,'          Options : ']);
              readobjectdefoptions(objdef);
+             writeln([space,'    Extended RTTI : ']);
+             readextendedrtti;
              otb:=getbyte;
              write  ([space,'             Type : ']);
              case tobjecttyp(otb) of