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

Zequan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 17:44:35 PST 2021


zequanwu added a comment.

> 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).

  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