Skip to content

llvm-cov: Calculate RegionCoverage based on CoverageData::Segments #121191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

chapuni
Copy link
Contributor

@chapuni chapuni commented Dec 27, 2024

Segments is more convenient for merging and shall be consistend to the visualization.

On the other hand, CountedRegion was consitent since it was based on Counter. But it had a few problems.

  • It didn't reflect visible regions since it could be split by other nested regions.
  • Split visible regions was not always mergable. Template instantiations would emit different length of regions due to folded condtions.

Depends on: #121189

Base automatically changed from users/chapuni/cov/merge/summaryinfo to main December 28, 2024 08:49
// Compute the region coverage.
size_t NumCodeRegions = 0, CoveredRegions = 0;
for (auto &CR : CodeRegions) {
if (CR.Kind != CounterMappingRegion::CodeRegion)
for (auto I = CD.begin(), E = CD.end(); I != E; ++I) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not possible to keep this as a range-based for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iterators (for protected:Segments) are provided by CoverageData. I think range is less suitable here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

llvm-cov show HTML: Inconsistent results between per-file indices and each source file view
2 participants