From ad8f637bd83aeeca7321d6c74b3d7787587c0d55 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Mon, 18 Sep 2017 23:37:28 +0000 Subject: [Coverage] Use gap regions to select better line exec counts After clang started emitting deferred regions (r312818), llvm-cov has had a hard time picking reasonable line execuction counts. There have been one or two generic improvements in this area (e.g r310012), but line counts can still report coverage for whitespace instead of code (llvm.org/PR34612). To fix the problem: * Introduce a new region kind so that frontends can explicitly label gap areas. This is done by changing the encoding of the columnEnd field of MappingRegion. This doesn't substantially increase binary size, and makes it easy to maintain backwards-compatibility. * Don't set the line count to a count from a gap area, unless the count comes from a wrapped segment. * Don't highlight gap areas as uncovered. Fixes llvm.org/PR34612. llvm-svn: 313597 --- llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp') diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp index 1a21b72..300a016 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -527,7 +527,7 @@ void SourceCoverageViewHTML::renderLine( const auto *CurSeg = Segments[I]; if (CurSeg->Col == ExpansionCol) Color = "cyan"; - else if (CheckIfUncovered(CurSeg)) + else if (!CurSeg->IsGapRegion && CheckIfUncovered(CurSeg)) Color = "red"; else Color = None; -- cgit v1.1