LLVM API Documentation

CoverageMappingWriter.h
Go to the documentation of this file.
00001 //=-- CoverageMappingWriter.h - Code coverage mapping writer ------*- C++ -*-=//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains support for writing coverage mapping data for
00011 // instrumentation based coverage.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_PROFILEDATA_COVERAGEMAPPINGWRITER_H
00016 #define LLVM_PROFILEDATA_COVERAGEMAPPINGWRITER_H
00017 
00018 #include "llvm/ProfileData/CoverageMapping.h"
00019 #include "llvm/ADT/ArrayRef.h"
00020 #include "llvm/ADT/StringMap.h"
00021 #include "llvm/Support/raw_ostream.h"
00022 
00023 namespace llvm {
00024 namespace coverage {
00025 
00026 /// \brief Writer of the filenames section for the instrumentation
00027 /// based code coverage.
00028 class CoverageFilenamesSectionWriter {
00029   ArrayRef<StringRef> Filenames;
00030 
00031 public:
00032   CoverageFilenamesSectionWriter(ArrayRef<StringRef> Filenames)
00033       : Filenames(Filenames) {}
00034 
00035   /// \brief Write encoded filenames to the given output stream.
00036   void write(raw_ostream &OS);
00037 };
00038 
00039 /// \brief Writer for instrumentation based coverage mapping data.
00040 class CoverageMappingWriter {
00041   ArrayRef<unsigned> VirtualFileMapping;
00042   ArrayRef<CounterExpression> Expressions;
00043   MutableArrayRef<CounterMappingRegion> MappingRegions;
00044 
00045 public:
00046   CoverageMappingWriter(ArrayRef<unsigned> VirtualFileMapping,
00047                         ArrayRef<CounterExpression> Expressions,
00048                         MutableArrayRef<CounterMappingRegion> MappingRegions)
00049       : VirtualFileMapping(VirtualFileMapping), Expressions(Expressions),
00050         MappingRegions(MappingRegions) {}
00051 
00052   CoverageMappingWriter(ArrayRef<CounterExpression> Expressions,
00053                         MutableArrayRef<CounterMappingRegion> MappingRegions)
00054       : Expressions(Expressions), MappingRegions(MappingRegions) {}
00055 
00056   /// \brief Write encoded coverage mapping data to the given output stream.
00057   void write(raw_ostream &OS);
00058 };
00059 
00060 } // end namespace coverage
00061 } // end namespace llvm
00062 
00063 #endif