[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
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 @@
   /// @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 @@
 
   /// \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 @@
   /// 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)