mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-19 11:49:15 +02:00
+ added code for reference list creation for tsym
+ tsym.IncRefCount both increments refs and creates a reference entry + tsym.IncRefCountBy only increments refs git-svn-id: trunk@6140 -
This commit is contained in:
parent
11be490034
commit
1c77710813
@ -27,9 +27,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
{ common }
|
{ common }
|
||||||
cutils,
|
cutils,
|
||||||
{$ifdef MEMDEBUG}
|
|
||||||
cclasses,
|
cclasses,
|
||||||
{$endif MEMDEBUG}
|
|
||||||
{ global }
|
{ global }
|
||||||
globtype,globals,
|
globtype,globals,
|
||||||
{ symtable }
|
{ symtable }
|
||||||
@ -99,8 +97,10 @@ interface
|
|||||||
fileinfo : tfileposinfo;
|
fileinfo : tfileposinfo;
|
||||||
symoptions : tsymoptions;
|
symoptions : tsymoptions;
|
||||||
refs : longint;
|
refs : longint;
|
||||||
|
reflist : TLinkedList;
|
||||||
isdbgwritten : boolean;
|
isdbgwritten : boolean;
|
||||||
constructor create(st:tsymtyp;const aname:string);
|
constructor create(st:tsymtyp;const aname:string);
|
||||||
|
destructor destroy;override;
|
||||||
function mangledname:string; virtual;
|
function mangledname:string; virtual;
|
||||||
procedure buildderef;virtual;
|
procedure buildderef;virtual;
|
||||||
procedure deref;virtual;
|
procedure deref;virtual;
|
||||||
@ -110,6 +110,10 @@ interface
|
|||||||
}
|
}
|
||||||
function is_visible_for_object(currobjdef:tdef;context : tdef):boolean;virtual;
|
function is_visible_for_object(currobjdef:tdef;context : tdef):boolean;virtual;
|
||||||
procedure ChangeOwner(st:TSymtable);
|
procedure ChangeOwner(st:TSymtable);
|
||||||
|
procedure IncRefCount;
|
||||||
|
procedure IncRefCountBy(AValue : longint);
|
||||||
|
procedure MaybeCreateRefList;
|
||||||
|
procedure AddRef;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
tsymarr = array[0..maxlongint div sizeof(pointer)-1] of tsym;
|
tsymarr = array[0..maxlongint div sizeof(pointer)-1] of tsym;
|
||||||
@ -199,6 +203,7 @@ interface
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
crefs,
|
||||||
verbose,
|
verbose,
|
||||||
fmodule
|
fmodule
|
||||||
;
|
;
|
||||||
@ -324,12 +329,48 @@ implementation
|
|||||||
inherited CreateNotOwned;
|
inherited CreateNotOwned;
|
||||||
realname:=aname;
|
realname:=aname;
|
||||||
typ:=st;
|
typ:=st;
|
||||||
|
RefList:=nil;
|
||||||
symoptions:=[];
|
symoptions:=[];
|
||||||
fileinfo:=current_tokenpos;
|
fileinfo:=current_tokenpos;
|
||||||
isdbgwritten := false;
|
isdbgwritten := false;
|
||||||
symoptions:=current_object_option;
|
symoptions:=current_object_option;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
destructor Tsym.destroy;
|
||||||
|
begin
|
||||||
|
if assigned(RefList) then
|
||||||
|
RefList.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Tsym.IncRefCount;
|
||||||
|
begin
|
||||||
|
inc(refs);
|
||||||
|
if cs_browser in current_settings.moduleswitches then
|
||||||
|
begin
|
||||||
|
MaybeCreateRefList;
|
||||||
|
AddRef;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Tsym.IncRefCountBy(AValue : longint);
|
||||||
|
begin
|
||||||
|
inc(refs,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Tsym.MaybeCreateRefList;
|
||||||
|
begin
|
||||||
|
if not assigned(reflist) then
|
||||||
|
reflist:=TRefLinkedList.create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Tsym.AddRef;
|
||||||
|
var
|
||||||
|
RefItem: TRefItem;
|
||||||
|
begin
|
||||||
|
RefItem:=TRefItem.Create(current_tokenpos);
|
||||||
|
RefList.Concat(RefItem);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure Tsym.buildderef;
|
procedure Tsym.buildderef;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user