[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / source / API / SBReproducerPrivate.h
blobedd06941398f64f5f37a90eece43ad0fe5b187f1
1 //===-- SBReproducerPrivate.h -----------------------------------*- C++ -*-===//
2 //
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_API_SBREPRODUCER_PRIVATE_H
11 #define LLDB_API_SBREPRODUCER_PRIVATE_H
13 #include "lldb/API/SBReproducer.h"
15 #include "lldb/Utility/FileSpec.h"
16 #include "lldb/Utility/Log.h"
17 #include "lldb/Utility/Reproducer.h"
18 #include "lldb/Utility/ReproducerInstrumentation.h"
20 #include "llvm/ADT/DenseMap.h"
22 #define LLDB_GET_INSTRUMENTATION_DATA() \
23 lldb_private::repro::GetInstrumentationData()
25 namespace lldb_private {
26 namespace repro {
28 class SBRegistry : public Registry {
29 public:
30 SBRegistry();
33 class SBProvider : public Provider<SBProvider> {
34 public:
35 struct Info {
36 static const char *name;
37 static const char *file;
40 SBProvider(const FileSpec &directory)
41 : Provider(directory),
42 m_stream(directory.CopyByAppendingPathComponent("sbapi.bin").GetPath(),
43 m_ec, llvm::sys::fs::OpenFlags::OF_None),
44 m_serializer(m_stream) {}
46 Serializer &GetSerializer() { return m_serializer; }
47 Registry &GetRegistry() { return m_registry; }
49 static char ID;
51 private:
52 std::error_code m_ec;
53 llvm::raw_fd_ostream m_stream;
54 Serializer m_serializer;
55 SBRegistry m_registry;
58 inline InstrumentationData GetInstrumentationData() {
59 if (!lldb_private::repro::Reproducer::Initialized())
60 return {};
62 if (auto *g = lldb_private::repro::Reproducer::Instance().GetGenerator()) {
63 auto &p = g->GetOrCreate<SBProvider>();
64 return {p.GetSerializer(), p.GetRegistry()};
67 return {};
70 template <typename T> void RegisterMethods(Registry &R);
72 } // namespace repro
73 } // namespace lldb_private
75 #endif