added json for SPF_GetGCovInfo pass

This commit is contained in:
ALEXks
2025-05-02 17:52:28 +03:00
committed by Oleg Nikitin
parent 9ea4e94a74
commit 4d51c0d588
2 changed files with 20 additions and 10 deletions

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2414"
#define VERSION_SPF "2415"

View File

@@ -2253,18 +2253,28 @@ int SPF_GetGCovInfo(void*& context, int winHandler, short *options, short *projN
{
runPassesForVisualizer(projName, { GCOV_PARSER });
string resVal = "";
bool first = true;
for (auto &byFile : gCovInfo)
json gcov_array = json::array();
for (auto& byFile : gCovInfo)
{
if (!first)
resVal += "@";
resVal += byFile.first + "@";
for (auto &elem : byFile.second)
resVal += to_string(elem.first) + " " + to_string(elem.second.getExecutedCount()) + " ";
first = false;
json fileGCov;
fileGCov["file"] = byFile.first;
json info_array = json::array();
for (auto& elem : byFile.second)
{
info_array["line"] = elem.first;
info_array["execution"] = elem.second.getExecutedCount();
}
fileGCov["lines"] = info_array;
gcov_array.push_back(fileGCov);
}
json allGCov;
allGCov["allGCov"] = gcov_array;
string resVal = allGCov.dump();
copyStringToShort(result, resVal);
retSize = (int)resVal.size();
}