* always keep track of the field about to be emitted in curfield, as we

will need this for LLVM to determine whether the emitted data completely
    matches the definition (if not, we have to create a def for the actual
    data)
  - removed no longer used fieldoffsets property

git-svn-id: trunk@32712 -
This commit is contained in:
Jonas Maebe 2015-12-25 21:05:12 +00:00
parent c7ea73dccf
commit 5774238887

View File

@ -133,7 +133,6 @@ type
private private
fnextfieldname: TIDString; fnextfieldname: TIDString;
function getcuroffset: asizeint; function getcuroffset: asizeint;
function getfieldoffset(l: longint): asizeint;
procedure setnextfieldname(AValue: TIDString); procedure setnextfieldname(AValue: TIDString);
protected protected
{ type of the aggregate } { type of the aggregate }
@ -173,7 +172,6 @@ type
property curfield: tfieldvarsym read fcurfield write fcurfield; property curfield: tfieldvarsym read fcurfield write fcurfield;
property nextfield: tfieldvarsym read fnextfield write fnextfield; property nextfield: tfieldvarsym read fnextfield write fnextfield;
property nextfieldname: TIDString write setnextfieldname; property nextfieldname: TIDString write setnextfieldname;
property fieldoffset[l: longint]: asizeint read getfieldoffset;
property curoffset: asizeint read getcuroffset; property curoffset: asizeint read getcuroffset;
property anonrecord: boolean read fanonrecord write fanonrecord; property anonrecord: boolean read fanonrecord write fanonrecord;
end; end;
@ -489,15 +487,6 @@ implementation
end; end;
function taggregateinformation.getfieldoffset(l: longint): asizeint;
var
field: tfieldvarsym;
begin
field:=tfieldvarsym(tabstractrecorddef(def).symtable.symlist[l]);
result:=field.fieldoffset;
end;
procedure taggregateinformation.setnextfieldname(AValue: TIDString); procedure taggregateinformation.setnextfieldname(AValue: TIDString);
begin begin
if (fnextfieldname<>'') or if (fnextfieldname<>'') or
@ -518,6 +507,7 @@ implementation
function taggregateinformation.prepare_next_field(nextfielddef: tdef): asizeint; function taggregateinformation.prepare_next_field(nextfielddef: tdef): asizeint;
var var
sym: tsym;
currentoffset,nextoffset: asizeint; currentoffset,nextoffset: asizeint;
i: longint; i: longint;
begin begin
@ -546,14 +536,16 @@ implementation
end end
else if fnextfieldname<>'' then else if fnextfieldname<>'' then
internalerror(2015071501); internalerror(2015071501);
currentoffset:=curoffset;
{ find next field } { find next field }
i:=curindex; i:=curindex;
repeat repeat
inc(i); inc(i);
until (tsym(tabstractrecorddef(def).symtable.symlist[i]).typ=fieldvarsym) and sym:=tsym(tabstractrecorddef(def).symtable.symlist[i]);
not(sp_static in tsym(tabstractrecorddef(def).symtable.symlist[i]).symoptions); until (sym.typ=fieldvarsym) and
nextoffset:=fieldoffset[i]; not(sp_static in sym.symoptions);
currentoffset:=curoffset; curfield:=tfieldvarsym(sym);
nextoffset:=curfield.fieldoffset;
curindex:=i; curindex:=i;
end; end;
{ need padding? } { need padding? }