[PATCH] D144371: [LLVM-COV] Fix an issue: a statement after calling 'assert()' function is wrongly marked as 'not executed'

Ying Yi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 20 02:32:24 PST 2023


MaggieYi created this revision.
MaggieYi added reviewers: vsk, zequanwu.
MaggieYi added a project: clang.
Herald added a project: All.
MaggieYi requested review of this revision.
Herald added a subscriber: cfe-commits.

In the current coverage mapping implementation, we terminate the current region and start a zero region when we hit a nonreturn function. However, for logical OR, the second operand is not executed if the first operand evaluates to true. If the nonreturn function is called in the right side of logical OR and the left side of logical OR is TRUE, we should not start a zero `GapRegionCounter`. This will also apply to `VisitAbstractConditionalOperator`.

The following issues are fixed by this patch:

1. https://github.com/llvm/llvm-project/issues/59030
2. https://github.com/llvm/llvm-project/issues/57388
3. https://github.com/llvm/llvm-project/issues/57481
4. https://github.com/llvm/llvm-project/issues/60701


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144371

Files:
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/test/CoverageMapping/terminate-statements.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144371.498770.patch
Type: text/x-patch
Size: 3609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230220/f6bd5ff6/attachment.bin>


More information about the cfe-commits mailing list