[llvm-cov] Improve line count for wrapped segments #143910
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adjust line coverage calculation to report the count of the wrapped
segment only if there are no regions starting on that line.
This resolves the nested macro scenario reported in #140893. Because
the inner macro creates a new region, the counter for the outer macro
is not considered.
As it stands the diff passes all existing tests, but the modifications
required indicate a broad reporting impact. I suspect when most users
absorbed this change their coverage numbers would decrease, though I
believe those numbers would be more accurate.
This is a significant change in reporting. I am not certain it is the
right approach, and thus I am posting it as a draft for consideration.
More testing is likely required to iron out other inconsistencies that
may be accidentally introduced. It's possible there are other, more
desirable approaches to resolve #140893 (and other similar issues noted
in that bug).
Fixes #140893