ide: Fixed Assist header master file problem (ArrayCtrl.h wrongly assigned to SystemDraw.cpp via UppHub Turtle.h)

This commit is contained in:
Mirek Fidler 2023-12-10 14:06:04 +01:00
parent e7a7f4884b
commit c3f5d2ee6a
2 changed files with 9 additions and 4 deletions

View file

@ -19,6 +19,7 @@ void AssistEditor::SyncMaster()
if(AssistDiagnostics) {
PutConsole("Master source " << editfile << " -> " << master_source);
PutConsole("Master chain " << AsString(master_chain));
ppi.WhenBlitzBlock = [=](const String& inc, const String& path) {
PutConsole(String() << inc << " blocks BLITZ of " << path);
};

View file

@ -11,7 +11,7 @@ String FindMasterSource(PPInfo& ppi, const Workspace& wspc, const String& header
LTIMING("FindMasterSource");
String header_file = NormalizePath(header_file_);
for(int speculative = 0; speculative < 2; speculative++) {
for(int pass = 0; pass < 3; pass++) {
VectorMap<String, Time> deps;
ArrayMap<String, Index<String>> dics;
for(int i : wspc.use_order) {
@ -20,8 +20,12 @@ String FindMasterSource(PPInfo& ppi, const Workspace& wspc, const String& header
for(int i = 0; i < pk.file.GetCount(); i++) {
String path = SourcePath(pk_name, pk.file[i]);
if(!pk.file[i].separator && ppi.FileExists(path) && !PathIsEqual(header_file, path) &&
IsCppSourceFile(path) && GetFileLength(path) < 4000000) {
ppi.GatherDependencies(path, deps, dics, speculative);
IsCppSourceFile(path) &&
(pass == 2 || // last chance speculative run, any folder
pass == 0 && GetFileFolder(path) == GetFileFolder(header_file) || // prefer source from the same folder first
pass == 1 && GetFileFolder(path) != GetFileFolder(header_file)) &&
GetFileLength(path) < 4000000) {
ppi.GatherDependencies(path, deps, dics, pass > 1);
if(deps.Find(header_file) >= 0)
return path;
}
@ -50,7 +54,7 @@ const VectorMap<String, Time>& FindMasterSourceCached(PPInfo& ppi, const Workspa
VectorMap<String, MasterSourceCacheRecord>& cache)
{
String header_file = NormalizePath(header_file_);
if(cache.GetCount() > 2000) // 2000 cached headers is enough for everybody, right?
cache.Clear();