Merge branch 'master' into o.nikitin_private_arrays
This commit is contained in:
@@ -65,6 +65,7 @@
|
||||
#include "DvmhRegions/LoopChecker.h"
|
||||
#include "DvmhRegions/ReadWriteAnalyzer.h"
|
||||
#include "Utils/utils.h"
|
||||
#include "Utils/json.hpp"
|
||||
#include "Distribution/Array.h"
|
||||
|
||||
#include "VisualizerCalls/get_information.h"
|
||||
@@ -108,6 +109,7 @@ using namespace std;
|
||||
using std::chrono::high_resolution_clock;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::milliseconds;
|
||||
using json = nlohmann::json;
|
||||
|
||||
int PASSES_DONE[EMPTY_PASS];
|
||||
bool PASSES_DONE_INIT = false;
|
||||
@@ -332,9 +334,10 @@ static string unparseProjectIfNeed(SgFile* file, const int curr_regime, const bo
|
||||
unparseToBuf = removeIncludeStatsAndUnparse(file, file_name, fout_name.c_str(), allIncludeFiles, out_free_form == 1, moduleUsesByFile,
|
||||
moduleDecls, getObjectForFileFromMap(file_name, exctactedModuleStats), toString, false, true);
|
||||
auto itI = filesToInclude.find(file_name);
|
||||
for (auto& [_, incl] : itI->second)
|
||||
if (allIncludeFiles.find(incl) != allIncludeFiles.end())
|
||||
allIncludeFiles.erase(incl);
|
||||
for (auto& [_, incls] : itI->second)
|
||||
for (auto& incl : incls)
|
||||
if (allIncludeFiles.find(incl) != allIncludeFiles.end())
|
||||
allIncludeFiles.erase(incl);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -828,7 +831,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
{
|
||||
auto fileIt = includeDependencies.find(file_name);
|
||||
if (fileIt == includeDependencies.end())
|
||||
fileIt = includeDependencies.insert(fileIt, make_pair(file_name, vector<pair<int, string>>()));
|
||||
fileIt = includeDependencies.insert(fileIt, make_pair(file_name, map<int, set<string>>()));
|
||||
|
||||
set<string> modFiles;
|
||||
for (auto& elem : moduleDecls)
|
||||
@@ -845,7 +848,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
{
|
||||
if (lastFromFile == NULL)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
fileIt->second.push_back(make_pair(lastFromFile->lineNumber(), st->fileName()));
|
||||
fileIt->second[lastFromFile->lineNumber()].insert(st->fileName());
|
||||
}
|
||||
else
|
||||
lastFromFile = st;
|
||||
@@ -1608,12 +1611,15 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
set<string> includedToThisFile;
|
||||
if (itDep != includeDependencies.end())
|
||||
{
|
||||
for (auto& [_, incl] : itDep->second)
|
||||
for (auto& [_, incls] : itDep->second)
|
||||
{
|
||||
auto comm = commentsToInclude.find(incl);
|
||||
if (comm != commentsToInclude.end())
|
||||
for (auto &allComm : comm->second)
|
||||
includedToThisFile.insert(allComm.second.begin(), allComm.second.end());
|
||||
for (auto& incl : incls)
|
||||
{
|
||||
auto comm = commentsToInclude.find(incl);
|
||||
if (comm != commentsToInclude.end())
|
||||
for (auto& allComm : comm->second)
|
||||
includedToThisFile.insert(allComm.second.begin(), allComm.second.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2047,7 +2053,7 @@ static void findFunctionsToInclude(bool needToAddErrors)
|
||||
SPF_messages[byFile.first].push_back(message);
|
||||
else
|
||||
{
|
||||
if (message.type != ERROR)
|
||||
if (message.getType() != ERROR)
|
||||
SPF_messages[byFile.first].push_back(message);
|
||||
else
|
||||
lastErrors[byFile.first].push_back(message);
|
||||
@@ -2222,8 +2228,7 @@ void runPass(const int curr_regime, const char *proj_name, const char *folderNam
|
||||
runPass(GROUP_ACTUAL_AND_REMOTE, proj_name, folderName);
|
||||
|
||||
runAnalysis(*project, CALCULATE_STATS_SCHEME, false);
|
||||
for (auto& elem : allPredictorStats)
|
||||
__spf_print(1, " stat for file %s: %s\n", elem.first.c_str(), elem.second.to_string().c_str());
|
||||
|
||||
//TODO: need to rewrite this to new algo
|
||||
/*if (!folderName && !consoleMode || predictOn)
|
||||
runAnalysis(*project, PREDICT_SCHEME, false); */
|
||||
@@ -2391,7 +2396,7 @@ void runPass(const int curr_regime, const char *proj_name, const char *folderNam
|
||||
break;
|
||||
case PARSE_FILES:
|
||||
{
|
||||
int err = parseFiles(proj_name, filesCompilationOrder, parseForInlining);
|
||||
int err = parseFiles(proj_name, filesCompilationOrder, parseForInlining, SPF_messages);
|
||||
if (err != 0)
|
||||
throw err;
|
||||
}
|
||||
@@ -2660,26 +2665,28 @@ int main(int argc, char **argv)
|
||||
{
|
||||
printStackTrace();
|
||||
printf("exception occurred\n");
|
||||
|
||||
json byFileArray = json::array();
|
||||
for (auto& byFile : SPF_messages)
|
||||
{
|
||||
json inFile;
|
||||
inFile["file"] = byFile.first;
|
||||
|
||||
json messages = json::array();
|
||||
for (auto& message : byFile.second)
|
||||
{
|
||||
string toPrint = "";
|
||||
for (int z = 0; z < message.engMessage.size(); ++z)
|
||||
toPrint += message.engMessage[z];
|
||||
string type;
|
||||
if (message.type == WARR)
|
||||
type = "WARR";
|
||||
else if (message.type == ERROR)
|
||||
type = "ERROR";
|
||||
else if (message.type == NOTE)
|
||||
type = "NOTE";
|
||||
else
|
||||
type = "UNKN";
|
||||
|
||||
printf("%s - [#%d: %s: line %d]: %s\n", type.c_str(), message.group, byFile.first.c_str(), message.line, toPrint.c_str());
|
||||
message.print(byFile.first);
|
||||
messages.push_back(message.toJson());
|
||||
}
|
||||
inFile["messages"] = messages;
|
||||
byFileArray.push_back(inFile);
|
||||
}
|
||||
json allMessages;
|
||||
allMessages["allMessage"] = byFileArray;
|
||||
|
||||
FILE* outF = fopen("dump_messages.json", "w");
|
||||
fprintf(outF, "%s", allMessages.dump().c_str());
|
||||
fclose(outF);
|
||||
}
|
||||
|
||||
deleteAllAllocatedData(withDel);
|
||||
|
||||
Reference in New Issue
Block a user