mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-26 18:07:24 +01:00
codetools: linkscannr: free directives when StoreDirectives false
git-svn-id: trunk@41123 -
This commit is contained in:
parent
32757eca71
commit
48d579b7f0
@ -511,7 +511,7 @@ type
|
|||||||
property Directives[Index: integer]: PLSDirective read GetDirectives;
|
property Directives[Index: integer]: PLSDirective read GetDirectives;
|
||||||
property DirectivesSorted[Index: integer]: PLSDirective read GetDirectivesSorted; // sorted for Code and SrcPos
|
property DirectivesSorted[Index: integer]: PLSDirective read GetDirectivesSorted; // sorted for Code and SrcPos
|
||||||
property DirectiveCount: integer read FDirectivesCount;
|
property DirectiveCount: integer read FDirectivesCount;
|
||||||
procedure ClearDirectives;
|
procedure ClearDirectives(FreeMemory: boolean);
|
||||||
property StoreDirectives: boolean read FStoreDirectives write SetStoreDirectives;
|
property StoreDirectives: boolean read FStoreDirectives write SetStoreDirectives;
|
||||||
function FindDirective(aCode: Pointer; aSrcPos: integer;
|
function FindDirective(aCode: Pointer; aSrcPos: integer;
|
||||||
out FirstSortedIndex, LastSortedIndex: integer): boolean;
|
out FirstSortedIndex, LastSortedIndex: integer): boolean;
|
||||||
@ -1053,7 +1053,7 @@ begin
|
|||||||
FHiddenUsedUnits:='';
|
FHiddenUsedUnits:='';
|
||||||
ClearMacros;
|
ClearMacros;
|
||||||
ClearLastError;
|
ClearLastError;
|
||||||
ClearDirectives;
|
ClearDirectives(false);
|
||||||
ClearMissingIncludeFiles;
|
ClearMissingIncludeFiles;
|
||||||
for i:=0 to FIncludeStack.Count-1 do begin
|
for i:=0 to FIncludeStack.Count-1 do begin
|
||||||
PLink:=PSourceLink(FIncludeStack[i]);
|
PLink:=PSourceLink(FIncludeStack[i]);
|
||||||
@ -1089,8 +1089,7 @@ end;
|
|||||||
destructor TLinkScanner.Destroy;
|
destructor TLinkScanner.Destroy;
|
||||||
begin
|
begin
|
||||||
Clear;
|
Clear;
|
||||||
ReAllocMem(FDirectivesSorted,0);
|
ClearDirectives(true);
|
||||||
ReAllocMem(FDirectives,0);
|
|
||||||
ReAllocMem(FMacros,0);
|
ReAllocMem(FMacros,0);
|
||||||
FreeAndNil(FIncludeStack);
|
FreeAndNil(FIncludeStack);
|
||||||
FreeAndNil(FSourceChangeSteps);
|
FreeAndNil(FSourceChangeSteps);
|
||||||
@ -1211,12 +1210,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.ClearDirectives;
|
procedure TLinkScanner.ClearDirectives(FreeMemory: boolean);
|
||||||
begin
|
begin
|
||||||
// keep memory allocated, it will probably be needed on next rescan
|
|
||||||
FDirectivesCount:=0;
|
FDirectivesCount:=0;
|
||||||
if FDirectivesSorted<>nil then
|
if FreeMemory then begin
|
||||||
FDirectivesSorted[0]:=nil;
|
ReAllocMem(FDirectives,0);
|
||||||
|
ReAllocMem(FDirectivesSorted,0);
|
||||||
|
FDirectivesCapacity:=0;
|
||||||
|
end else begin
|
||||||
|
if FDirectivesSorted<>nil then
|
||||||
|
FDirectivesSorted[0]:=nil;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLinkScanner.FindDirective(aCode: Pointer; aSrcPos: integer; out
|
function TLinkScanner.FindDirective(aCode: Pointer; aSrcPos: integer; out
|
||||||
@ -4034,7 +4038,7 @@ begin
|
|||||||
if FStoreDirectives=AValue then Exit;
|
if FStoreDirectives=AValue then Exit;
|
||||||
FStoreDirectives:=AValue;
|
FStoreDirectives:=AValue;
|
||||||
if not StoreDirectives then
|
if not StoreDirectives then
|
||||||
ClearDirectives;
|
ClearDirectives(true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLinkScanner.GetIgnoreMissingIncludeFiles: boolean;
|
function TLinkScanner.GetIgnoreMissingIncludeFiles: boolean;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user