[llvm] r273633 - [llvm-cov] Rename SourceCoverageView::LineCoverageInfo to LineCoverageStats, NFC

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 23 17:34:49 PDT 2016


Author: vedantk
Date: Thu Jun 23 19:34:48 2016
New Revision: 273633

URL: http://llvm.org/viewvc/llvm-project?rev=273633&view=rev
Log:
[llvm-cov] Rename SourceCoverageView::LineCoverageInfo to LineCoverageStats, NFC

Pull LineCoverageInfo out of SourceCoverageView and rename it so that it
doesn't conflict with another class of the same name in
CoverageSummaryInfo.h.

This cuts down on the amount of code we have to move into a `protected`
section of SourceCoverageView for the upcoming html patch. It also makes
the code a bit clearer: having two LineCoverageInfo's is strange.

Modified:
    llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
    llvm/trunk/tools/llvm-cov/SourceCoverageView.h

Modified: llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp?rev=273633&r1=273632&r2=273633&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp Thu Jun 23 19:34:48 2016
@@ -96,7 +96,7 @@ static std::string formatCount(uint64_t
 
 void
 SourceCoverageView::renderLineCoverageColumn(raw_ostream &OS,
-                                             const LineCoverageInfo &Line) {
+                                             const LineCoverageStats &Line) {
   if (!Line.isMapped()) {
     OS.indent(LineCoverageColumnWidth) << '|';
     return;
@@ -186,7 +186,7 @@ void SourceCoverageView::render(raw_ostr
       LineSegments.push_back(&*NextSegment++);
 
     // Calculate a count to be for the line as a whole.
-    LineCoverageInfo LineCount;
+    LineCoverageStats LineCount;
     if (WrappedSegment && WrappedSegment->HasCount)
       LineCount.addRegionCount(WrappedSegment->Count);
     for (const auto *S : LineSegments)

Modified: llvm/trunk/tools/llvm-cov/SourceCoverageView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageView.h?rev=273633&r1=273632&r2=273633&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageView.h (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageView.h Thu Jun 23 19:34:48 2016
@@ -73,34 +73,34 @@ struct InstantiationView {
   }
 };
 
+/// \brief Coverage statistics for a single line.
+struct LineCoverageStats {
+  uint64_t ExecutionCount;
+  unsigned RegionCount;
+  bool Mapped;
+
+  LineCoverageStats() : ExecutionCount(0), RegionCount(0), Mapped(false) {}
+
+  bool isMapped() const { return Mapped; }
+
+  bool hasMultipleRegions() const { return RegionCount > 1; }
+
+  void addRegionStartCount(uint64_t Count) {
+    // The max of all region starts is the most interesting value.
+    addRegionCount(RegionCount ? std::max(ExecutionCount, Count) : Count);
+    ++RegionCount;
+  }
+
+  void addRegionCount(uint64_t Count) {
+    Mapped = true;
+    ExecutionCount = Count;
+  }
+};
+
 /// \brief A code coverage view of a specific source file.
 /// It can have embedded coverage views.
 class SourceCoverageView {
 private:
-  /// \brief Coverage information for a single line.
-  struct LineCoverageInfo {
-    uint64_t ExecutionCount;
-    unsigned RegionCount;
-    bool Mapped;
-
-    LineCoverageInfo() : ExecutionCount(0), RegionCount(0), Mapped(false) {}
-
-    bool isMapped() const { return Mapped; }
-
-    bool hasMultipleRegions() const { return RegionCount > 1; }
-
-    void addRegionStartCount(uint64_t Count) {
-      // The max of all region starts is the most interesting value.
-      addRegionCount(RegionCount ? std::max(ExecutionCount, Count) : Count);
-      ++RegionCount;
-    }
-
-    void addRegionCount(uint64_t Count) {
-      Mapped = true;
-      ExecutionCount = Count;
-    }
-  };
-
   const MemoryBuffer &File;
   const CoverageViewOptions &Options;
   coverage::CoverageData CoverageInfo;
@@ -118,7 +118,7 @@ private:
   void renderViewDivider(unsigned Offset, unsigned Length, raw_ostream &OS);
 
   /// \brief Render the line's execution count column.
-  void renderLineCoverageColumn(raw_ostream &OS, const LineCoverageInfo &Line);
+  void renderLineCoverageColumn(raw_ostream &OS, const LineCoverageStats &Line);
 
   /// \brief Render the line number column.
   void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo);




More information about the llvm-commits mailing list