mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 03:25:23 +00:00
llvm-cov: Disentangle the coverage data logic from the display (NFC)
This splits the logic for actually looking up coverage information from the logic that displays it. These were tangled rather thoroughly so this change is a bit large, but it mostly consists of moving things around. The coverage lookup logic itself now lives in the library, rather than being spread between the library and the tool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218184 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#define LLVM_COV_SOURCECOVERAGEVIEW_H
|
||||
|
||||
#include "CoverageViewOptions.h"
|
||||
#include "SourceCoverageDataManager.h"
|
||||
#include "llvm/ProfileData/CoverageMapping.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include <vector>
|
||||
@@ -105,14 +104,14 @@ private:
|
||||
|
||||
const MemoryBuffer &File;
|
||||
const CoverageViewOptions &Options;
|
||||
std::unique_ptr<SourceCoverageDataManager> RegionManager;
|
||||
coverage::CoverageData CoverageInfo;
|
||||
std::vector<ExpansionView> ExpansionSubViews;
|
||||
std::vector<InstantiationView> InstantiationSubViews;
|
||||
|
||||
/// \brief Render a source line with highlighting.
|
||||
void renderLine(raw_ostream &OS, StringRef Line, int64_t LineNumber,
|
||||
const CoverageSegment *WrappedSegment,
|
||||
ArrayRef<const CoverageSegment *> Segments,
|
||||
const coverage::CoverageSegment *WrappedSegment,
|
||||
ArrayRef<const coverage::CoverageSegment *> Segments,
|
||||
unsigned ExpansionCol);
|
||||
|
||||
void renderIndent(raw_ostream &OS, unsigned Level);
|
||||
@@ -126,16 +125,18 @@ private:
|
||||
void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo);
|
||||
|
||||
/// \brief Render all the region's execution counts on a line.
|
||||
void renderRegionMarkers(raw_ostream &OS,
|
||||
ArrayRef<const CoverageSegment *> Segments);
|
||||
void
|
||||
renderRegionMarkers(raw_ostream &OS,
|
||||
ArrayRef<const coverage::CoverageSegment *> Segments);
|
||||
|
||||
static const unsigned LineCoverageColumnWidth = 7;
|
||||
static const unsigned LineNumberColumnWidth = 5;
|
||||
|
||||
public:
|
||||
SourceCoverageView(const MemoryBuffer &File,
|
||||
const CoverageViewOptions &Options)
|
||||
: File(File), Options(Options) {}
|
||||
const CoverageViewOptions &Options,
|
||||
coverage::CoverageData &&CoverageInfo)
|
||||
: File(File), Options(Options), CoverageInfo(std::move(CoverageInfo)) {}
|
||||
|
||||
const CoverageViewOptions &getOptions() const { return Options; }
|
||||
|
||||
@@ -154,12 +155,6 @@ public:
|
||||
/// \brief Print the code coverage information for a specific
|
||||
/// portion of a source file to the output stream.
|
||||
void render(raw_ostream &OS, bool WholeFile, unsigned IndentLevel = 0);
|
||||
|
||||
/// \brief Load the coverage information required for rendering
|
||||
/// from the mapping regions in the data manager.
|
||||
void load(std::unique_ptr<SourceCoverageDataManager> Data) {
|
||||
RegionManager = std::move(Data);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
Reference in New Issue
Block a user