improved and fixed FDVM, added ISNERT_INCLUDES pass

This commit is contained in:
ALEXks
2023-12-16 17:42:11 +03:00
parent 110970caa6
commit 1f3d9944b8
10 changed files with 613 additions and 775 deletions

View File

@@ -321,7 +321,8 @@ static string unparseProjectIfNeed(SgFile* file, const int curr_regime, const bo
//TODO: add freeForm for each file
if (curr_regime == INSERT_INCLUDES && filesToInclude.find(file_name) != filesToInclude.end())
{
unparseToBuf = removeIncludeStatsAndUnparse(file, file_name, fout_name.c_str(), allIncludeFiles, out_free_form == 1, moduleUsesByFile, moduleDecls, getObjectForFileFromMap(file_name, exctactedModuleStats), toString, true); //,
unparseToBuf = removeIncludeStatsAndUnparse(file, file_name, fout_name.c_str(), allIncludeFiles, out_free_form == 1, moduleUsesByFile,
moduleDecls, getObjectForFileFromMap(file_name, exctactedModuleStats), toString, true);
auto itI = filesToInclude.find(file_name);
for (auto& incl : itI->second)
if (allIncludeFiles.find(incl) != allIncludeFiles.end())
@@ -329,7 +330,8 @@ static string unparseProjectIfNeed(SgFile* file, const int curr_regime, const bo
}
else
{
unparseToBuf = removeIncludeStatsAndUnparse(file, file_name, fout_name.c_str(), allIncludeFiles, out_free_form == 1, moduleUsesByFile, moduleDecls, getObjectForFileFromMap(file_name, exctactedModuleStats), toString);
unparseToBuf = removeIncludeStatsAndUnparse(file, file_name, fout_name.c_str(), allIncludeFiles, out_free_form == 1, moduleUsesByFile,
moduleDecls, getObjectForFileFromMap(file_name, exctactedModuleStats), toString);
// copy includes that have not changed
if (folderName != NULL)
@@ -995,6 +997,10 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
fileIt->second.insert(first->fileName());
}
}
if (inlcudeAllFiles)
if (fileIt->second.size())
filesToInclude[file_name] = fileIt->second;
}
else if (curr_regime == REMOVE_AND_CALC_SHADOW)
{
@@ -2825,6 +2831,8 @@ int main(int argc, char **argv)
debSh = 1;
else if (string(curr_arg) == "-noLogo")
noLogo = true;
else if (string(curr_arg) == "-includeAll")
inlcudeAllFiles = true;
break;
default:
break;

View File

@@ -46,6 +46,7 @@ bool ignoreArrayDistributeState = false;
bool fullDepGraph = false;
bool noLogo = false;
bool withTemplateInfo = false;
bool inlcudeAllFiles = false; // for pass INSERT_INLCUDES
uint64_t currentAvailMemory = 0;
int QUALITY; // quality of conflicts search in graph
@@ -82,7 +83,7 @@ std::map<std::string, std::map<int, std::set<std::string>>> commentsToInclude;
//
//for INSERT_INCLUDES
std::map<std::string, std::set<std::string>> filesToInclude;
std::map<std::string, std::set<std::string>> filesToInclude; // file -> includes
//
//for PASSES DEPENDENSIES

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2256"
#define VERSION_SPF "2257"