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

source code of lldb/source/Plugins/Language/CPlusPlus/LibCxx.h