1 //=-- CoverageMappingWriter.h - Code coverage mapping writer ------*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains support for writing coverage mapping data for
11 // instrumentation based coverage.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_PROFILEDATA_COVERAGEMAPPINGWRITER_H
16 #define LLVM_PROFILEDATA_COVERAGEMAPPINGWRITER_H
18 #include "llvm/ProfileData/CoverageMapping.h"
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/Support/raw_ostream.h"
26 /// \brief Writer of the filenames section for the instrumentation
27 /// based code coverage.
28 class CoverageFilenamesSectionWriter {
29 ArrayRef<StringRef> Filenames;
32 CoverageFilenamesSectionWriter(ArrayRef<StringRef> Filenames)
33 : Filenames(Filenames) {}
35 /// \brief Write encoded filenames to the given output stream.
36 void write(raw_ostream &OS);
39 /// \brief 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 CoverageMappingWriter(ArrayRef<CounterExpression> Expressions,
53 MutableArrayRef<CounterMappingRegion> MappingRegions)
54 : Expressions(Expressions), MappingRegions(MappingRegions) {}
56 /// \brief Write encoded coverage mapping data to the given output stream.
57 void write(raw_ostream &OS);
60 } // end namespace coverage
61 } // end namespace llvm