mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 22:09:28 +02:00
CodeTools: create new callback FindIncFileInCfgCache in basiccodetools.pas filled by codetoolmanager.pas to omit compilicated unit dependencies introduced in linkscanner.pas by uses section (for modules: CodeToolManager and DefineTemplates) in implementation section (that was the reason of AV on IDE exit and memory leaks, fix for mantis #31575, #31580)
git-svn-id: trunk@54461 -
This commit is contained in:
parent
fbf3e244d0
commit
1903007760
@ -268,6 +268,10 @@ function CompareUnitNameAndUnitFileInfo(UnitnamePAnsiString,
|
||||
function CompareNameSpaceAndNameSpaceInfo(NamespacePAnsiString,
|
||||
NamespaceInfo: Pointer): integer;
|
||||
|
||||
// function filled by CodeToolManager to find inc files
|
||||
var
|
||||
FindIncFileInCfgCache: function(const Name: string; out ExpFilename: string): boolean;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// functions / procedures
|
||||
|
||||
|
@ -6471,9 +6471,24 @@ end;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function FindIncFileInCfgCache(const Name: string; out ExpFilename: string): boolean;
|
||||
var
|
||||
CfgCache: TFPCTargetConfigCache;
|
||||
UnitSet: TFPCUnitSetCache;
|
||||
begin
|
||||
// search the include file in directories defines in fpc.cfg (by -Fi option)
|
||||
UnitSet:=CodeToolBoss.GetUnitSetForDirectory('');
|
||||
if UnitSet<>nil then begin
|
||||
CfgCache:=UnitSet.GetConfigCache(false);
|
||||
Result:=Assigned(CfgCache) and Assigned(CfgCache.Includes)
|
||||
and CfgCache.Includes.GetString(Name,ExpFilename);
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
CodeToolBoss:=TCodeToolManager.Create;
|
||||
OnFindOwnerOfCodeTreeNode:=@GetOwnerForCodeTreeNode;
|
||||
BasicCodeTools.FindIncFileInCfgCache:=@FindIncFileInCfgCache;
|
||||
|
||||
|
||||
finalization
|
||||
|
@ -829,9 +829,6 @@ function dbgs(s: TLSDirectiveKind): string; overload;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
CodeToolManager, DefineTemplates;
|
||||
|
||||
// useful procs ----------------------------------------------------------------
|
||||
|
||||
function IndexOfCodeInUniqueList(ACode: Pointer;
|
||||
@ -3970,9 +3967,6 @@ var
|
||||
end;
|
||||
|
||||
function SearchCasedInIncPath(const RelFilename: string): boolean;
|
||||
var
|
||||
CfgCache: TFPCTargetConfigCache;
|
||||
UnitSet: TFPCUnitSetCache;
|
||||
begin
|
||||
if FilenameIsAbsolute(FMainSourceFilename) then begin
|
||||
// main source has absolute filename
|
||||
@ -3996,17 +3990,12 @@ var
|
||||
if Result then exit;
|
||||
end;
|
||||
|
||||
// then search the include file from fpc.cfg (-Fi option)
|
||||
UnitSet:=CodeToolBoss.GetUnitSetForDirectory('');
|
||||
if UnitSet<>nil then begin
|
||||
CfgCache:=UnitSet.GetConfigCache(false);
|
||||
if Assigned(CfgCache) and Assigned(CfgCache.Includes)
|
||||
and CfgCache.Includes.GetString(AFilename,ExpFilename) then
|
||||
begin
|
||||
NewCode:=LoadSourceCaseLoUp(ExpFilename);
|
||||
Result:=(NewCode<>nil);
|
||||
if Result then exit;
|
||||
end;
|
||||
// then search the include file in directories defines in fpc.cfg (by -Fi option)
|
||||
if FindIncFileInCfgCache(AFilename,ExpFilename) then
|
||||
begin
|
||||
NewCode:=LoadSourceCaseLoUp(ExpFilename);
|
||||
Result:=(NewCode<>nil);
|
||||
if Result then exit;
|
||||
end;
|
||||
|
||||
// then search the include file in the include path
|
||||
|
Loading…
Reference in New Issue
Block a user