1 //===- FDRRecordConsumer.h - XRay Flight Data Recorder Mode Records -------===//
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_INCLUDE_LLVM_XRAY_FDRRECORDCONSUMER_H_
10 #define LLVM_INCLUDE_LLVM_XRAY_FDRRECORDCONSUMER_H_
12 #include "llvm/Support/Error.h"
13 #include "llvm/XRay/FDRRecords.h"
21 class RecordConsumer {
23 virtual Error consume(std::unique_ptr<Record> R) = 0;
24 virtual ~RecordConsumer() = default;
27 // This consumer will collect all the records into a vector of records, in
29 class LogBuilderConsumer : public RecordConsumer {
30 std::vector<std::unique_ptr<Record>> &Records;
33 explicit LogBuilderConsumer(std::vector<std::unique_ptr<Record>> &R)
34 : RecordConsumer(), Records(R) {}
36 Error consume(std::unique_ptr<Record> R) override;
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
42 class PipelineConsumer : public RecordConsumer {
43 std::vector<RecordVisitor *> Visitors;
46 PipelineConsumer(std::initializer_list<RecordVisitor *> V)
47 : RecordConsumer(), Visitors(V) {}
49 Error consume(std::unique_ptr<Record> R) override;
55 #endif // LLVM_INCLUDE_LLVM_XRAY_FDRRECORDCONSUMER_H_