From 8d74cb27e82440dbf1bea123613fc373e203680a Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Wed, 29 Jun 2016 00:38:21 +0000 Subject: [llvm-cov] Minor cleanups to prepare for the html format patch - Add renderView{Header,Footer}, renderLineSuffix, and hasSubViews to support creating tables with nested views. - Move the 'Format' cl::opt to make it easier to extend. - Just create one function view file, instead of overwriting the same file for every new function. Add a regression test for this. llvm-svn: 274086 --- llvm/tools/llvm-cov/SourceCoverageView.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (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 3244dc8..98e68b6 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.h +++ b/llvm/tools/llvm-cov/SourceCoverageView.h @@ -183,12 +183,21 @@ protected: /// @name Rendering Interface /// @{ + /// \brief Render a header for the view. + virtual void renderViewHeader(raw_ostream &OS) = 0; + + /// \brief Render a footer for the view. + virtual void renderViewFooter(raw_ostream &OS) = 0; + /// \brief Render the source name for the view. virtual void renderSourceName(raw_ostream &OS) = 0; /// \brief Render the line prefix at the given \p ViewDepth. virtual void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) = 0; + /// \brief Render the line suffix at the given \p ViewDepth. + virtual void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) = 0; + /// \brief Render a view divider at the given \p ViewDepth. virtual void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) = 0; @@ -212,7 +221,7 @@ protected: /// \brief Render the site of an expansion. virtual void - renderExpansionSite(raw_ostream &OS, ExpansionView &ESV, LineRef L, + renderExpansionSite(raw_ostream &OS, LineRef L, const coverage::CoverageSegment *WrappedSegment, CoverageSegmentArray Segments, unsigned ExpansionCol, unsigned ViewDepth) = 0; @@ -231,6 +240,12 @@ protected: /// digits. static std::string formatCount(uint64_t N); + /// \brief Check if region marker output is expected for a line. + bool shouldRenderRegionMarkers(bool LineHasMultipleRegions) const; + + /// \brief Check if there are any sub-views attached to this view. + bool hasSubViews() const; + SourceCoverageView(StringRef SourceName, const MemoryBuffer &File, const CoverageViewOptions &Options, coverage::CoverageData &&CoverageInfo) -- cgit v1.1