From 84dc971ee2bc444a41d01051dba5b83d103ad952 Mon Sep 17 00:00:00 2001 From: Ying Yi Date: Wed, 24 Aug 2016 14:27:23 +0000 Subject: [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 --- llvm/tools/llvm-cov/SourceCoverageView.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'llvm/tools/llvm-cov/SourceCoverageView.h') diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h index 6f2c400..eb820e3 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.h +++ b/llvm/tools/llvm-cov/SourceCoverageView.h @@ -172,6 +172,9 @@ class SourceCoverageView { /// on display. std::vector 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 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. -- cgit v1.1