summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/SourceCoverageDataManager.h
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-09-09 05:32:18 +0000
committerJustin Bogner <mail@justinbogner.com>2014-09-09 05:32:18 +0000
commite53be0662adacb2a98b17d2375d781d0ce819805 (patch)
treeb0224c95482f5e145438c434f8b9d4cb47b1c6b3 /llvm/tools/llvm-cov/SourceCoverageDataManager.h
parent8e8aa3ff90448eea2a0ad69368062f87c7fd4058 (diff)
downloadbcm5719-llvm-e53be0662adacb2a98b17d2375d781d0ce819805.tar.gz
bcm5719-llvm-e53be0662adacb2a98b17d2375d781d0ce819805.zip
llvm-cov: Combine two types that were nearly identical (NFC)
llvm-cov had a SourceRange type that was nearly identical to a CountedRegion except that it shaved off a couple of fields. There aren't likely to be enough of these for the minor memory savings to be worth the extra complexity here. llvm-svn: 217417
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageDataManager.h')
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageDataManager.h45
1 files changed, 3 insertions, 42 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageDataManager.h b/llvm/tools/llvm-cov/SourceCoverageDataManager.h
index 148ff947ff7..1c87266e0c4 100644
--- a/llvm/tools/llvm-cov/SourceCoverageDataManager.h
+++ b/llvm/tools/llvm-cov/SourceCoverageDataManager.h
@@ -16,49 +16,14 @@
#include "FunctionCoverageMapping.h"
#include "llvm/ProfileData/CoverageMapping.h"
-#include "llvm/ADT/Hashing.h"
#include <vector>
-#include <unordered_map>
namespace llvm {
/// \brief Partions mapping regions by their kind and sums
/// the execution counts of the regions that start at the same location.
class SourceCoverageDataManager {
-public:
- struct SourceRange {
- unsigned LineStart, ColumnStart, LineEnd, ColumnEnd;
-
- SourceRange(unsigned LineStart, unsigned ColumnStart, unsigned LineEnd,
- unsigned ColumnEnd)
- : LineStart(LineStart), ColumnStart(ColumnStart), LineEnd(LineEnd),
- ColumnEnd(ColumnEnd) {}
-
- bool operator==(const SourceRange &Other) const {
- return LineStart == Other.LineStart && ColumnStart == Other.ColumnStart &&
- LineEnd == Other.LineEnd && ColumnEnd == Other.ColumnEnd;
- }
-
- bool operator<(const SourceRange &Other) const {
- if (LineStart == Other.LineStart)
- return ColumnStart < Other.ColumnStart;
- return LineStart < Other.LineStart;
- }
-
- bool contains(const SourceRange &Other) {
- if (LineStart > Other.LineStart ||
- (LineStart == Other.LineStart && ColumnStart > Other.ColumnStart))
- return false;
- if (LineEnd < Other.LineEnd ||
- (LineEnd == Other.LineEnd && ColumnEnd < Other.ColumnEnd))
- return false;
- return true;
- }
- };
-
-protected:
- std::vector<std::pair<SourceRange, uint64_t>> Regions;
- std::vector<SourceRange> SkippedRegions;
+ std::vector<coverage::CountedRegion> Regions;
bool Uniqued;
public:
@@ -66,12 +31,8 @@ public:
void insert(const coverage::CountedRegion &CR);
- /// \brief Return the source ranges and execution counts
- /// obtained from the non-skipped mapping regions.
- ArrayRef<std::pair<SourceRange, uint64_t>> getSourceRegions();
-
- /// \brief Return the source ranges obtained from the skipped mapping regions.
- ArrayRef<SourceRange> getSkippedRegions() const { return SkippedRegions; }
+ /// \brief Return the source regions in order of first to last occurring.
+ ArrayRef<coverage::CountedRegion> getSourceRegions();
};
} // namespace llvm
OpenPOWER on IntegriCloud