[PATCH] D95987: [llvm-cov] Reset ExecutionCount only if first line segment is start of a new region.

Pirama Arumuga Nainar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 11:25:09 PST 2021


pirama added a comment.

In D95987#2543866 <https://reviews.llvm.org/D95987#2543866>, @zequanwu wrote:

>> For the example you provided, I am not sure if it's a bug or not. `Segment at 3:45 (count = 0), RegionEntry` corresponds to the error path of the `?` operator, which means error path is not executed. So, the 0 count looks reasonable. If we mark line 3 as executed regardless of which path is chosen, we may lost the information of path choices.
>
> I just realized that this also applies to C++ `?` operator. In the following case, if we always mark line 5 as executed, we don't know which branch is chosen (But when generating html report by llvm-cov, we will see that the not executed branch is marked with red color).

I agree and think this patch may be unnecessary.  The region coverage information in the html reports are accurate than line coverage and we have to use some heuristics here when computing line coverage.

>   1|       |#include <stdlib.h>
>   2|       |
>   3|      1|int main() {
>   4|      1|  return getenv(
>   5|      0|      "TEST") ? 1
>   6|      1|              : 0;
>   7|      1|}




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95987/new/

https://reviews.llvm.org/D95987



More information about the llvm-commits mailing list