[cfe-dev] [llvm-dev] Ignoring coverage for noreturn decls

Vedant Kumar via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 28 20:31:48 PDT 2016


+ cfe-dev

> On Mar 28, 2016, at 1:23 PM, Harlan Haskins via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi all,
> 
> Recently I’ve noticed in coverage profiles that llvm_unreachable and the like are considered uncovered because there’s no special behavior in instrumentation to ‘ignore’ noreturn paths.

FWIW, Daniel Dunbar and a few others have brought up the lack of a flexible "suppress coverage" mechanism as a pain-point.

There are two separate but related solutions:

  - We should automatically emit zero mappings for code regions dominated by a call to a noreturn function.

  - We should offer some general way to 'turn off' coverage for arbitrary chunks of code.


> While I don’t necessarily think it’s ideal to ignore all noreturn decls, I think there’s definitely room for some heuristics around ignoring things like llvm_unreachable (perhaps opt-in?).

I think it's actually useful to have coverage for noreturn functions. Googletest lets you write death tests for this sort of thing.

Maybe it makes sense to emit zero regions at the _callsites_ of noreturn functions instead. Wdyt?


> I’m investigating emitting a zero region for all noreturn decls whilst codegenning, as a start.
> 
> Anyone have any input as to a) if this is a good idea, or b) how best to implement and expose it?

It might be interesting to try this and see if the coverage reports really are much nicer.

thanks
vedant


More information about the cfe-dev mailing list