[all-commits] [llvm/llvm-project] 94dd47: [Coverage] Fix an issue: a statement after calling...

MaggieYingYi via All-commits all-commits at lists.llvm.org
Thu Mar 2 01:16:04 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 94dd4766a61bb18b263415e17e745dc2fa609162
      https://github.com/llvm/llvm-project/commit/94dd4766a61bb18b263415e17e745dc2fa609162
  Author: Ying Yi <maggieyi666 at gmail.com>
  Date:   2023-03-02 (Thu, 02 Mar 2023)

  Changed paths:
    M clang/lib/CodeGen/CoverageMappingGen.cpp
    M clang/test/CoverageMapping/terminate-statements.cpp

  Log Message:
  -----------
  [Coverage] Fix an issue: a statement after calling 'assert()' function is wrongly
marked as 'not executed'.

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

Fixes https://github.com/llvm/llvm-project/issues/59030

Reviewed By: zequanwu

Differential Revision: https://reviews.llvm.org/D144371




More information about the All-commits mailing list