From aa0be69e7408266f71574b2a3be87e92ff792233 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Fri, 27 Mar 2020 17:43:25 +0100 Subject: [PATCH] Export Segment.IsGapRegion to JSON Summary: So that external tools can make use of that information and not display such lines as uncovered. Fixes https://bugs.llvm.org/show_bug.cgi?id=45300 Reviewers: vsk Reviewed By: vsk Differential Revision: https://reviews.llvm.org/D76763 --- llvm/test/tools/llvm-cov/Inputs/binary-formats.canonical.json | 6 +++--- llvm/tools/llvm-cov/CoverageExporterJson.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/llvm/test/tools/llvm-cov/Inputs/binary-formats.canonical.json b/llvm/test/tools/llvm-cov/Inputs/binary-formats.canonical.json index f8bfced..e6eb0bd 100644 --- a/llvm/test/tools/llvm-cov/Inputs/binary-formats.canonical.json +++ b/llvm/test/tools/llvm-cov/Inputs/binary-formats.canonical.json @@ -4,8 +4,8 @@ CHECK-SAME: "files":[ CHECK-SAME: {"expansions":[], CHECK-SAME: "filename":"/tmp/binary-formats.c", CHECK-SAME: "segments": -CHECK-SAME: 4,40,100,true,true -CHECK-SAME: 4,42,0,false,false +CHECK-SAME: 4,40,100,true,true,false +CHECK-SAME: 4,42,0,false,false,false CHECK-SAME: "summary":{"functions":{"count":1,"covered":1,"percent":100}, CHECK-SAME: "instantiations":{"count":1,"covered":1,"percent":100}, CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100}, @@ -24,4 +24,4 @@ CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100}, CHECK-SAME: "regions":{"count":1,"covered":1,"notcovered":0,"percent":100}}} CHECK-SAME: ], CHECK-SAME: "type":"llvm.coverage.json.export" -CHECK-SAME: "version":"2.0.0" +CHECK-SAME: "version":"2.0.1" diff --git a/llvm/tools/llvm-cov/CoverageExporterJson.cpp b/llvm/tools/llvm-cov/CoverageExporterJson.cpp index ba8ff5c..c5d1b24 100644 --- a/llvm/tools/llvm-cov/CoverageExporterJson.cpp +++ b/llvm/tools/llvm-cov/CoverageExporterJson.cpp @@ -53,7 +53,7 @@ #include /// The semantic version combined as a string. -#define LLVM_COVERAGE_EXPORT_JSON_STR "2.0.0" +#define LLVM_COVERAGE_EXPORT_JSON_STR "2.0.1" /// Unique type identifier for JSON coverage export. #define LLVM_COVERAGE_EXPORT_JSON_TYPE_STR "llvm.coverage.json.export" @@ -72,8 +72,9 @@ int64_t clamp_uint64_to_int64(uint64_t u) { } json::Array renderSegment(const coverage::CoverageSegment &Segment) { - return json::Array({Segment.Line, Segment.Col, clamp_uint64_to_int64(Segment.Count), - Segment.HasCount, Segment.IsRegionEntry}); + return json::Array({Segment.Line, Segment.Col, + clamp_uint64_to_int64(Segment.Count), Segment.HasCount, + Segment.IsRegionEntry, Segment.IsGapRegion}); } json::Array renderRegion(const coverage::CountedRegion &Region) { -- 2.7.4