LLVM 22.0.0git
FDRRecordConsumer.h
Go to the documentation of this file.
1//===- FDRRecordConsumer.h - XRay Flight Data Recorder Mode Records -------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8#ifndef LLVM_XRAY_FDRRECORDCONSUMER_H
9#define LLVM_XRAY_FDRRECORDCONSUMER_H
10
12#include "llvm/Support/Error.h"
14#include <memory>
15#include <vector>
16
17namespace llvm::xray {
18
20public:
21 virtual Error consume(std::unique_ptr<Record> R) = 0;
22 virtual ~RecordConsumer() = default;
23};
24
25// This consumer will collect all the records into a vector of records, in
26// arrival order.
28 std::vector<std::unique_ptr<Record>> &Records;
29
30public:
31 explicit LogBuilderConsumer(std::vector<std::unique_ptr<Record>> &R)
32 : Records(R) {}
33
34 Error consume(std::unique_ptr<Record> R) override;
35};
36
37// A PipelineConsumer applies a set of visitors to every consumed Record, in the
38// order by which the visitors are added to the pipeline in the order of
39// appearance.
41 std::vector<RecordVisitor *> Visitors;
42
43public:
44 PipelineConsumer(std::initializer_list<RecordVisitor *> V) : Visitors(V) {}
45
46 Error consume(std::unique_ptr<Record> R) override;
47};
48
49} // namespace llvm::xray
50
51#endif // LLVM_XRAY_FDRRECORDCONSUMER_H
#define LLVM_ABI
Definition Compiler.h:213
static bool consume(InternalInstruction *insn, T &ptr)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
LogBuilderConsumer(std::vector< std::unique_ptr< Record > > &R)
PipelineConsumer(std::initializer_list< RecordVisitor * > V)
virtual Error consume(std::unique_ptr< Record > R)=0
virtual ~RecordConsumer()=default