blob: eec175222b44261c778da64d165e7c77cd959b8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
//===- SourceCoverageDataManager.h - Manager for source file coverage data-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This class separates and merges mapping regions for a specific source file.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_COV_SOURCECOVERAGEDATAMANAGER_H
#define LLVM_COV_SOURCECOVERAGEDATAMANAGER_H
#include "llvm/ProfileData/CoverageMapping.h"
#include <vector>
namespace llvm {
struct CoverageSegment {
unsigned Line;
unsigned Col;
bool IsRegionEntry;
uint64_t Count;
bool HasCount;
CoverageSegment(unsigned Line, unsigned Col, bool IsRegionEntry)
: Line(Line), Col(Col), IsRegionEntry(IsRegionEntry),
Count(0), HasCount(false) {}
void setCount(uint64_t NewCount) {
Count = NewCount;
HasCount = true;
}
};
/// \brief Partions mapping regions by their kind and sums
/// the execution counts of the regions that start at the same location.
class SourceCoverageDataManager {
std::vector<coverage::CountedRegion> Regions;
std::vector<CoverageSegment> Segments;
public:
void insert(const coverage::CountedRegion &CR);
/// \brief Return a sequence of non-overlapping coverage segments.
ArrayRef<CoverageSegment> getCoverageSegments();
};
} // namespace llvm
#endif // LLVM_COV_SOURCECOVERAGEDATAMANAGER_H
|