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 | |
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 | bool isOldCompressedPairLayout(ValueObject &pair_obj); |
29 | bool isStdTemplate(ConstString type_name, llvm::StringRef type); |
30 | |
31 | bool LibcxxStringSummaryProviderASCII( |
32 | ValueObject &valobj, Stream &stream, |
33 | const TypeSummaryOptions &summary_options); // libc++ std::string |
34 | |
35 | bool LibcxxStringSummaryProviderUTF16( |
36 | ValueObject &valobj, Stream &stream, |
37 | const TypeSummaryOptions &summary_options); // libc++ std::u16string |
38 | |
39 | bool LibcxxStringSummaryProviderUTF32( |
40 | ValueObject &valobj, Stream &stream, |
41 | const TypeSummaryOptions &summary_options); // libc++ std::u32string |
42 | |
43 | bool LibcxxWStringSummaryProvider( |
44 | ValueObject &valobj, Stream &stream, |
45 | const TypeSummaryOptions &options); // libc++ std::wstring |
46 | |
47 | bool LibcxxStringViewSummaryProviderASCII( |
48 | ValueObject &valueObj, Stream &stream, |
49 | const TypeSummaryOptions &summary_options); // libc++ std::string_view |
50 | |
51 | bool LibcxxStringViewSummaryProviderUTF16( |
52 | ValueObject &valobj, Stream &stream, |
53 | const TypeSummaryOptions &summary_options); // libc++ std::u16string_view |
54 | |
55 | bool LibcxxStringViewSummaryProviderUTF32( |
56 | ValueObject &valobj, Stream &stream, |
57 | const TypeSummaryOptions &summary_options); // libc++ std::u32string_view |
58 | |
59 | bool LibcxxWStringViewSummaryProvider( |
60 | ValueObject &valobj, Stream &stream, |
61 | const TypeSummaryOptions &options); // libc++ std::wstring_view |
62 | |
63 | bool LibcxxStdSliceArraySummaryProvider( |
64 | ValueObject &valobj, Stream &stream, |
65 | const TypeSummaryOptions &options); // libc++ std::slice_array |
66 | |
67 | bool 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<> |
73 | bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream, |
74 | const TypeSummaryOptions &options); |
75 | |
76 | bool LibcxxFunctionSummaryProvider( |
77 | ValueObject &valobj, Stream &stream, |
78 | const TypeSummaryOptions &options); // libc++ std::function<> |
79 | |
80 | SyntheticChildrenFrontEnd * |
81 | LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *, |
82 | lldb::ValueObjectSP); |
83 | |
84 | bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream, |
85 | const TypeSummaryOptions &options); |
86 | |
87 | /// Formatter for libc++ std::span<>. |
88 | bool LibcxxSpanSummaryProvider(ValueObject &valobj, Stream &stream, |
89 | const TypeSummaryOptions &options); |
90 | |
91 | SyntheticChildrenFrontEnd * |
92 | LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
93 | lldb::ValueObjectSP); |
94 | |
95 | class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd { |
96 | public: |
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 | |
109 | private: |
110 | ValueObject *m_cntrl; |
111 | }; |
112 | |
113 | class LibcxxUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd { |
114 | public: |
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 | |
127 | private: |
128 | lldb::ValueObjectSP m_value_ptr_sp; |
129 | lldb::ValueObjectSP m_deleter_sp; |
130 | }; |
131 | |
132 | SyntheticChildrenFrontEnd * |
133 | LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *, |
134 | lldb::ValueObjectSP); |
135 | |
136 | SyntheticChildrenFrontEnd * |
137 | LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, |
138 | lldb::ValueObjectSP); |
139 | |
140 | SyntheticChildrenFrontEnd * |
141 | LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *, |
142 | lldb::ValueObjectSP); |
143 | |
144 | SyntheticChildrenFrontEnd * |
145 | LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
146 | lldb::ValueObjectSP); |
147 | |
148 | SyntheticChildrenFrontEnd * |
149 | LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren *, |
150 | lldb::ValueObjectSP); |
151 | |
152 | SyntheticChildrenFrontEnd * |
153 | LibcxxStdSliceArraySyntheticFrontEndCreator(CXXSyntheticChildren *, |
154 | lldb::ValueObjectSP); |
155 | |
156 | SyntheticChildrenFrontEnd * |
157 | LibcxxStdProxyArraySyntheticFrontEndCreator(CXXSyntheticChildren *, |
158 | lldb::ValueObjectSP); |
159 | |
160 | SyntheticChildrenFrontEnd * |
161 | LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, |
162 | lldb::ValueObjectSP); |
163 | |
164 | SyntheticChildrenFrontEnd * |
165 | LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *, |
166 | lldb::ValueObjectSP); |
167 | |
168 | SyntheticChildrenFrontEnd * |
169 | LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, |
170 | lldb::ValueObjectSP); |
171 | |
172 | SyntheticChildrenFrontEnd * |
173 | LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
174 | lldb::ValueObjectSP); |
175 | |
176 | SyntheticChildrenFrontEnd * |
177 | LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *, |
178 | lldb::ValueObjectSP); |
179 | |
180 | SyntheticChildrenFrontEnd * |
181 | LibCxxUnorderedMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
182 | lldb::ValueObjectSP); |
183 | |
184 | SyntheticChildrenFrontEnd * |
185 | LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *, |
186 | lldb::ValueObjectSP); |
187 | |
188 | SyntheticChildrenFrontEnd *LibcxxQueueFrontEndCreator(CXXSyntheticChildren *, |
189 | lldb::ValueObjectSP); |
190 | |
191 | SyntheticChildrenFrontEnd *LibcxxTupleFrontEndCreator(CXXSyntheticChildren *, |
192 | lldb::ValueObjectSP); |
193 | |
194 | SyntheticChildrenFrontEnd * |
195 | LibcxxOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, |
196 | lldb::ValueObjectSP valobj_sp); |
197 | |
198 | SyntheticChildrenFrontEnd * |
199 | LibcxxVariantFrontEndCreator(CXXSyntheticChildren *, |
200 | lldb::ValueObjectSP valobj_sp); |
201 | |
202 | SyntheticChildrenFrontEnd * |
203 | LibcxxStdSpanSyntheticFrontEndCreator(CXXSyntheticChildren *, |
204 | lldb::ValueObjectSP); |
205 | |
206 | SyntheticChildrenFrontEnd * |
207 | LibcxxStdRangesRefViewSyntheticFrontEndCreator(CXXSyntheticChildren *, |
208 | lldb::ValueObjectSP); |
209 | |
210 | bool LibcxxChronoSysSecondsSummaryProvider( |
211 | ValueObject &valobj, Stream &stream, |
212 | const TypeSummaryOptions &options); // libc++ std::chrono::sys_seconds |
213 | |
214 | bool LibcxxChronoSysDaysSummaryProvider( |
215 | ValueObject &valobj, Stream &stream, |
216 | const TypeSummaryOptions &options); // libc++ std::chrono::sys_days |
217 | |
218 | bool LibcxxChronoLocalSecondsSummaryProvider( |
219 | ValueObject &valobj, Stream &stream, |
220 | const TypeSummaryOptions &options); // libc++ std::chrono::local_seconds |
221 | |
222 | bool LibcxxChronoLocalDaysSummaryProvider( |
223 | ValueObject &valobj, Stream &stream, |
224 | const TypeSummaryOptions &options); // libc++ std::chrono::local_days |
225 | |
226 | bool LibcxxChronoMonthSummaryProvider( |
227 | ValueObject &valobj, Stream &stream, |
228 | const TypeSummaryOptions &options); // libc++ std::chrono::month |
229 | |
230 | bool LibcxxChronoWeekdaySummaryProvider( |
231 | ValueObject &valobj, Stream &stream, |
232 | const TypeSummaryOptions &options); // libc++ std::chrono::weekday |
233 | |
234 | bool 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 | |