LCOV - code coverage report
Current view: top level - include/llvm/XRay - FDRRecordConsumer.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 2 3 66.7 %
Date: 2018-10-20 13:21:21 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- FDRRecordConsumer.h - XRay Flight Data Recorder Mode Records -------===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : #ifndef LLVM_INCLUDE_LLVM_XRAY_FDRRECORDCONSUMER_H_
      10             : #define LLVM_INCLUDE_LLVM_XRAY_FDRRECORDCONSUMER_H_
      11             : 
      12             : #include "llvm/Support/Error.h"
      13             : #include "llvm/XRay/FDRRecords.h"
      14             : #include <algorithm>
      15             : #include <memory>
      16             : #include <vector>
      17             : 
      18             : namespace llvm {
      19             : namespace xray {
      20             : 
      21             : class RecordConsumer {
      22             : public:
      23             :   virtual Error consume(std::unique_ptr<Record> R) = 0;
      24           0 :   virtual ~RecordConsumer() = default;
      25             : };
      26             : 
      27             : // This consumer will collect all the records into a vector of records, in
      28             : // arrival order.
      29          10 : class LogBuilderConsumer : public RecordConsumer {
      30             :   std::vector<std::unique_ptr<Record>> &Records;
      31             : 
      32             : public:
      33             :   explicit LogBuilderConsumer(std::vector<std::unique_ptr<Record>> &R)
      34          17 :       : RecordConsumer(), Records(R) {}
      35             : 
      36             :   Error consume(std::unique_ptr<Record> R) override;
      37             : };
      38             : 
      39             : // A PipelineConsumer applies a set of visitors to every consumed Record, in the
      40             : // order by which the visitors are added to the pipeline in the order of
      41             : // appearance.
      42             : class PipelineConsumer : public RecordConsumer {
      43             :   std::vector<RecordVisitor *> Visitors;
      44             : 
      45             : public:
      46             :   PipelineConsumer(std::initializer_list<RecordVisitor *> V)
      47             :       : RecordConsumer(), Visitors(V) {}
      48             : 
      49             :   Error consume(std::unique_ptr<Record> R) override;
      50             : };
      51             : 
      52             : } // namespace xray
      53             : } // namespace llvm
      54             : 
      55             : #endif // LLVM_INCLUDE_LLVM_XRAY_FDRRECORDCONSUMER_H_

Generated by: LCOV version 1.13