diff options
author | Fabian Meumertzheim <fabian@meumertzhe.im> | 2025-06-13 21:09:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-13 12:09:58 -0700 |
commit | 83f215b0350289f3bd349c1f85826a58d8d80f03 (patch) | |
tree | f01fbc84a914c4590a7d6f64d3c056b86dcdfc9d /llvm/unittests/ProfileData/CoverageMappingTest.cpp | |
parent | 90d98a38b273f5d62424a3815447675860947927 (diff) | |
download | llvm-83f215b0350289f3bd349c1f85826a58d8d80f03.zip llvm-83f215b0350289f3bd349c1f85826a58d8d80f03.tar.gz llvm-83f215b0350289f3bd349c1f85826a58d8d80f03.tar.bz2 |
Reland "[llvm-cov] Add support for baseline coverage" (#144130)
When no profile is provided, but the new --empty-profile option is
specified, the export/report/show commands now emit coverage data
equivalent to that obtained from a profile with all zero counters
("baseline coverage").
This is useful for build systems (e.g. Bazel) that can track coverage
information for each build target, even those that are never linked into
tests and thus don't have runtime coverage data recorded. By merging in
baseline coverage, lines in files that aren't linked into tests are
correctly reported as uncovered.
Reland with fixes to `CoverageMappingTest.cpp`.
Reverts llvm/llvm-project#144121
Diffstat (limited to 'llvm/unittests/ProfileData/CoverageMappingTest.cpp')
-rw-r--r-- | llvm/unittests/ProfileData/CoverageMappingTest.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp index 46f881e..ec81e5f 100644 --- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp +++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp @@ -277,7 +277,9 @@ struct CoverageMappingTest : ::testing::TestWithParam<std::tuple<bool, bool>> { CoverageReaders.push_back( std::make_unique<CoverageMappingReaderMock>(Funcs)); } - return CoverageMapping::load(CoverageReaders, *ProfileReader); + auto ProfileReaderRef = std::make_optional( + std::reference_wrapper<IndexedInstrProfReader>(*ProfileReader)); + return CoverageMapping::load(CoverageReaders, ProfileReaderRef); } Error loadCoverageMapping(bool EmitFilenames = true) { |