xref: /freebsd-src/contrib/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric //===-- LibCxx.h ---------------------------------------------------*- C++
20b57cec5SDimitry Andric //-*-===//
30b57cec5SDimitry Andric //
40b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
60b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70b57cec5SDimitry Andric //
80b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
90b57cec5SDimitry Andric 
105ffd83dbSDimitry Andric #ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
115ffd83dbSDimitry Andric #define LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #include "lldb/Core/ValueObject.h"
140b57cec5SDimitry Andric #include "lldb/DataFormatters/TypeSummary.h"
150b57cec5SDimitry Andric #include "lldb/DataFormatters/TypeSynthetic.h"
160b57cec5SDimitry Andric #include "lldb/Utility/Stream.h"
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric namespace lldb_private {
190b57cec5SDimitry Andric namespace formatters {
200b57cec5SDimitry Andric 
21bdd1243dSDimitry Andric /// Find a child member of \c obj_sp, trying all alternative names in order.
22bdd1243dSDimitry Andric lldb::ValueObjectSP
23bdd1243dSDimitry Andric GetChildMemberWithName(ValueObject &obj,
24bdd1243dSDimitry Andric                        llvm::ArrayRef<ConstString> alternative_names);
25bdd1243dSDimitry Andric 
2606c3fb27SDimitry Andric lldb::ValueObjectSP GetFirstValueOfLibCXXCompressedPair(ValueObject &pair);
2706c3fb27SDimitry Andric lldb::ValueObjectSP GetSecondValueOfLibCXXCompressedPair(ValueObject &pair);
2806c3fb27SDimitry Andric 
2906c3fb27SDimitry Andric 
300b57cec5SDimitry Andric bool LibcxxStringSummaryProviderASCII(
310b57cec5SDimitry Andric     ValueObject &valobj, Stream &stream,
320b57cec5SDimitry Andric     const TypeSummaryOptions &summary_options); // libc++ std::string
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric bool LibcxxStringSummaryProviderUTF16(
350b57cec5SDimitry Andric     ValueObject &valobj, Stream &stream,
360b57cec5SDimitry Andric     const TypeSummaryOptions &summary_options); // libc++ std::u16string
370b57cec5SDimitry Andric 
380b57cec5SDimitry Andric bool LibcxxStringSummaryProviderUTF32(
390b57cec5SDimitry Andric     ValueObject &valobj, Stream &stream,
400b57cec5SDimitry Andric     const TypeSummaryOptions &summary_options); // libc++ std::u32string
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric bool LibcxxWStringSummaryProvider(
430b57cec5SDimitry Andric     ValueObject &valobj, Stream &stream,
440b57cec5SDimitry Andric     const TypeSummaryOptions &options); // libc++ std::wstring
450b57cec5SDimitry Andric 
4604eeddc0SDimitry Andric bool LibcxxStringViewSummaryProviderASCII(
4704eeddc0SDimitry Andric     ValueObject &valueObj, Stream &stream,
4804eeddc0SDimitry Andric     const TypeSummaryOptions &summary_options); // libc++ std::string_view
4904eeddc0SDimitry Andric 
5004eeddc0SDimitry Andric bool LibcxxStringViewSummaryProviderUTF16(
5104eeddc0SDimitry Andric     ValueObject &valobj, Stream &stream,
5204eeddc0SDimitry Andric     const TypeSummaryOptions &summary_options); // libc++ std::u16string_view
5304eeddc0SDimitry Andric 
5404eeddc0SDimitry Andric bool LibcxxStringViewSummaryProviderUTF32(
5504eeddc0SDimitry Andric     ValueObject &valobj, Stream &stream,
5604eeddc0SDimitry Andric     const TypeSummaryOptions &summary_options); // libc++ std::u32string_view
5704eeddc0SDimitry Andric 
5804eeddc0SDimitry Andric bool LibcxxWStringViewSummaryProvider(
5904eeddc0SDimitry Andric     ValueObject &valobj, Stream &stream,
6004eeddc0SDimitry Andric     const TypeSummaryOptions &options); // libc++ std::wstring_view
6104eeddc0SDimitry Andric 
62*0fca6ea1SDimitry Andric bool LibcxxStdSliceArraySummaryProvider(
63*0fca6ea1SDimitry Andric     ValueObject &valobj, Stream &stream,
64*0fca6ea1SDimitry Andric     const TypeSummaryOptions &options); // libc++ std::slice_array
65*0fca6ea1SDimitry Andric 
660b57cec5SDimitry Andric bool LibcxxSmartPointerSummaryProvider(
670b57cec5SDimitry Andric     ValueObject &valobj, Stream &stream,
680b57cec5SDimitry Andric     const TypeSummaryOptions
690b57cec5SDimitry Andric         &options); // libc++ std::shared_ptr<> and std::weak_ptr<>
700b57cec5SDimitry Andric 
715ffd83dbSDimitry Andric // libc++ std::unique_ptr<>
725ffd83dbSDimitry Andric bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream,
735ffd83dbSDimitry Andric                                         const TypeSummaryOptions &options);
745ffd83dbSDimitry Andric 
750b57cec5SDimitry Andric bool LibcxxFunctionSummaryProvider(
760b57cec5SDimitry Andric     ValueObject &valobj, Stream &stream,
770b57cec5SDimitry Andric     const TypeSummaryOptions &options); // libc++ std::function<>
780b57cec5SDimitry Andric 
790b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
800b57cec5SDimitry Andric LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *,
810b57cec5SDimitry Andric                                          lldb::ValueObjectSP);
820b57cec5SDimitry Andric 
830b57cec5SDimitry Andric bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream,
840b57cec5SDimitry Andric                                     const TypeSummaryOptions &options);
850b57cec5SDimitry Andric 
8681ad6265SDimitry Andric /// Formatter for libc++ std::span<>.
8781ad6265SDimitry Andric bool LibcxxSpanSummaryProvider(ValueObject &valobj, Stream &stream,
8881ad6265SDimitry Andric                                const TypeSummaryOptions &options);
8981ad6265SDimitry Andric 
900b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
910b57cec5SDimitry Andric LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
920b57cec5SDimitry Andric                                              lldb::ValueObjectSP);
930b57cec5SDimitry Andric 
940b57cec5SDimitry Andric class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
950b57cec5SDimitry Andric public:
960b57cec5SDimitry Andric   LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
970b57cec5SDimitry Andric 
98*0fca6ea1SDimitry Andric   llvm::Expected<uint32_t> CalculateNumChildren() override;
990b57cec5SDimitry Andric 
100*0fca6ea1SDimitry Andric   lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
1010b57cec5SDimitry Andric 
102*0fca6ea1SDimitry Andric   lldb::ChildCacheState Update() override;
1030b57cec5SDimitry Andric 
1040b57cec5SDimitry Andric   bool MightHaveChildren() override;
1050b57cec5SDimitry Andric 
1060b57cec5SDimitry Andric   size_t GetIndexOfChildWithName(ConstString name) override;
1070b57cec5SDimitry Andric 
1080b57cec5SDimitry Andric   ~LibcxxSharedPtrSyntheticFrontEnd() override;
1090b57cec5SDimitry Andric 
1100b57cec5SDimitry Andric private:
1110b57cec5SDimitry Andric   ValueObject *m_cntrl;
1120b57cec5SDimitry Andric };
1130b57cec5SDimitry Andric 
1145ffd83dbSDimitry Andric class LibcxxUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
1155ffd83dbSDimitry Andric public:
1165ffd83dbSDimitry Andric   LibcxxUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
1175ffd83dbSDimitry Andric 
118*0fca6ea1SDimitry Andric   llvm::Expected<uint32_t> CalculateNumChildren() override;
1195ffd83dbSDimitry Andric 
120*0fca6ea1SDimitry Andric   lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
1215ffd83dbSDimitry Andric 
122*0fca6ea1SDimitry Andric   lldb::ChildCacheState Update() override;
1235ffd83dbSDimitry Andric 
1245ffd83dbSDimitry Andric   bool MightHaveChildren() override;
1255ffd83dbSDimitry Andric 
1265ffd83dbSDimitry Andric   size_t GetIndexOfChildWithName(ConstString name) override;
1275ffd83dbSDimitry Andric 
1285ffd83dbSDimitry Andric   ~LibcxxUniquePtrSyntheticFrontEnd() override;
1295ffd83dbSDimitry Andric 
1305ffd83dbSDimitry Andric private:
131fe6060f1SDimitry Andric   lldb::ValueObjectSP m_value_ptr_sp;
13206c3fb27SDimitry Andric   lldb::ValueObjectSP m_deleter_sp;
1335ffd83dbSDimitry Andric };
1345ffd83dbSDimitry Andric 
1350b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
1360b57cec5SDimitry Andric LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *,
1370b57cec5SDimitry Andric                                      lldb::ValueObjectSP);
1380b57cec5SDimitry Andric 
1390b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
1400b57cec5SDimitry Andric LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
1410b57cec5SDimitry Andric                                         lldb::ValueObjectSP);
1420b57cec5SDimitry Andric 
1430b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
1445ffd83dbSDimitry Andric LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
1455ffd83dbSDimitry Andric                                         lldb::ValueObjectSP);
1465ffd83dbSDimitry Andric 
1475ffd83dbSDimitry Andric SyntheticChildrenFrontEnd *
1480b57cec5SDimitry Andric LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *,
1490b57cec5SDimitry Andric                                         lldb::ValueObjectSP);
1500b57cec5SDimitry Andric 
1510b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
152*0fca6ea1SDimitry Andric LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren *,
153*0fca6ea1SDimitry Andric                                           lldb::ValueObjectSP);
154*0fca6ea1SDimitry Andric 
155*0fca6ea1SDimitry Andric SyntheticChildrenFrontEnd *
156*0fca6ea1SDimitry Andric LibcxxStdSliceArraySyntheticFrontEndCreator(CXXSyntheticChildren *,
157*0fca6ea1SDimitry Andric                                             lldb::ValueObjectSP);
158*0fca6ea1SDimitry Andric 
159*0fca6ea1SDimitry Andric SyntheticChildrenFrontEnd *
160*0fca6ea1SDimitry Andric LibcxxStdProxyArraySyntheticFrontEndCreator(CXXSyntheticChildren *,
161*0fca6ea1SDimitry Andric                                             lldb::ValueObjectSP);
162*0fca6ea1SDimitry Andric 
163*0fca6ea1SDimitry Andric SyntheticChildrenFrontEnd *
1640b57cec5SDimitry Andric LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *,
1650b57cec5SDimitry Andric                                       lldb::ValueObjectSP);
1660b57cec5SDimitry Andric 
1670b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
1680b57cec5SDimitry Andric LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *,
1690b57cec5SDimitry Andric                                              lldb::ValueObjectSP);
1700b57cec5SDimitry Andric 
1710b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
1720b57cec5SDimitry Andric LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
1730b57cec5SDimitry Andric                                      lldb::ValueObjectSP);
1740b57cec5SDimitry Andric 
1750b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
176*0fca6ea1SDimitry Andric LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
177*0fca6ea1SDimitry Andric                                           lldb::ValueObjectSP);
178*0fca6ea1SDimitry Andric 
179*0fca6ea1SDimitry Andric SyntheticChildrenFrontEnd *
1800b57cec5SDimitry Andric LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
1810b57cec5SDimitry Andric                                               lldb::ValueObjectSP);
1820b57cec5SDimitry Andric 
1830b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
184*0fca6ea1SDimitry Andric LibCxxUnorderedMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
185*0fca6ea1SDimitry Andric                                                    lldb::ValueObjectSP);
186*0fca6ea1SDimitry Andric 
187*0fca6ea1SDimitry Andric SyntheticChildrenFrontEnd *
1880b57cec5SDimitry Andric LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *,
1890b57cec5SDimitry Andric                                               lldb::ValueObjectSP);
1900b57cec5SDimitry Andric 
1910b57cec5SDimitry Andric SyntheticChildrenFrontEnd *LibcxxQueueFrontEndCreator(CXXSyntheticChildren *,
1920b57cec5SDimitry Andric                                                       lldb::ValueObjectSP);
1930b57cec5SDimitry Andric 
1940b57cec5SDimitry Andric SyntheticChildrenFrontEnd *LibcxxTupleFrontEndCreator(CXXSyntheticChildren *,
1950b57cec5SDimitry Andric                                                       lldb::ValueObjectSP);
1960b57cec5SDimitry Andric 
1970b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
1980eae32dcSDimitry Andric LibcxxOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *,
1990b57cec5SDimitry Andric                                        lldb::ValueObjectSP valobj_sp);
2000b57cec5SDimitry Andric 
2010b57cec5SDimitry Andric SyntheticChildrenFrontEnd *
2020b57cec5SDimitry Andric LibcxxVariantFrontEndCreator(CXXSyntheticChildren *,
2030b57cec5SDimitry Andric                              lldb::ValueObjectSP valobj_sp);
2040b57cec5SDimitry Andric 
20581ad6265SDimitry Andric SyntheticChildrenFrontEnd *
20681ad6265SDimitry Andric LibcxxStdSpanSyntheticFrontEndCreator(CXXSyntheticChildren *,
20781ad6265SDimitry Andric                                       lldb::ValueObjectSP);
20881ad6265SDimitry Andric 
209bdd1243dSDimitry Andric SyntheticChildrenFrontEnd *
210bdd1243dSDimitry Andric LibcxxStdRangesRefViewSyntheticFrontEndCreator(CXXSyntheticChildren *,
211bdd1243dSDimitry Andric                                                lldb::ValueObjectSP);
212bdd1243dSDimitry Andric 
2137a6dacacSDimitry Andric bool LibcxxChronoSysSecondsSummaryProvider(
2147a6dacacSDimitry Andric     ValueObject &valobj, Stream &stream,
2157a6dacacSDimitry Andric     const TypeSummaryOptions &options); // libc++ std::chrono::sys_seconds
2167a6dacacSDimitry Andric 
2177a6dacacSDimitry Andric bool LibcxxChronoSysDaysSummaryProvider(
2187a6dacacSDimitry Andric     ValueObject &valobj, Stream &stream,
2197a6dacacSDimitry Andric     const TypeSummaryOptions &options); // libc++ std::chrono::sys_days
2207a6dacacSDimitry Andric 
221*0fca6ea1SDimitry Andric bool LibcxxChronoLocalSecondsSummaryProvider(
222*0fca6ea1SDimitry Andric     ValueObject &valobj, Stream &stream,
223*0fca6ea1SDimitry Andric     const TypeSummaryOptions &options); // libc++ std::chrono::local_seconds
224*0fca6ea1SDimitry Andric 
225*0fca6ea1SDimitry Andric bool LibcxxChronoLocalDaysSummaryProvider(
226*0fca6ea1SDimitry Andric     ValueObject &valobj, Stream &stream,
227*0fca6ea1SDimitry Andric     const TypeSummaryOptions &options); // libc++ std::chrono::local_days
228*0fca6ea1SDimitry Andric 
229297eecfbSDimitry Andric bool LibcxxChronoMonthSummaryProvider(
230297eecfbSDimitry Andric     ValueObject &valobj, Stream &stream,
231297eecfbSDimitry Andric     const TypeSummaryOptions &options); // libc++ std::chrono::month
232297eecfbSDimitry Andric 
2337a6dacacSDimitry Andric bool LibcxxChronoWeekdaySummaryProvider(
2347a6dacacSDimitry Andric     ValueObject &valobj, Stream &stream,
2357a6dacacSDimitry Andric     const TypeSummaryOptions &options); // libc++ std::chrono::weekday
2367a6dacacSDimitry Andric 
237297eecfbSDimitry Andric bool LibcxxChronoYearMonthDaySummaryProvider(
238297eecfbSDimitry Andric     ValueObject &valobj, Stream &stream,
239297eecfbSDimitry Andric     const TypeSummaryOptions &options); // libc++ std::chrono::year_month_day
240297eecfbSDimitry Andric 
2410b57cec5SDimitry Andric } // namespace formatters
2420b57cec5SDimitry Andric } // namespace lldb_private
2430b57cec5SDimitry Andric 
2445ffd83dbSDimitry Andric #endif // LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
245