diff --git a/tools/sancov/sancov.cc b/tools/sancov/sancov.cc index d7ce120c7e2..ff2039de35e 100644 --- a/tools/sancov/sancov.cc +++ b/tools/sancov/sancov.cc @@ -408,6 +408,8 @@ static void operator<<(JSONWriter &W, for (const auto &P : PointsByFn) { std::string FunctionName = P.first; + std::set WrittenIds; + ByFn->key(FunctionName); // Output : ":". @@ -416,7 +418,10 @@ static void operator<<(JSONWriter &W, for (const auto &Loc : Point->Locs) { if (Loc.FileName != FileName || Loc.FunctionName != FunctionName) continue; + if (WrittenIds.find(Point->Id) != WrittenIds.end()) + continue; + WrittenIds.insert(Point->Id); ById->key(Point->Id); W << (utostr(Loc.Line) + ":" + utostr(Loc.Column)); }