Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
39644 views
1
//===-- LibCxx.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
//===----------------------------------------------------------------------===//
9
10
#ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
11
#define LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
12
13
#include "lldb/Core/ValueObject.h"
14
#include "lldb/DataFormatters/TypeSummary.h"
15
#include "lldb/DataFormatters/TypeSynthetic.h"
16
#include "lldb/Utility/Stream.h"
17
18
namespace lldb_private {
19
namespace formatters {
20
21
/// Find a child member of \c obj_sp, trying all alternative names in order.
22
lldb::ValueObjectSP
23
GetChildMemberWithName(ValueObject &obj,
24
llvm::ArrayRef<ConstString> alternative_names);
25
26
lldb::ValueObjectSP GetFirstValueOfLibCXXCompressedPair(ValueObject &pair);
27
lldb::ValueObjectSP GetSecondValueOfLibCXXCompressedPair(ValueObject &pair);
28
29
30
bool LibcxxStringSummaryProviderASCII(
31
ValueObject &valobj, Stream &stream,
32
const TypeSummaryOptions &summary_options); // libc++ std::string
33
34
bool LibcxxStringSummaryProviderUTF16(
35
ValueObject &valobj, Stream &stream,
36
const TypeSummaryOptions &summary_options); // libc++ std::u16string
37
38
bool LibcxxStringSummaryProviderUTF32(
39
ValueObject &valobj, Stream &stream,
40
const TypeSummaryOptions &summary_options); // libc++ std::u32string
41
42
bool LibcxxWStringSummaryProvider(
43
ValueObject &valobj, Stream &stream,
44
const TypeSummaryOptions &options); // libc++ std::wstring
45
46
bool LibcxxStringViewSummaryProviderASCII(
47
ValueObject &valueObj, Stream &stream,
48
const TypeSummaryOptions &summary_options); // libc++ std::string_view
49
50
bool LibcxxStringViewSummaryProviderUTF16(
51
ValueObject &valobj, Stream &stream,
52
const TypeSummaryOptions &summary_options); // libc++ std::u16string_view
53
54
bool LibcxxStringViewSummaryProviderUTF32(
55
ValueObject &valobj, Stream &stream,
56
const TypeSummaryOptions &summary_options); // libc++ std::u32string_view
57
58
bool LibcxxWStringViewSummaryProvider(
59
ValueObject &valobj, Stream &stream,
60
const TypeSummaryOptions &options); // libc++ std::wstring_view
61
62
bool LibcxxStdSliceArraySummaryProvider(
63
ValueObject &valobj, Stream &stream,
64
const TypeSummaryOptions &options); // libc++ std::slice_array
65
66
bool LibcxxSmartPointerSummaryProvider(
67
ValueObject &valobj, Stream &stream,
68
const TypeSummaryOptions
69
&options); // libc++ std::shared_ptr<> and std::weak_ptr<>
70
71
// libc++ std::unique_ptr<>
72
bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream,
73
const TypeSummaryOptions &options);
74
75
bool LibcxxFunctionSummaryProvider(
76
ValueObject &valobj, Stream &stream,
77
const TypeSummaryOptions &options); // libc++ std::function<>
78
79
SyntheticChildrenFrontEnd *
80
LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *,
81
lldb::ValueObjectSP);
82
83
bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream,
84
const TypeSummaryOptions &options);
85
86
/// Formatter for libc++ std::span<>.
87
bool LibcxxSpanSummaryProvider(ValueObject &valobj, Stream &stream,
88
const TypeSummaryOptions &options);
89
90
SyntheticChildrenFrontEnd *
91
LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
92
lldb::ValueObjectSP);
93
94
class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
95
public:
96
LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
97
98
llvm::Expected<uint32_t> CalculateNumChildren() override;
99
100
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
101
102
lldb::ChildCacheState Update() override;
103
104
bool MightHaveChildren() override;
105
106
size_t GetIndexOfChildWithName(ConstString name) override;
107
108
~LibcxxSharedPtrSyntheticFrontEnd() override;
109
110
private:
111
ValueObject *m_cntrl;
112
};
113
114
class LibcxxUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
115
public:
116
LibcxxUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
117
118
llvm::Expected<uint32_t> CalculateNumChildren() override;
119
120
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
121
122
lldb::ChildCacheState Update() override;
123
124
bool MightHaveChildren() override;
125
126
size_t GetIndexOfChildWithName(ConstString name) override;
127
128
~LibcxxUniquePtrSyntheticFrontEnd() override;
129
130
private:
131
lldb::ValueObjectSP m_value_ptr_sp;
132
lldb::ValueObjectSP m_deleter_sp;
133
};
134
135
SyntheticChildrenFrontEnd *
136
LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *,
137
lldb::ValueObjectSP);
138
139
SyntheticChildrenFrontEnd *
140
LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
141
lldb::ValueObjectSP);
142
143
SyntheticChildrenFrontEnd *
144
LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
145
lldb::ValueObjectSP);
146
147
SyntheticChildrenFrontEnd *
148
LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *,
149
lldb::ValueObjectSP);
150
151
SyntheticChildrenFrontEnd *
152
LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren *,
153
lldb::ValueObjectSP);
154
155
SyntheticChildrenFrontEnd *
156
LibcxxStdSliceArraySyntheticFrontEndCreator(CXXSyntheticChildren *,
157
lldb::ValueObjectSP);
158
159
SyntheticChildrenFrontEnd *
160
LibcxxStdProxyArraySyntheticFrontEndCreator(CXXSyntheticChildren *,
161
lldb::ValueObjectSP);
162
163
SyntheticChildrenFrontEnd *
164
LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *,
165
lldb::ValueObjectSP);
166
167
SyntheticChildrenFrontEnd *
168
LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *,
169
lldb::ValueObjectSP);
170
171
SyntheticChildrenFrontEnd *
172
LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
173
lldb::ValueObjectSP);
174
175
SyntheticChildrenFrontEnd *
176
LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
177
lldb::ValueObjectSP);
178
179
SyntheticChildrenFrontEnd *
180
LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
181
lldb::ValueObjectSP);
182
183
SyntheticChildrenFrontEnd *
184
LibCxxUnorderedMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
185
lldb::ValueObjectSP);
186
187
SyntheticChildrenFrontEnd *
188
LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *,
189
lldb::ValueObjectSP);
190
191
SyntheticChildrenFrontEnd *LibcxxQueueFrontEndCreator(CXXSyntheticChildren *,
192
lldb::ValueObjectSP);
193
194
SyntheticChildrenFrontEnd *LibcxxTupleFrontEndCreator(CXXSyntheticChildren *,
195
lldb::ValueObjectSP);
196
197
SyntheticChildrenFrontEnd *
198
LibcxxOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *,
199
lldb::ValueObjectSP valobj_sp);
200
201
SyntheticChildrenFrontEnd *
202
LibcxxVariantFrontEndCreator(CXXSyntheticChildren *,
203
lldb::ValueObjectSP valobj_sp);
204
205
SyntheticChildrenFrontEnd *
206
LibcxxStdSpanSyntheticFrontEndCreator(CXXSyntheticChildren *,
207
lldb::ValueObjectSP);
208
209
SyntheticChildrenFrontEnd *
210
LibcxxStdRangesRefViewSyntheticFrontEndCreator(CXXSyntheticChildren *,
211
lldb::ValueObjectSP);
212
213
bool LibcxxChronoSysSecondsSummaryProvider(
214
ValueObject &valobj, Stream &stream,
215
const TypeSummaryOptions &options); // libc++ std::chrono::sys_seconds
216
217
bool LibcxxChronoSysDaysSummaryProvider(
218
ValueObject &valobj, Stream &stream,
219
const TypeSummaryOptions &options); // libc++ std::chrono::sys_days
220
221
bool LibcxxChronoLocalSecondsSummaryProvider(
222
ValueObject &valobj, Stream &stream,
223
const TypeSummaryOptions &options); // libc++ std::chrono::local_seconds
224
225
bool LibcxxChronoLocalDaysSummaryProvider(
226
ValueObject &valobj, Stream &stream,
227
const TypeSummaryOptions &options); // libc++ std::chrono::local_days
228
229
bool LibcxxChronoMonthSummaryProvider(
230
ValueObject &valobj, Stream &stream,
231
const TypeSummaryOptions &options); // libc++ std::chrono::month
232
233
bool LibcxxChronoWeekdaySummaryProvider(
234
ValueObject &valobj, Stream &stream,
235
const TypeSummaryOptions &options); // libc++ std::chrono::weekday
236
237
bool LibcxxChronoYearMonthDaySummaryProvider(
238
ValueObject &valobj, Stream &stream,
239
const TypeSummaryOptions &options); // libc++ std::chrono::year_month_day
240
241
} // namespace formatters
242
} // namespace lldb_private
243
244
#endif // LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
245
246