1 //===- CoverageMappingWriter.h - Code coverage mapping writer ---*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file contains support for writing coverage mapping data for
10 // instrumentation based coverage.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGWRITER_H
15 #define LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGWRITER_H
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/ProfileData/Coverage/CoverageMapping.h"
27 /// Writer of the filenames section for the instrumentation
28 /// based code coverage.
29 class CoverageFilenamesSectionWriter
{
30 ArrayRef
<StringRef
> Filenames
;
33 CoverageFilenamesSectionWriter(ArrayRef
<StringRef
> Filenames
);
35 /// Write encoded filenames to the given output stream.
36 void write(raw_ostream
&OS
);
39 /// Writer for instrumentation based coverage mapping data.
40 class CoverageMappingWriter
{
41 ArrayRef
<unsigned> VirtualFileMapping
;
42 ArrayRef
<CounterExpression
> Expressions
;
43 MutableArrayRef
<CounterMappingRegion
> MappingRegions
;
46 CoverageMappingWriter(ArrayRef
<unsigned> VirtualFileMapping
,
47 ArrayRef
<CounterExpression
> Expressions
,
48 MutableArrayRef
<CounterMappingRegion
> MappingRegions
)
49 : VirtualFileMapping(VirtualFileMapping
), Expressions(Expressions
),
50 MappingRegions(MappingRegions
) {}
52 /// Write encoded coverage mapping data to the given output stream.
53 void write(raw_ostream
&OS
);
56 } // end namespace coverage
58 } // end namespace llvm
60 #endif // LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGWRITER_H