[llvm-cov] Add the project summary to each source file coverage report.

This patch includes the following changes:
- Included header "Code coverage report" and include the date that the report was created.
- Included title (as specified in a command line option, (i.e llvm-cov  -project-title="Simple Test")
- In the summary, list the elf files that the source code file has contributed to.
- Used column heading for "Line No.", "Count No.", Source".

Differential Revision: https://reviews.llvm.org/D23345

llvm-svn: 279628
This commit is contained in:
Ying Yi
2016-08-24 14:27:23 +00:00
parent c22e32deac
commit 84dc971ee2
12 changed files with 254 additions and 40 deletions

View File

@@ -172,6 +172,9 @@ class SourceCoverageView {
/// on display.
std::vector<InstantiationView> InstantiationSubViews;
/// Specifies whether or not the view is a function view.
bool FunctionView;
protected:
struct LineRef {
StringRef Line;
@@ -192,7 +195,7 @@ protected:
virtual void renderViewFooter(raw_ostream &OS) = 0;
/// \brief Render the source name for the view.
virtual void renderSourceName(raw_ostream &OS) = 0;
virtual void renderSourceName(raw_ostream &OS, bool WholeFile) = 0;
/// \brief Render the line prefix at the given \p ViewDepth.
virtual void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) = 0;
@@ -236,6 +239,13 @@ protected:
virtual void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
unsigned ViewDepth) = 0;
/// \brief Render the project title, the report title \p CellText and the
/// created time for the view.
virtual void renderCellInTitle(raw_ostream &OS, StringRef CellText) = 0;
/// \brief Render the table header for a given source file
virtual void renderTableHeader(raw_ostream &OS, unsigned IndentLevel = 0) = 0;
/// @}
/// \brief Format a count using engineering notation with 3 significant
@@ -250,20 +260,22 @@ protected:
SourceCoverageView(StringRef SourceName, const MemoryBuffer &File,
const CoverageViewOptions &Options,
coverage::CoverageData &&CoverageInfo)
coverage::CoverageData &&CoverageInfo, bool FunctionView)
: SourceName(SourceName), File(File), Options(Options),
CoverageInfo(std::move(CoverageInfo)) {}
CoverageInfo(std::move(CoverageInfo)), FunctionView(FunctionView) {}
public:
static std::unique_ptr<SourceCoverageView>
create(StringRef SourceName, const MemoryBuffer &File,
const CoverageViewOptions &Options,
coverage::CoverageData &&CoverageInfo);
coverage::CoverageData &&CoverageInfo, bool FucntionView = false);
virtual ~SourceCoverageView() {}
StringRef getSourceName() const { return SourceName; }
bool isFunctionView() const { return FunctionView; }
const CoverageViewOptions &getOptions() const { return Options; }
/// \brief Add an expansion subview to this view.