blob: 214f5512e4a50cc0aeb99e619b9aa89d9a2601f6 [file] [log] [blame]
Kate Stoneb9c1b512016-09-06 20:57:50 +00001//===-- LibCxx.h ---------------------------------------------------*- C++
2//-*-===//
Enrico Granata419d7912015-09-04 00:33:51 +00003//
Chandler Carruth2946cd72019-01-19 08:50:56 +00004// 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
Enrico Granata419d7912015-09-04 00:33:51 +00007//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_LibCxx_h_
11#define liblldb_LibCxx_h_
12
Enrico Granata419d7912015-09-04 00:33:51 +000013#include "lldb/Core/ValueObject.h"
14#include "lldb/DataFormatters/TypeSummary.h"
15#include "lldb/DataFormatters/TypeSynthetic.h"
Zachary Turnerbf9a7732017-02-02 21:39:50 +000016#include "lldb/Utility/Stream.h"
Enrico Granata419d7912015-09-04 00:33:51 +000017
18namespace lldb_private {
Kate Stoneb9c1b512016-09-06 20:57:50 +000019namespace formatters {
Enrico Granata419d7912015-09-04 00:33:51 +000020
Shafik Yaghmour693fbf52018-10-26 17:00:48 +000021bool LibcxxStringSummaryProviderASCII(
Kate Stoneb9c1b512016-09-06 20:57:50 +000022 ValueObject &valobj, Stream &stream,
Shafik Yaghmour693fbf52018-10-26 17:00:48 +000023 const TypeSummaryOptions &summary_options); // libc++ std::string
24
25bool LibcxxStringSummaryProviderUTF16(
26 ValueObject &valobj, Stream &stream,
27 const TypeSummaryOptions &summary_options); // libc++ std::u16string
28
29bool LibcxxStringSummaryProviderUTF32(
30 ValueObject &valobj, Stream &stream,
31 const TypeSummaryOptions &summary_options); // libc++ std::u32string
Kate Stoneb9c1b512016-09-06 20:57:50 +000032
33bool LibcxxWStringSummaryProvider(
34 ValueObject &valobj, Stream &stream,
35 const TypeSummaryOptions &options); // libc++ std::wstring
36
Adrian Prantlc53d3682018-08-15 22:48:48 +000037bool LibcxxOptionalSummaryProvider(
38 ValueObject &valobj, Stream &stream,
39 const TypeSummaryOptions &options); // libc++ std::optional<>
40
Kate Stoneb9c1b512016-09-06 20:57:50 +000041bool LibcxxSmartPointerSummaryProvider(
42 ValueObject &valobj, Stream &stream,
43 const TypeSummaryOptions
44 &options); // libc++ std::shared_ptr<> and std::weak_ptr<>
45
Adrian Prantl6b58fa72018-08-23 17:02:39 +000046bool LibcxxFunctionSummaryProvider(
47 ValueObject &valobj, Stream &stream,
48 const TypeSummaryOptions &options); // libc++ std::function<>
49
Kate Stoneb9c1b512016-09-06 20:57:50 +000050SyntheticChildrenFrontEnd *
51LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *,
52 lldb::ValueObjectSP);
53
54bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream,
55 const TypeSummaryOptions &options);
56
57class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
58public:
59 LibCxxMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
60
61 size_t CalculateNumChildren() override;
62
63 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
64
65 bool Update() override;
66
67 bool MightHaveChildren() override;
68
Adrian Prantl0e4c4822019-03-06 21:22:25 +000069 size_t GetIndexOfChildWithName(ConstString name) override;
Kate Stoneb9c1b512016-09-06 20:57:50 +000070
71 ~LibCxxMapIteratorSyntheticFrontEnd() override;
72
73private:
74 ValueObject *m_pair_ptr;
Enrico Granataae1ba732016-09-28 22:53:16 +000075 lldb::ValueObjectSP m_pair_sp;
Kate Stoneb9c1b512016-09-06 20:57:50 +000076};
77
78SyntheticChildrenFrontEnd *
79LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
80 lldb::ValueObjectSP);
81
82SyntheticChildrenFrontEnd *
83LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
84 lldb::ValueObjectSP);
85
86class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
87public:
88 LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
89
90 size_t CalculateNumChildren() override;
91
92 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
93
94 bool Update() override;
95
96 bool MightHaveChildren() override;
97
Adrian Prantl0e4c4822019-03-06 21:22:25 +000098 size_t GetIndexOfChildWithName(ConstString name) override;
Kate Stoneb9c1b512016-09-06 20:57:50 +000099
100 ~LibcxxSharedPtrSyntheticFrontEnd() override;
101
102private:
103 ValueObject *m_cntrl;
104 lldb::ValueObjectSP m_count_sp;
105 lldb::ValueObjectSP m_weak_count_sp;
106 uint8_t m_ptr_size;
107 lldb::ByteOrder m_byte_order;
108};
109
110SyntheticChildrenFrontEnd *
Pavel Labath52698752017-11-14 11:15:03 +0000111LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *,
112 lldb::ValueObjectSP);
113
114SyntheticChildrenFrontEnd *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000115LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
116 lldb::ValueObjectSP);
117
118SyntheticChildrenFrontEnd *
119LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *,
120 lldb::ValueObjectSP);
121
122SyntheticChildrenFrontEnd *
123LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *,
124 lldb::ValueObjectSP);
125
126SyntheticChildrenFrontEnd *
Pavel Labath89ac0c72017-10-31 12:27:43 +0000127LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *,
128 lldb::ValueObjectSP);
129
130SyntheticChildrenFrontEnd *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000131LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
132 lldb::ValueObjectSP);
133
134SyntheticChildrenFrontEnd *
135LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
136 lldb::ValueObjectSP);
137
138SyntheticChildrenFrontEnd *
139LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *,
140 lldb::ValueObjectSP);
141
Pavel Labathe0d51842017-11-01 15:52:08 +0000142SyntheticChildrenFrontEnd *LibcxxQueueFrontEndCreator(CXXSyntheticChildren *,
143 lldb::ValueObjectSP);
144
Pavel Labath333739d2017-11-01 15:19:52 +0000145SyntheticChildrenFrontEnd *LibcxxTupleFrontEndCreator(CXXSyntheticChildren *,
146 lldb::ValueObjectSP);
147
Adrian Prantlc53d3682018-08-15 22:48:48 +0000148SyntheticChildrenFrontEnd *
149LibcxxOptionalFrontEndCreator(CXXSyntheticChildren *,
150 lldb::ValueObjectSP valobj_sp);
151
Shafik Yaghmour8306f762018-09-19 18:07:05 +0000152SyntheticChildrenFrontEnd *
153LibcxxVariantFrontEndCreator(CXXSyntheticChildren *,
154 lldb::ValueObjectSP valobj_sp);
155
Kate Stoneb9c1b512016-09-06 20:57:50 +0000156} // namespace formatters
Enrico Granata419d7912015-09-04 00:33:51 +0000157} // namespace lldb_private
158
159#endif // liblldb_LibCxx_h_