[llvm] r217984 - llvm-cov: Push some more debug output into the View (NFC)

Justin Bogner mail at justinbogner.com
Wed Sep 17 14:48:52 PDT 2014


Author: bogner
Date: Wed Sep 17 16:48:52 2014
New Revision: 217984

URL: http://llvm.org/viewvc/llvm-project?rev=217984&view=rev
Log:
llvm-cov: Push some more debug output into the View (NFC)

Modified:
    llvm/trunk/test/tools/llvm-cov/showExpansions.cpp
    llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
    llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp

Modified: llvm/trunk/test/tools/llvm-cov/showExpansions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showExpansions.cpp?rev=217984&r1=217983&r2=217984&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showExpansions.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showExpansions.cpp Wed Sep 17 16:48:52 2014
@@ -23,9 +23,9 @@ int main(int argc, const char *argv[]) {
   return 0;
 }
 
-// CHECK: Expansion of {{[0-9]+}}:13 -> 18 @ {{[0-9]+}}, 22:5
-// CHECK: Expansion of {{[0-9]+}}:4 -> 5 @ {{[0-9]+}}, 15:7
-// CHECK: Expansion of {{[0-9]+}}:7 -> 10 @ {{[0-9]+}}, 17:7
+// CHECK: Expansion at line 22, 5 -> 17
+// CHECK: Expansion at line 15, 7 -> 24
+// CHECK: Expansion at line 17, 7 -> 20
 
 // llvm-cov doesn't work on big endian yet
 // XFAIL: powerpc64-, s390x, mips-, mips64-, sparc

Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=217984&r1=217983&r2=217984&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Wed Sep 17 16:48:52 2014
@@ -190,22 +190,6 @@ CodeCoverageTool::getSourceFile(StringRe
   return *LoadedSourceFiles.back().second;
 }
 
-/// \brief Return a line start - line end range which contains
-/// all the mapping regions of a given function with a particular file id.
-std::pair<unsigned, unsigned>
-findExpandedFileInterestingLineRange(unsigned FileID,
-                                     const FunctionCoverageMapping &Function) {
-  unsigned LineStart = std::numeric_limits<unsigned>::max();
-  unsigned LineEnd = 0;
-  for (const auto &CR : Function.CountedRegions) {
-    if (CR.FileID != FileID)
-      continue;
-    LineStart = std::min(CR.LineStart, LineStart);
-    LineEnd = std::max(CR.LineEnd, LineEnd);
-  }
-  return std::make_pair(LineStart, LineEnd);
-}
-
 bool CodeCoverageTool::equivalentFiles(StringRef A, StringRef B) {
   if (CompareFilenamesOnly)
     return sys::path::filename(A).equals_lower(sys::path::filename(B));
@@ -270,14 +254,6 @@ CodeCoverageTool::findMainViewFileID(con
 void CodeCoverageTool::createExpansionSubView(
     const CountedRegion &ExpandedRegion,
     const FunctionCoverageMapping &Function, SourceCoverageView &Parent) {
-  auto ExpandedLines = findExpandedFileInterestingLineRange(
-      ExpandedRegion.ExpandedFileID, Function);
-  if (ViewOpts.Debug)
-    llvm::errs() << "Expansion of " << ExpandedRegion.ExpandedFileID << ":"
-                 << ExpandedLines.first << " -> " << ExpandedLines.second
-                 << " @ " << ExpandedRegion.FileID << ", "
-                 << ExpandedRegion.LineStart << ":"
-                 << ExpandedRegion.ColumnStart << "\n";
   auto SourceBuffer =
       getSourceFile(Function.Filenames[ExpandedRegion.ExpandedFileID]);
   if (!SourceBuffer)

Modified: llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp?rev=217984&r1=217983&r2=217984&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp Wed Sep 17 16:48:52 2014
@@ -235,6 +235,10 @@ void SourceCoverageView::render(raw_ostr
         OS << "\n";
       }
       // Render the child subview
+      if (Options.Debug)
+        errs() << "Expansion at line " << NextESV->getLine() << ", "
+               << NextESV->getStartCol() << " -> " << NextESV->getEndCol()
+               << "\n";
       NextESV->View->render(OS, false, NestedIndent);
       RenderedSubView = true;
     }





More information about the llvm-commits mailing list