On Monday, 4 December 2017 at 20:33:56 UTC, thinwybk wrote:
Hi everyone,

as far as I know there is a statement coverage analyzer built into DMD https://dlang.org/code_coverage.html . Are there code coverage analyzers for D which support branch coverage and other more advanced coverage metrics https://en.wikipedia.org/wiki/Code_coverage ?

LDC's PGO output can be used for that. See [1]. Except that LDC does not yet output full source mappings for the counters (`-fcoverage-mapping`). Because the DMD frontend rewrites code besides semantic analysis, it is problematic to create correct source mappings, and I have thusfar refrained from implementing that. (For folks interested in contributing to LDC: it'd be a nice project to work on, with nice incremental steps. It's quite possible that there is already enough info in the IR for IR-based (instead of current PGO instrumentation) instrumentation/mapping to work well)

-Johan

[1] https://clang.llvm.org/docs/SourceBasedCodeCoverage.html

Reply via email to