LLVM
22.0.0git
include
llvm
XRay
FDRLogBuilder.h
Go to the documentation of this file.
1
//===- FDRLogBuilder.h - XRay FDR Log Building Utility --------------------===//
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_FDRLOGBUILDER_H
9
#define LLVM_XRAY_FDRLOGBUILDER_H
10
11
#include "
llvm/XRay/FDRRecords.h
"
12
13
namespace
llvm::xray
{
14
15
/// The LogBuilder class allows for creating ad-hoc collections of records
16
/// through the `add<...>(...)` function. An example use of this API is in
17
/// crafting arbitrary sequences of records:
18
///
19
/// auto Records = LogBuilder()
20
/// .add<BufferExtents>(256)
21
/// .add<NewBufferRecord>(1)
22
/// .consume();
23
///
24
class
LogBuilder
{
25
std::vector<std::unique_ptr<Record>> Records;
26
27
public
:
28
template
<
class
R,
class
...
T
>
LogBuilder
&
add
(
T
&&...
A
) {
29
Records.emplace_back(
new
R(std::forward<T>(
A
)...));
30
return
*
this
;
31
}
32
33
std::vector<std::unique_ptr<Record>>
consume
() {
return
std::move(Records); }
34
};
35
36
}
// namespace llvm::xray
37
38
#endif
// LLVM_XRAY_FDRLOGBUILDER_H
A
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
FDRRecords.h
T
#define T
Definition
Mips16ISelLowering.cpp:353
llvm::xray::LogBuilder
The LogBuilder class allows for creating ad-hoc collections of records through the add<....
Definition
FDRLogBuilder.h:24
llvm::xray::LogBuilder::add
LogBuilder & add(T &&... A)
Definition
FDRLogBuilder.h:28
llvm::xray::LogBuilder::consume
std::vector< std::unique_ptr< Record > > consume()
Definition
FDRLogBuilder.h:33
llvm::xray
Definition
BlockIndexer.h:22
Generated on
for LLVM by
1.14.0