[all-commits] [llvm/llvm-project] 565e37: [Coroutines] Fix code coverage for coroutine

Xun Li via All-commits all-commits at lists.llvm.org
Wed Jul 1 10:11:59 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 565e37c7702d181804c12d36b6010c513c9b3417
      https://github.com/llvm/llvm-project/commit/565e37c7702d181804c12d36b6010c513c9b3417
  Author: Xun Li <xun at fb.com>
  Date:   2020-07-01 (Wed, 01 Jul 2020)

  Changed paths:
    M clang/lib/CodeGen/CoverageMappingGen.cpp
    A clang/test/CoverageMapping/coroutine.cpp

  Log Message:
  -----------
  [Coroutines] Fix code coverage for coroutine

Summary:
Previously, source-based coverage analysis does not work properly for coroutine.
This patch adds processing of coroutine body and co_return in the coverage analysis, so that we can handle them properly.
For coroutine body, we should only look at the actual function body and ignore the compiler-generated things; for co_return, we need to terminate the region similar to return statement.
Added a test, and confirms that it now works properly. (without this patch, the statement after the if statement will be treated wrongly)

Reviewers: lewissbaker, modocache, junparser

Reviewed By: modocache

Subscribers: cfe-commits

Tags: #clang

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




More information about the All-commits mailing list