summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/SourceCoverageView.h
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-08-04 00:36:24 +0000
committerVedant Kumar <vsk@apple.com>2017-08-04 00:36:24 +0000
commit846b985a92cb816dbf22637e98b7d6e726cf4acf (patch)
treeffd2a1ab8840b7595f4dce0ff7abc34b4a25fc74 /llvm/tools/llvm-cov/SourceCoverageView.h
parent8a6223887c843b5fe72c1ed3d82d478a6cc94f3f (diff)
downloadbcm5719-llvm-846b985a92cb816dbf22637e98b7d6e726cf4acf.tar.gz
bcm5719-llvm-846b985a92cb816dbf22637e98b7d6e726cf4acf.zip
[llvm-cov] Ignore unclosed line segments when setting line counts
This patch makes a slight change to the way llvm-cov determines line execution counts. If there are multiple line segments on a line, the line count is the max count among the regions which start *and* end on the line. This avoids an issue posed by deferred regions which start on the same line as a terminated region, e.g: if (false) return; //< The line count should be 0, even though a new region //< starts at the semi-colon. foo(); Another change is that counts from line segments which don't correspond to region entries are considered. This enables the first change, and corrects an outstanding issue (see the showLineExecutionCounts.cpp test change). This is related to D35925. Testing: check-profile, llvm-cov lit tests Differential Revision: https://reviews.llvm.org/D36014 llvm-svn: 310012
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.h')
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageView.h18
1 files changed, 4 insertions, 14 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h
index 9cb608fed60..c9f0c57b5cb 100644
--- a/llvm/tools/llvm-cov/SourceCoverageView.h
+++ b/llvm/tools/llvm-cov/SourceCoverageView.h
@@ -67,25 +67,15 @@ struct InstantiationView {
/// \brief Coverage statistics for a single line.
struct LineCoverageStats {
uint64_t ExecutionCount;
- unsigned RegionCount;
+ bool HasMultipleRegions;
bool Mapped;
- LineCoverageStats() : ExecutionCount(0), RegionCount(0), Mapped(false) {}
+ LineCoverageStats(ArrayRef<const coverage::CoverageSegment *> LineSegments,
+ const coverage::CoverageSegment *WrappedSegment);
bool isMapped() const { return Mapped; }
- bool hasMultipleRegions() const { return RegionCount > 1; }
-
- void addRegionStartCount(uint64_t Count) {
- // The max of all region starts is the most interesting value.
- addRegionCount(RegionCount ? std::max(ExecutionCount, Count) : Count);
- ++RegionCount;
- }
-
- void addRegionCount(uint64_t Count) {
- Mapped = true;
- ExecutionCount = Count;
- }
+ bool hasMultipleRegions() const { return HasMultipleRegions; }
};
/// \brief A file manager that handles format-aware file creation.
OpenPOWER on IntegriCloud