mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
b3edb56485
This encapsulates how we handle the coverage regions of a file or function. In the old model, the user had to deal with nested regions, so they needed to maintain their own auxiliary data structures to get any useful information out of this. The new API provides a sequence of non-overlapping coverage segments, which makes it possible to render coverage information in a single pass and avoids a fair amount of extra work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217975 91177308-0d34-0410-b5e6-96231b3b80d8
54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
//===- 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
|