[PATCH] D23277: [llvm-cov] Add the "Goto first zero count" feature.

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 10:58:51 PDT 2016


vsk added a comment.

Great, this is exactly what I had in mind! I'd like to request two minor changes --


================
Comment at: tools/llvm-cov/SourceCoverageView.cpp:172
@@ +171,3 @@
+    }
+  }
+
----------------
Can you move this logic into a private helper method, say: getFirstUncoveredLineNo(CoverageInfo);? Having it inline in print() makes it a bit hard to read. Also, you shouldn't need a line_iterator here. This could be:

```
const auto *MinSeg = std::min_element(CoverageInfo.begin(), CoverageInfo.end(),
  [](const coverage::CoverageSegment *L, const coverage::CoverageSegment *R) {
    // L is less than R if (1) it's an uncovered segment (has a 0 count), and
    // (2) either R is not an uncovered segment, or L has a lower line number than R
  });
if (MinSeg is really an uncovered segment)
  return the first uncovered line number;
llvm_unreachable(this file isn't supposed to be fully covered);
```

================
Comment at: tools/llvm-cov/SourceCoverageViewHTML.cpp:356
@@ -353,1 +355,3 @@
               escape("Binary: " + getOptions().ObjectFilename, getOptions()));
+    // Render the "Go to first unexecuted line" link for the view.
+    std::string LinkText = escape("Go to first unexecuted line", getOptions());
----------------
I think this should _only_ happen when `!FullyCovered`. Having inactive text that says "Go to ..." could be distracting.


https://reviews.llvm.org/D23277





More information about the llvm-commits mailing list