mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-07 20:40:28 +00:00
[llvm-cov] Use the coverage namespace. NFC.
This is a simple code cleanup. It will facilitate moving LineCoverageIterator to libCoverage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316140 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e03fc7c67e
commit
34ea0deeb1
@ -84,10 +84,9 @@ CoveragePrinter::create(const CoverageViewOptions &Opts) {
|
||||
}
|
||||
|
||||
unsigned SourceCoverageView::getFirstUncoveredLineNo() {
|
||||
const auto MinSegIt =
|
||||
find_if(CoverageInfo, [](const coverage::CoverageSegment &S) {
|
||||
return S.HasCount && S.Count == 0;
|
||||
});
|
||||
const auto MinSegIt = find_if(CoverageInfo, [](const CoverageSegment &S) {
|
||||
return S.HasCount && S.Count == 0;
|
||||
});
|
||||
|
||||
// There is no uncovered line, return zero.
|
||||
if (MinSegIt == CoverageInfo.end())
|
||||
@ -132,7 +131,7 @@ bool SourceCoverageView::hasSubViews() const {
|
||||
std::unique_ptr<SourceCoverageView>
|
||||
SourceCoverageView::create(StringRef SourceName, const MemoryBuffer &File,
|
||||
const CoverageViewOptions &Options,
|
||||
coverage::CoverageData &&CoverageInfo) {
|
||||
CoverageData &&CoverageInfo) {
|
||||
switch (Options.Format) {
|
||||
case CoverageViewOptions::OutputFormat::Text:
|
||||
return llvm::make_unique<SourceCoverageViewText>(
|
||||
@ -152,7 +151,7 @@ std::string SourceCoverageView::getSourceName() const {
|
||||
}
|
||||
|
||||
void SourceCoverageView::addExpansion(
|
||||
const coverage::CounterMappingRegion &Region,
|
||||
const CounterMappingRegion &Region,
|
||||
std::unique_ptr<SourceCoverageView> View) {
|
||||
ExpansionSubViews.emplace_back(Region, std::move(View));
|
||||
}
|
||||
|
@ -22,15 +22,17 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
using namespace coverage;
|
||||
|
||||
class CoverageFiltersMatchAll;
|
||||
class SourceCoverageView;
|
||||
|
||||
/// \brief A view that represents a macro or include expansion.
|
||||
struct ExpansionView {
|
||||
coverage::CounterMappingRegion Region;
|
||||
CounterMappingRegion Region;
|
||||
std::unique_ptr<SourceCoverageView> View;
|
||||
|
||||
ExpansionView(const coverage::CounterMappingRegion &Region,
|
||||
ExpansionView(const CounterMappingRegion &Region,
|
||||
std::unique_ptr<SourceCoverageView> View)
|
||||
: Region(Region), View(std::move(View)) {}
|
||||
ExpansionView(ExpansionView &&RHS)
|
||||
@ -112,7 +114,7 @@ public:
|
||||
|
||||
/// \brief Create an index which lists reports for the given source files.
|
||||
virtual Error createIndexFile(ArrayRef<std::string> SourceFiles,
|
||||
const coverage::CoverageMapping &Coverage,
|
||||
const CoverageMapping &Coverage,
|
||||
const CoverageFiltersMatchAll &Filters) = 0;
|
||||
|
||||
/// @}
|
||||
@ -134,7 +136,7 @@ class SourceCoverageView {
|
||||
const CoverageViewOptions &Options;
|
||||
|
||||
/// Complete coverage information about the source on display.
|
||||
coverage::CoverageData CoverageInfo;
|
||||
CoverageData CoverageInfo;
|
||||
|
||||
/// A container for all expansions (e.g macros) in the source on display.
|
||||
std::vector<ExpansionView> ExpansionSubViews;
|
||||
@ -154,7 +156,7 @@ protected:
|
||||
LineRef(StringRef Line, int64_t LineNo) : Line(Line), LineNo(LineNo) {}
|
||||
};
|
||||
|
||||
using CoverageSegmentArray = ArrayRef<const coverage::CoverageSegment *>;
|
||||
using CoverageSegmentArray = ArrayRef<const CoverageSegment *>;
|
||||
|
||||
/// @name Rendering Interface
|
||||
/// @{
|
||||
@ -230,15 +232,14 @@ protected:
|
||||
|
||||
SourceCoverageView(StringRef SourceName, const MemoryBuffer &File,
|
||||
const CoverageViewOptions &Options,
|
||||
coverage::CoverageData &&CoverageInfo)
|
||||
CoverageData &&CoverageInfo)
|
||||
: SourceName(SourceName), File(File), Options(Options),
|
||||
CoverageInfo(std::move(CoverageInfo)) {}
|
||||
|
||||
public:
|
||||
static std::unique_ptr<SourceCoverageView>
|
||||
create(StringRef SourceName, const MemoryBuffer &File,
|
||||
const CoverageViewOptions &Options,
|
||||
coverage::CoverageData &&CoverageInfo);
|
||||
const CoverageViewOptions &Options, CoverageData &&CoverageInfo);
|
||||
|
||||
virtual ~SourceCoverageView() {}
|
||||
|
||||
@ -248,7 +249,7 @@ public:
|
||||
const CoverageViewOptions &getOptions() const { return Options; }
|
||||
|
||||
/// \brief Add an expansion subview to this view.
|
||||
void addExpansion(const coverage::CounterMappingRegion &Region,
|
||||
void addExpansion(const CounterMappingRegion &Region,
|
||||
std::unique_ptr<SourceCoverageView> View);
|
||||
|
||||
/// \brief Add a function instantiation subview to this view.
|
||||
|
@ -365,8 +365,7 @@ void CoveragePrinterHTML::emitFileSummary(raw_ostream &OS, StringRef SF,
|
||||
}
|
||||
|
||||
Error CoveragePrinterHTML::createIndexFile(
|
||||
ArrayRef<std::string> SourceFiles,
|
||||
const coverage::CoverageMapping &Coverage,
|
||||
ArrayRef<std::string> SourceFiles, const CoverageMapping &Coverage,
|
||||
const CoverageFiltersMatchAll &Filters) {
|
||||
// Emit the default stylesheet.
|
||||
auto CSSOrErr = createOutputStream("style", "css", /*InToplevel=*/true);
|
||||
@ -515,7 +514,7 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L,
|
||||
return tag("span", Snippet, Color.getValue());
|
||||
};
|
||||
|
||||
auto CheckIfUncovered = [](const coverage::CoverageSegment *S) {
|
||||
auto CheckIfUncovered = [](const CoverageSegment *S) {
|
||||
return S && S->HasCount && S->Count == 0;
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
using namespace coverage;
|
||||
|
||||
struct FileCoverageSummary;
|
||||
|
||||
/// \brief A coverage printer for html output.
|
||||
|
@ -29,8 +29,7 @@ void CoveragePrinterText::closeViewFile(OwnedStream OS) {
|
||||
}
|
||||
|
||||
Error CoveragePrinterText::createIndexFile(
|
||||
ArrayRef<std::string> SourceFiles,
|
||||
const coverage::CoverageMapping &Coverage,
|
||||
ArrayRef<std::string> SourceFiles, const CoverageMapping &Coverage,
|
||||
const CoverageFiltersMatchAll &Filters) {
|
||||
auto OSOrErr = createOutputStream("index", "txt", /*InToplevel=*/true);
|
||||
if (Error E = OSOrErr.takeError())
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
using namespace coverage;
|
||||
|
||||
/// \brief A coverage printer for text output.
|
||||
class CoveragePrinterText : public CoveragePrinter {
|
||||
public:
|
||||
@ -27,7 +29,7 @@ public:
|
||||
void closeViewFile(OwnedStream OS) override;
|
||||
|
||||
Error createIndexFile(ArrayRef<std::string> SourceFiles,
|
||||
const coverage::CoverageMapping &Coverage,
|
||||
const CoverageMapping &Coverage,
|
||||
const CoverageFiltersMatchAll &Filters) override;
|
||||
|
||||
CoveragePrinterText(const CoverageViewOptions &Opts)
|
||||
@ -77,7 +79,7 @@ class SourceCoverageViewText : public SourceCoverageView {
|
||||
public:
|
||||
SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File,
|
||||
const CoverageViewOptions &Options,
|
||||
coverage::CoverageData &&CoverageInfo)
|
||||
CoverageData &&CoverageInfo)
|
||||
: SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user