mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 14:19:31 +02:00
Adjust tfieldvarsym (and by extension tabstractvarsym) so that it can be created as not registered if needed.
git-svn-id: trunk@32372 -
This commit is contained in:
parent
fe39de1573
commit
922646d106
@ -343,7 +343,7 @@ implementation
|
|||||||
{ create static fields representing all enums }
|
{ create static fields representing all enums }
|
||||||
for i:=0 to tenumdef(def).symtable.symlist.count-1 do
|
for i:=0 to tenumdef(def).symtable.symlist.count-1 do
|
||||||
begin
|
begin
|
||||||
fsym:=cfieldvarsym.create(tenumsym(tenumdef(def).symtable.symlist[i]).realname,vs_final,enumclass,[]);
|
fsym:=cfieldvarsym.create(tenumsym(tenumdef(def).symtable.symlist[i]).realname,vs_final,enumclass,[],true);
|
||||||
enumclass.symtable.insert(fsym);
|
enumclass.symtable.insert(fsym);
|
||||||
sym:=make_field_static(enumclass.symtable,fsym);
|
sym:=make_field_static(enumclass.symtable,fsym);
|
||||||
{ add alias for the field representing ordinal(0), for use in
|
{ add alias for the field representing ordinal(0), for use in
|
||||||
@ -373,12 +373,12 @@ implementation
|
|||||||
if tenumdef(def).has_jumps then
|
if tenumdef(def).has_jumps then
|
||||||
begin
|
begin
|
||||||
{ add field for the value }
|
{ add field for the value }
|
||||||
fsym:=cfieldvarsym.create('__fpc_fenumval',vs_final,s32inttype,[]);
|
fsym:=cfieldvarsym.create('__fpc_fenumval',vs_final,s32inttype,[],true);
|
||||||
enumclass.symtable.insert(fsym);
|
enumclass.symtable.insert(fsym);
|
||||||
tobjectsymtable(enumclass.symtable).addfield(fsym,vis_strictprivate);
|
tobjectsymtable(enumclass.symtable).addfield(fsym,vis_strictprivate);
|
||||||
{ add class field with hash table that maps from FPC-declared ordinal value -> enum instance }
|
{ add class field with hash table that maps from FPC-declared ordinal value -> enum instance }
|
||||||
juhashmap:=search_system_type('JUHASHMAP').typedef;
|
juhashmap:=search_system_type('JUHASHMAP').typedef;
|
||||||
fsym:=cfieldvarsym.create('__fpc_ord2enum',vs_final,juhashmap,[]);
|
fsym:=cfieldvarsym.create('__fpc_ord2enum',vs_final,juhashmap,[],true);
|
||||||
enumclass.symtable.insert(fsym);
|
enumclass.symtable.insert(fsym);
|
||||||
make_field_static(enumclass.symtable,fsym);
|
make_field_static(enumclass.symtable,fsym);
|
||||||
{ add custom constructor }
|
{ add custom constructor }
|
||||||
@ -435,7 +435,7 @@ implementation
|
|||||||
"Values" instance method -- that's also the reason why we insert the
|
"Values" instance method -- that's also the reason why we insert the
|
||||||
field only now, because we cannot disable duplicate identifier
|
field only now, because we cannot disable duplicate identifier
|
||||||
checking when creating the "Values" method }
|
checking when creating the "Values" method }
|
||||||
fsym:=cfieldvarsym.create('$VALUES',vs_final,arrdef,[]);
|
fsym:=cfieldvarsym.create('$VALUES',vs_final,arrdef,[],true);
|
||||||
fsym.visibility:=vis_strictprivate;
|
fsym.visibility:=vis_strictprivate;
|
||||||
enumclass.symtable.insert(fsym,false);
|
enumclass.symtable.insert(fsym,false);
|
||||||
sym:=make_field_static(enumclass.symtable,fsym);
|
sym:=make_field_static(enumclass.symtable,fsym);
|
||||||
|
@ -266,7 +266,7 @@ implementation
|
|||||||
to it from the structure or linking will fail }
|
to it from the structure or linking will fail }
|
||||||
if symtablestack.top.symtabletype in [recordsymtable,ObjectSymtable] then
|
if symtablestack.top.symtabletype in [recordsymtable,ObjectSymtable] then
|
||||||
begin
|
begin
|
||||||
sym:=cfieldvarsym.create(orgname,varspez,hdef,[]);
|
sym:=cfieldvarsym.create(orgname,varspez,hdef,[],true);
|
||||||
symtablestack.top.insert(sym);
|
symtablestack.top.insert(sym);
|
||||||
sym:=make_field_static(symtablestack.top,tfieldvarsym(sym));
|
sym:=make_field_static(symtablestack.top,tfieldvarsym(sym));
|
||||||
end
|
end
|
||||||
|
@ -1512,7 +1512,7 @@ implementation
|
|||||||
sorg:=orgpattern;
|
sorg:=orgpattern;
|
||||||
if token=_ID then
|
if token=_ID then
|
||||||
begin
|
begin
|
||||||
vs:=cfieldvarsym.create(sorg,vs_value,generrordef,[]);
|
vs:=cfieldvarsym.create(sorg,vs_value,generrordef,[],true);
|
||||||
|
|
||||||
{ normally the visibility is set via addfield, but sometimes
|
{ normally the visibility is set via addfield, but sometimes
|
||||||
we collect symbols so we can add them in a batch of
|
we collect symbols so we can add them in a batch of
|
||||||
@ -1739,7 +1739,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
consume(_ID);
|
consume(_ID);
|
||||||
consume(_COLON);
|
consume(_COLON);
|
||||||
fieldvs:=cfieldvarsym.create(sorg,vs_value,generrordef,[]);
|
fieldvs:=cfieldvarsym.create(sorg,vs_value,generrordef,[],true);
|
||||||
variantdesc^^.variantselector:=fieldvs;
|
variantdesc^^.variantselector:=fieldvs;
|
||||||
symtablestack.top.insert(fieldvs);
|
symtablestack.top.insert(fieldvs);
|
||||||
end;
|
end;
|
||||||
|
@ -481,18 +481,18 @@ implementation
|
|||||||
type is not available. The rtti for pvmt will be written implicitly
|
type is not available. The rtti for pvmt will be written implicitly
|
||||||
by thev tblarray below }
|
by thev tblarray below }
|
||||||
systemunit.insert(ctypesym.create('$pvmt',pvmttype,true));
|
systemunit.insert(ctypesym.create('$pvmt',pvmttype,true));
|
||||||
addfield(hrecst,cfieldvarsym.create('$length',vs_value,ptrsinttype,[]));
|
addfield(hrecst,cfieldvarsym.create('$length',vs_value,ptrsinttype,[],true));
|
||||||
addfield(hrecst,cfieldvarsym.create('$mlength',vs_value,ptrsinttype,[]));
|
addfield(hrecst,cfieldvarsym.create('$mlength',vs_value,ptrsinttype,[],true));
|
||||||
addfield(hrecst,cfieldvarsym.create('$parent',vs_value,pvmttype,[]));
|
addfield(hrecst,cfieldvarsym.create('$parent',vs_value,pvmttype,[],true));
|
||||||
{ it seems vmttype is used both for TP objects and Delphi classes,
|
{ it seems vmttype is used both for TP objects and Delphi classes,
|
||||||
so the next entry could either be the first virtual method (vm1)
|
so the next entry could either be the first virtual method (vm1)
|
||||||
(object) or the class name (class). We can't easily create separate
|
(object) or the class name (class). We can't easily create separate
|
||||||
vtable formats for both, as gdb is hard coded to search for
|
vtable formats for both, as gdb is hard coded to search for
|
||||||
__vtbl_ptr_type in all cases (JM) }
|
__vtbl_ptr_type in all cases (JM) }
|
||||||
addfield(hrecst,cfieldvarsym.create('$vm1_or_classname',vs_value,cpointerdef.create(cshortstringtype),[]));
|
addfield(hrecst,cfieldvarsym.create('$vm1_or_classname',vs_value,cpointerdef.create(cshortstringtype),[],true));
|
||||||
vmtarraytype:=carraydef.create(0,0,s32inttype);
|
vmtarraytype:=carraydef.create(0,0,s32inttype);
|
||||||
tarraydef(vmtarraytype).elementdef:=voidpointertype;
|
tarraydef(vmtarraytype).elementdef:=voidpointertype;
|
||||||
addfield(hrecst,cfieldvarsym.create('$__pfn',vs_value,vmtarraytype,[]));
|
addfield(hrecst,cfieldvarsym.create('$__pfn',vs_value,vmtarraytype,[],true));
|
||||||
addtype('$__vtbl_ptr_type',vmttype);
|
addtype('$__vtbl_ptr_type',vmttype);
|
||||||
vmtarraytype:=carraydef.create(0,1,s32inttype);
|
vmtarraytype:=carraydef.create(0,1,s32inttype);
|
||||||
tarraydef(vmtarraytype).elementdef:=pvmttype;
|
tarraydef(vmtarraytype).elementdef:=pvmttype;
|
||||||
@ -500,14 +500,14 @@ implementation
|
|||||||
end;
|
end;
|
||||||
{ Add a type for methodpointers }
|
{ Add a type for methodpointers }
|
||||||
hrecst:=trecordsymtable.create('',1,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign);
|
hrecst:=trecordsymtable.create('',1,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign);
|
||||||
addfield(hrecst,cfieldvarsym.create('$proc',vs_value,voidcodepointertype,[]));
|
addfield(hrecst,cfieldvarsym.create('$proc',vs_value,voidcodepointertype,[],true));
|
||||||
addfield(hrecst,cfieldvarsym.create('$self',vs_value,voidpointertype,[]));
|
addfield(hrecst,cfieldvarsym.create('$self',vs_value,voidpointertype,[],true));
|
||||||
methodpointertype:=crecorddef.create('',hrecst);
|
methodpointertype:=crecorddef.create('',hrecst);
|
||||||
addtype('$methodpointer',methodpointertype);
|
addtype('$methodpointer',methodpointertype);
|
||||||
{ Add a type for nested proc pointers }
|
{ Add a type for nested proc pointers }
|
||||||
hrecst:=trecordsymtable.create('',1,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign);
|
hrecst:=trecordsymtable.create('',1,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign);
|
||||||
addfield(hrecst,cfieldvarsym.create('$proc',vs_value,voidcodepointertype,[]));
|
addfield(hrecst,cfieldvarsym.create('$proc',vs_value,voidcodepointertype,[],true));
|
||||||
addfield(hrecst,cfieldvarsym.create('$parentfp',vs_value,parentfpvoidpointertype,[]));
|
addfield(hrecst,cfieldvarsym.create('$parentfp',vs_value,parentfpvoidpointertype,[],true));
|
||||||
nestedprocpointertype:=crecorddef.create('',hrecst);
|
nestedprocpointertype:=crecorddef.create('',hrecst);
|
||||||
addtype('$nestedprocpointer',nestedprocpointertype);
|
addtype('$nestedprocpointer',nestedprocpointertype);
|
||||||
symtablestack.pop(systemunit);
|
symtablestack.pop(systemunit);
|
||||||
|
@ -1199,7 +1199,7 @@ implementation
|
|||||||
fieldvardef:=cpointerdef.getreusable(vardef)
|
fieldvardef:=cpointerdef.getreusable(vardef)
|
||||||
else
|
else
|
||||||
fieldvardef:=vardef;
|
fieldvardef:=vardef;
|
||||||
result:=cfieldvarsym.create(sym.realname,vs_value,fieldvardef,[]);
|
result:=cfieldvarsym.create(sym.realname,vs_value,fieldvardef,[],true);
|
||||||
if nestedvarsst.symlist.count=0 then
|
if nestedvarsst.symlist.count=0 then
|
||||||
include(tfieldvarsym(result).varoptions,vo_is_first_field);
|
include(tfieldvarsym(result).varoptions,vo_is_first_field);
|
||||||
nestedvarsst.insert(result);
|
nestedvarsst.insert(result);
|
||||||
|
@ -4299,7 +4299,7 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
pname:=@optionalname;
|
pname:=@optionalname;
|
||||||
sym:=cfieldvarsym.create(pname^,vs_value,def,[]);
|
sym:=cfieldvarsym.create(pname^,vs_value,def,[],true);
|
||||||
symtable.insert(sym);
|
symtable.insert(sym);
|
||||||
trecordsymtable(symtable).addfield(sym,vis_hidden);
|
trecordsymtable(symtable).addfield(sym,vis_hidden);
|
||||||
result:=sym;
|
result:=sym;
|
||||||
@ -6847,7 +6847,7 @@ implementation
|
|||||||
tObjectSymtable(symtable).datasize:=align(tObjectSymtable(symtable).datasize,sizeof(pint));
|
tObjectSymtable(symtable).datasize:=align(tObjectSymtable(symtable).datasize,sizeof(pint));
|
||||||
tObjectSymtable(symtable).alignrecord(tObjectSymtable(symtable).datasize,sizeof(pint));
|
tObjectSymtable(symtable).alignrecord(tObjectSymtable(symtable).datasize,sizeof(pint));
|
||||||
end;
|
end;
|
||||||
vmt_field:=cfieldvarsym.create('_vptr$'+objname^,vs_value,voidpointertype,[]);
|
vmt_field:=cfieldvarsym.create('_vptr$'+objname^,vs_value,voidpointertype,[],true);
|
||||||
hidesym(vmt_field);
|
hidesym(vmt_field);
|
||||||
tObjectSymtable(symtable).insert(vmt_field);
|
tObjectSymtable(symtable).insert(vmt_field);
|
||||||
tObjectSymtable(symtable).addfield(tfieldvarsym(vmt_field),vis_hidden);
|
tObjectSymtable(symtable).addfield(tfieldvarsym(vmt_field),vis_hidden);
|
||||||
|
@ -179,7 +179,7 @@ interface
|
|||||||
{ could also be part of tabstractnormalvarsym, but there's }
|
{ could also be part of tabstractnormalvarsym, but there's }
|
||||||
{ one byte left here till the next 4 byte alignment }
|
{ one byte left here till the next 4 byte alignment }
|
||||||
addr_taken : boolean;
|
addr_taken : boolean;
|
||||||
constructor create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
|
constructor create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions;doregister:boolean);
|
||||||
constructor ppuload(st:tsymtyp;ppufile:tcompilerppufile);
|
constructor ppuload(st:tsymtyp;ppufile:tcompilerppufile);
|
||||||
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||||
procedure buildderef;override;
|
procedure buildderef;override;
|
||||||
@ -215,7 +215,7 @@ interface
|
|||||||
{$else symansistr}
|
{$else symansistr}
|
||||||
cachedmangledname: pshortstring; { mangled name for ObjC or Java }
|
cachedmangledname: pshortstring; { mangled name for ObjC or Java }
|
||||||
{$endif symansistr}
|
{$endif symansistr}
|
||||||
constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);virtual;
|
constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions;doregister:boolean);virtual;
|
||||||
constructor ppuload(ppufile:tcompilerppufile);
|
constructor ppuload(ppufile:tcompilerppufile);
|
||||||
{ do not override this routine in platform-specific subclasses,
|
{ do not override this routine in platform-specific subclasses,
|
||||||
override ppuwrite_platform instead }
|
override ppuwrite_platform instead }
|
||||||
@ -1583,9 +1583,9 @@ implementation
|
|||||||
TABSTRACTVARSYM
|
TABSTRACTVARSYM
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
constructor tabstractvarsym.create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
|
constructor tabstractvarsym.create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions;doregister:boolean);
|
||||||
begin
|
begin
|
||||||
inherited create(st,n,true);
|
inherited create(st,n,doregister);
|
||||||
vardef:=def;
|
vardef:=def;
|
||||||
varspez:=vsp;
|
varspez:=vsp;
|
||||||
varstate:=vs_declared;
|
varstate:=vs_declared;
|
||||||
@ -1737,9 +1737,9 @@ implementation
|
|||||||
TFIELDVARSYM
|
TFIELDVARSYM
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
constructor tfieldvarsym.create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
|
constructor tfieldvarsym.create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions;doregister:boolean);
|
||||||
begin
|
begin
|
||||||
inherited create(fieldvarsym,n,vsp,def,vopts);
|
inherited create(fieldvarsym,n,vsp,def,vopts,doregister);
|
||||||
fieldoffset:=-1;
|
fieldoffset:=-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1829,7 +1829,7 @@ implementation
|
|||||||
|
|
||||||
constructor tabstractnormalvarsym.create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
|
constructor tabstractnormalvarsym.create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
|
||||||
begin
|
begin
|
||||||
inherited create(st,n,vsp,def,vopts);
|
inherited create(st,n,vsp,def,vopts,true);
|
||||||
fillchar(localloc,sizeof(localloc),0);
|
fillchar(localloc,sizeof(localloc),0);
|
||||||
fillchar(currentregloc,sizeof(localloc),0);
|
fillchar(currentregloc,sizeof(localloc),0);
|
||||||
fillchar(initialloc,sizeof(initialloc),0);
|
fillchar(initialloc,sizeof(initialloc),0);
|
||||||
@ -2198,14 +2198,14 @@ implementation
|
|||||||
|
|
||||||
constructor tabsolutevarsym.create(const n : string;def:tdef);
|
constructor tabsolutevarsym.create(const n : string;def:tdef);
|
||||||
begin
|
begin
|
||||||
inherited create(absolutevarsym,n,vs_value,def,[]);
|
inherited create(absolutevarsym,n,vs_value,def,[],true);
|
||||||
ref:=nil;
|
ref:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
constructor tabsolutevarsym.create_ref(const n : string;def:tdef;_ref:tpropaccesslist);
|
constructor tabsolutevarsym.create_ref(const n : string;def:tdef;_ref:tpropaccesslist);
|
||||||
begin
|
begin
|
||||||
inherited create(absolutevarsym,n,vs_value,def,[]);
|
inherited create(absolutevarsym,n,vs_value,def,[],true);
|
||||||
ref:=_ref;
|
ref:=_ref;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user