Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
SourceBasedCodeCoverage.rst 6.44 KiB

Source-based Code Coverage

Introduction

This document explains how to use clang's source-based code coverage feature. It's called "source-based" because it operates on AST and preprocessor information directly. This allows it to generate very precise coverage data.

Clang ships two other code coverage implementations:

  • :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the various sanitizers. It can provide up to edge-level coverage.
  • gcov - A GCC-compatible coverage implementation which operates on DebugInfo.

From this point onwards "code coverage" will refer to the source-based kind.

The code coverage workflow