1 //===-- LibCxx.h ---------------------------------------------------*- C++
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
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
11 #define LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
13 #include "lldb/DataFormatters/TypeSummary.h"
14 #include "lldb/DataFormatters/TypeSynthetic.h"
15 #include "lldb/Utility/Stream.h"
16 #include "lldb/ValueObject/ValueObject.h"
18 namespace lldb_private
{
19 namespace formatters
{
21 /// Find a child member of \c obj_sp, trying all alternative names in order.
23 GetChildMemberWithName(ValueObject
&obj
,
24 llvm::ArrayRef
<ConstString
> alternative_names
);
26 lldb::ValueObjectSP
GetFirstValueOfLibCXXCompressedPair(ValueObject
&pair
);
27 lldb::ValueObjectSP
GetSecondValueOfLibCXXCompressedPair(ValueObject
&pair
);
28 bool isOldCompressedPairLayout(ValueObject
&pair_obj
);
29 bool isStdTemplate(ConstString type_name
, llvm::StringRef type
);
31 bool LibcxxStringSummaryProviderASCII(
32 ValueObject
&valobj
, Stream
&stream
,
33 const TypeSummaryOptions
&summary_options
); // libc++ std::string
35 bool LibcxxStringSummaryProviderUTF16(
36 ValueObject
&valobj
, Stream
&stream
,
37 const TypeSummaryOptions
&summary_options
); // libc++ std::u16string
39 bool LibcxxStringSummaryProviderUTF32(
40 ValueObject
&valobj
, Stream
&stream
,
41 const TypeSummaryOptions
&summary_options
); // libc++ std::u32string
43 bool LibcxxWStringSummaryProvider(
44 ValueObject
&valobj
, Stream
&stream
,
45 const TypeSummaryOptions
&options
); // libc++ std::wstring
47 bool LibcxxStringViewSummaryProviderASCII(
48 ValueObject
&valueObj
, Stream
&stream
,
49 const TypeSummaryOptions
&summary_options
); // libc++ std::string_view
51 bool LibcxxStringViewSummaryProviderUTF16(
52 ValueObject
&valobj
, Stream
&stream
,
53 const TypeSummaryOptions
&summary_options
); // libc++ std::u16string_view
55 bool LibcxxStringViewSummaryProviderUTF32(
56 ValueObject
&valobj
, Stream
&stream
,
57 const TypeSummaryOptions
&summary_options
); // libc++ std::u32string_view
59 bool LibcxxWStringViewSummaryProvider(
60 ValueObject
&valobj
, Stream
&stream
,
61 const TypeSummaryOptions
&options
); // libc++ std::wstring_view
63 bool LibcxxStdSliceArraySummaryProvider(
64 ValueObject
&valobj
, Stream
&stream
,
65 const TypeSummaryOptions
&options
); // libc++ std::slice_array
67 bool LibcxxSmartPointerSummaryProvider(
68 ValueObject
&valobj
, Stream
&stream
,
69 const TypeSummaryOptions
70 &options
); // libc++ std::shared_ptr<> and std::weak_ptr<>
72 // libc++ std::unique_ptr<>
73 bool LibcxxUniquePointerSummaryProvider(ValueObject
&valobj
, Stream
&stream
,
74 const TypeSummaryOptions
&options
);
76 bool LibcxxFunctionSummaryProvider(
77 ValueObject
&valobj
, Stream
&stream
,
78 const TypeSummaryOptions
&options
); // libc++ std::function<>
80 SyntheticChildrenFrontEnd
*
81 LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren
*,
84 bool LibcxxContainerSummaryProvider(ValueObject
&valobj
, Stream
&stream
,
85 const TypeSummaryOptions
&options
);
87 /// Formatter for libc++ std::span<>.
88 bool LibcxxSpanSummaryProvider(ValueObject
&valobj
, Stream
&stream
,
89 const TypeSummaryOptions
&options
);
91 SyntheticChildrenFrontEnd
*
92 LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren
*,
95 class LibcxxSharedPtrSyntheticFrontEnd
: public SyntheticChildrenFrontEnd
{
97 LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp
);
99 llvm::Expected
<uint32_t> CalculateNumChildren() override
;
101 lldb::ValueObjectSP
GetChildAtIndex(uint32_t idx
) override
;
103 lldb::ChildCacheState
Update() override
;
105 bool MightHaveChildren() override
;
107 size_t GetIndexOfChildWithName(ConstString name
) override
;
109 ~LibcxxSharedPtrSyntheticFrontEnd() override
;
112 ValueObject
*m_cntrl
;
115 class LibcxxUniquePtrSyntheticFrontEnd
: public SyntheticChildrenFrontEnd
{
117 LibcxxUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp
);
119 llvm::Expected
<uint32_t> CalculateNumChildren() override
;
121 lldb::ValueObjectSP
GetChildAtIndex(uint32_t idx
) override
;
123 lldb::ChildCacheState
Update() override
;
125 bool MightHaveChildren() override
;
127 size_t GetIndexOfChildWithName(ConstString name
) override
;
129 ~LibcxxUniquePtrSyntheticFrontEnd() override
;
132 lldb::ValueObjectSP m_value_ptr_sp
;
133 lldb::ValueObjectSP m_deleter_sp
;
136 SyntheticChildrenFrontEnd
*
137 LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren
*,
138 lldb::ValueObjectSP
);
140 SyntheticChildrenFrontEnd
*
141 LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren
*,
142 lldb::ValueObjectSP
);
144 SyntheticChildrenFrontEnd
*
145 LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren
*,
146 lldb::ValueObjectSP
);
148 SyntheticChildrenFrontEnd
*
149 LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren
*,
150 lldb::ValueObjectSP
);
152 SyntheticChildrenFrontEnd
*
153 LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren
*,
154 lldb::ValueObjectSP
);
156 SyntheticChildrenFrontEnd
*
157 LibcxxStdSliceArraySyntheticFrontEndCreator(CXXSyntheticChildren
*,
158 lldb::ValueObjectSP
);
160 SyntheticChildrenFrontEnd
*
161 LibcxxStdProxyArraySyntheticFrontEndCreator(CXXSyntheticChildren
*,
162 lldb::ValueObjectSP
);
164 SyntheticChildrenFrontEnd
*
165 LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren
*,
166 lldb::ValueObjectSP
);
168 SyntheticChildrenFrontEnd
*
169 LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren
*,
170 lldb::ValueObjectSP
);
172 SyntheticChildrenFrontEnd
*
173 LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren
*,
174 lldb::ValueObjectSP
);
176 SyntheticChildrenFrontEnd
*
177 LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren
*,
178 lldb::ValueObjectSP
);
180 SyntheticChildrenFrontEnd
*
181 LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren
*,
182 lldb::ValueObjectSP
);
184 SyntheticChildrenFrontEnd
*
185 LibCxxUnorderedMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren
*,
186 lldb::ValueObjectSP
);
188 SyntheticChildrenFrontEnd
*
189 LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren
*,
190 lldb::ValueObjectSP
);
192 SyntheticChildrenFrontEnd
*LibcxxQueueFrontEndCreator(CXXSyntheticChildren
*,
193 lldb::ValueObjectSP
);
195 SyntheticChildrenFrontEnd
*LibcxxTupleFrontEndCreator(CXXSyntheticChildren
*,
196 lldb::ValueObjectSP
);
198 SyntheticChildrenFrontEnd
*
199 LibcxxOptionalSyntheticFrontEndCreator(CXXSyntheticChildren
*,
200 lldb::ValueObjectSP valobj_sp
);
202 SyntheticChildrenFrontEnd
*
203 LibcxxVariantFrontEndCreator(CXXSyntheticChildren
*,
204 lldb::ValueObjectSP valobj_sp
);
206 SyntheticChildrenFrontEnd
*
207 LibcxxStdSpanSyntheticFrontEndCreator(CXXSyntheticChildren
*,
208 lldb::ValueObjectSP
);
210 SyntheticChildrenFrontEnd
*
211 LibcxxStdRangesRefViewSyntheticFrontEndCreator(CXXSyntheticChildren
*,
212 lldb::ValueObjectSP
);
214 bool LibcxxChronoSysSecondsSummaryProvider(
215 ValueObject
&valobj
, Stream
&stream
,
216 const TypeSummaryOptions
&options
); // libc++ std::chrono::sys_seconds
218 bool LibcxxChronoSysDaysSummaryProvider(
219 ValueObject
&valobj
, Stream
&stream
,
220 const TypeSummaryOptions
&options
); // libc++ std::chrono::sys_days
222 bool LibcxxChronoLocalSecondsSummaryProvider(
223 ValueObject
&valobj
, Stream
&stream
,
224 const TypeSummaryOptions
&options
); // libc++ std::chrono::local_seconds
226 bool LibcxxChronoLocalDaysSummaryProvider(
227 ValueObject
&valobj
, Stream
&stream
,
228 const TypeSummaryOptions
&options
); // libc++ std::chrono::local_days
230 bool LibcxxChronoMonthSummaryProvider(
231 ValueObject
&valobj
, Stream
&stream
,
232 const TypeSummaryOptions
&options
); // libc++ std::chrono::month
234 bool LibcxxChronoWeekdaySummaryProvider(
235 ValueObject
&valobj
, Stream
&stream
,
236 const TypeSummaryOptions
&options
); // libc++ std::chrono::weekday
238 bool LibcxxChronoYearMonthDaySummaryProvider(
239 ValueObject
&valobj
, Stream
&stream
,
240 const TypeSummaryOptions
&options
); // libc++ std::chrono::year_month_day
242 } // namespace formatters
243 } // namespace lldb_private
245 #endif // LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H