LLVM 22.0.0git
CoverageMappingWriter.h
Go to the documentation of this file.
1//===- CoverageMappingWriter.h - Code coverage mapping writer ---*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains support for writing coverage mapping data for
10// instrumentation based coverage.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGWRITER_H
15#define LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGWRITER_H
16
17#include "llvm/ADT/ArrayRef.h"
18#include "llvm/ADT/StringRef.h"
21
22namespace llvm {
23
24class raw_ostream;
25
26namespace coverage {
27
28/// Writer of the filenames section for the instrumentation
29/// based code coverage.
31 ArrayRef<std::string> Filenames;
32
33public:
35
36 /// Write encoded filenames to the given output stream. If \p Compress is
37 /// true, attempt to compress the filenames.
38 LLVM_ABI void write(raw_ostream &OS, bool Compress = true);
39};
40
41/// Writer for instrumentation based coverage mapping data.
43 ArrayRef<unsigned> VirtualFileMapping;
46
47public:
51 : VirtualFileMapping(VirtualFileMapping), Expressions(Expressions),
52 MappingRegions(MappingRegions) {}
53
54 /// Write encoded coverage mapping data to the given output stream.
56};
57
58/// Writer for the coverage mapping testing format.
60 uint64_t ProfileNamesAddr;
61 StringRef ProfileNamesData;
62 StringRef CoverageMappingData;
63 StringRef CoverageRecordsData;
64
65public:
66 TestingFormatWriter(uint64_t ProfileNamesAddr, StringRef ProfileNamesData,
67 StringRef CoverageMappingData,
68 StringRef CoverageRecordsData)
69 : ProfileNamesAddr(ProfileNamesAddr), ProfileNamesData(ProfileNamesData),
70 CoverageMappingData(CoverageMappingData),
71 CoverageRecordsData(CoverageRecordsData) {}
72
73 /// Encode to the given output stream.
74 LLVM_ABI void
77};
78
79} // end namespace coverage
80
81} // end namespace llvm
82
83#endif // LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGWRITER_H
#define LLVM_ABI
Definition: Compiler.h:213
raw_pwrite_stream & OS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:303
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
Writer of the filenames section for the instrumentation based code coverage.
LLVM_ABI void write(raw_ostream &OS, bool Compress=true)
Write encoded filenames to the given output stream.
Writer for instrumentation based coverage mapping data.
CoverageMappingWriter(ArrayRef< unsigned > VirtualFileMapping, ArrayRef< CounterExpression > Expressions, MutableArrayRef< CounterMappingRegion > MappingRegions)
LLVM_ABI void write(raw_ostream &OS)
Write encoded coverage mapping data to the given output stream.
Writer for the coverage mapping testing format.
TestingFormatWriter(uint64_t ProfileNamesAddr, StringRef ProfileNamesData, StringRef CoverageMappingData, StringRef CoverageRecordsData)
LLVM_ABI void write(raw_ostream &OS, TestingFormatVersion Version=TestingFormatVersion::CurrentVersion)
Encode to the given output stream.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18