|
|
|||
File indexing completed on 2026-05-10 08:44:45
0001 //===- FDRLogBuilder.h - XRay FDR Log Building Utility --------------------===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 #ifndef LLVM_XRAY_FDRLOGBUILDER_H 0009 #define LLVM_XRAY_FDRLOGBUILDER_H 0010 0011 #include "llvm/XRay/FDRRecords.h" 0012 0013 namespace llvm { 0014 namespace xray { 0015 0016 /// The LogBuilder class allows for creating ad-hoc collections of records 0017 /// through the `add<...>(...)` function. An example use of this API is in 0018 /// crafting arbitrary sequences of records: 0019 /// 0020 /// auto Records = LogBuilder() 0021 /// .add<BufferExtents>(256) 0022 /// .add<NewBufferRecord>(1) 0023 /// .consume(); 0024 /// 0025 class LogBuilder { 0026 std::vector<std::unique_ptr<Record>> Records; 0027 0028 public: 0029 template <class R, class... T> LogBuilder &add(T &&... A) { 0030 Records.emplace_back(new R(std::forward<T>(A)...)); 0031 return *this; 0032 } 0033 0034 std::vector<std::unique_ptr<Record>> consume() { return std::move(Records); } 0035 }; 0036 0037 } // namespace xray 0038 } // namespace llvm 0039 0040 #endif // LLVM_XRAY_FDRLOGBUILDER_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|