LLVM  8.0.1
FDRRecordConsumer.h
Go to the documentation of this file.
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 
22 public:
23  virtual Error consume(std::unique_ptr<Record> R) = 0;
24  virtual ~RecordConsumer() = default;
25 };
26 
27 // This consumer will collect all the records into a vector of records, in
28 // arrival order.
30  std::vector<std::unique_ptr<Record>> &Records;
31 
32 public:
33  explicit LogBuilderConsumer(std::vector<std::unique_ptr<Record>> &R)
34  : 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.
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_
This class represents lattice values for constants.
Definition: AllocatorList.h:24
LogBuilderConsumer(std::vector< std::unique_ptr< Record >> &R)
virtual Error consume(std::unique_ptr< Record > R)=0
PipelineConsumer(std::initializer_list< RecordVisitor *> V)
virtual ~RecordConsumer()=default
Lightweight error class with error context and mandatory checking.
Definition: Error.h:158