1//===-- SBType.h ------------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_API_SBTYPE_H
10#define LLDB_API_SBTYPE_H
11
12#include "lldb/API/SBDefines.h"
13
14namespace lldb_private {
15namespace python {
16class SWIGBridge;
17}
18} // namespace lldb_private
19
20namespace lldb {
21
22class SBTypeList;
23
24class LLDB_API SBTypeMember {
25public:
26 SBTypeMember();
27
28 SBTypeMember(const lldb::SBTypeMember &rhs);
29
30 ~SBTypeMember();
31
32 lldb::SBTypeMember &operator=(const lldb::SBTypeMember &rhs);
33
34 explicit operator bool() const;
35
36 bool IsValid() const;
37
38 const char *GetName();
39
40 lldb::SBType GetType();
41
42 uint64_t GetOffsetInBytes();
43
44 uint64_t GetOffsetInBits();
45
46 bool IsBitfield();
47
48 uint32_t GetBitfieldSizeInBits();
49
50 bool GetDescription(lldb::SBStream &description,
51 lldb::DescriptionLevel description_level);
52
53protected:
54 friend class SBType;
55
56 void reset(lldb_private::TypeMemberImpl *);
57
58 lldb_private::TypeMemberImpl &ref();
59
60 const lldb_private::TypeMemberImpl &ref() const;
61
62 std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_up;
63};
64
65class SBTypeMemberFunction {
66public:
67 SBTypeMemberFunction();
68
69 SBTypeMemberFunction(const lldb::SBTypeMemberFunction &rhs);
70
71 ~SBTypeMemberFunction();
72
73 lldb::SBTypeMemberFunction &operator=(const lldb::SBTypeMemberFunction &rhs);
74
75 explicit operator bool() const;
76
77 bool IsValid() const;
78
79 const char *GetName();
80
81 const char *GetDemangledName();
82
83 const char *GetMangledName();
84
85 lldb::SBType GetType();
86
87 lldb::SBType GetReturnType();
88
89 uint32_t GetNumberOfArguments();
90
91 lldb::SBType GetArgumentTypeAtIndex(uint32_t);
92
93 lldb::MemberFunctionKind GetKind();
94
95 bool GetDescription(lldb::SBStream &description,
96 lldb::DescriptionLevel description_level);
97
98protected:
99 friend class SBType;
100
101 void reset(lldb_private::TypeMemberFunctionImpl *);
102
103 lldb_private::TypeMemberFunctionImpl &ref();
104
105 const lldb_private::TypeMemberFunctionImpl &ref() const;
106
107 lldb::TypeMemberFunctionImplSP m_opaque_sp;
108};
109
110class SBType {
111public:
112 SBType();
113
114 SBType(const lldb::SBType &rhs);
115
116 ~SBType();
117
118 explicit operator bool() const;
119
120 bool IsValid() const;
121
122 uint64_t GetByteSize();
123
124 bool IsPointerType();
125
126 bool IsReferenceType();
127
128 bool IsFunctionType();
129
130 bool IsPolymorphicClass();
131
132 bool IsArrayType();
133
134 bool IsVectorType();
135
136 bool IsTypedefType();
137
138 bool IsAnonymousType();
139
140 bool IsScopedEnumerationType();
141
142 bool IsAggregateType();
143
144 lldb::SBType GetPointerType();
145
146 lldb::SBType GetPointeeType();
147
148 lldb::SBType GetReferenceType();
149
150 lldb::SBType GetTypedefedType();
151
152 lldb::SBType GetDereferencedType();
153
154 lldb::SBType GetUnqualifiedType();
155
156 lldb::SBType GetArrayElementType();
157
158 lldb::SBType GetArrayType(uint64_t size);
159
160 lldb::SBType GetVectorElementType();
161
162 lldb::SBType GetCanonicalType();
163
164 lldb::SBType GetEnumerationIntegerType();
165
166 // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
167 // type eBasicTypeInvalid will be returned
168 lldb::BasicType GetBasicType();
169
170 // The call below confusing and should really be renamed to "CreateBasicType"
171 lldb::SBType GetBasicType(lldb::BasicType type);
172
173 uint32_t GetNumberOfFields();
174
175 uint32_t GetNumberOfDirectBaseClasses();
176
177 uint32_t GetNumberOfVirtualBaseClasses();
178
179 lldb::SBTypeMember GetFieldAtIndex(uint32_t idx);
180
181 lldb::SBTypeMember GetDirectBaseClassAtIndex(uint32_t idx);
182
183 lldb::SBTypeMember GetVirtualBaseClassAtIndex(uint32_t idx);
184
185 lldb::SBTypeEnumMemberList GetEnumMembers();
186
187 uint32_t GetNumberOfTemplateArguments();
188
189 lldb::SBType GetTemplateArgumentType(uint32_t idx);
190
191 /// Return the TemplateArgumentKind of the template argument at index idx.
192 /// Variadic argument packs are automatically expanded.
193 lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx);
194
195 lldb::SBType GetFunctionReturnType();
196
197 lldb::SBTypeList GetFunctionArgumentTypes();
198
199 uint32_t GetNumberOfMemberFunctions();
200
201 lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx);
202
203 lldb::SBModule GetModule();
204
205 const char *GetName();
206
207 const char *GetDisplayTypeName();
208
209 lldb::TypeClass GetTypeClass();
210
211 bool IsTypeComplete();
212
213 uint32_t GetTypeFlags();
214
215 bool GetDescription(lldb::SBStream &description,
216 lldb::DescriptionLevel description_level);
217
218 lldb::SBType FindDirectNestedType(const char *name);
219
220 lldb::SBType &operator=(const lldb::SBType &rhs);
221
222 bool operator==(lldb::SBType &rhs);
223
224 bool operator!=(lldb::SBType &rhs);
225
226protected:
227 lldb_private::TypeImpl &ref();
228
229 const lldb_private::TypeImpl &ref() const;
230
231 lldb::TypeImplSP GetSP();
232
233 void SetSP(const lldb::TypeImplSP &type_impl_sp);
234
235 lldb::TypeImplSP m_opaque_sp;
236
237 friend class SBFunction;
238 friend class SBModule;
239 friend class SBTarget;
240 friend class SBTypeEnumMember;
241 friend class SBTypeEnumMemberList;
242 friend class SBTypeNameSpecifier;
243 friend class SBTypeMember;
244 friend class SBTypeMemberFunction;
245 friend class SBTypeList;
246 friend class SBValue;
247 friend class SBWatchpoint;
248
249 friend class lldb_private::python::SWIGBridge;
250
251 SBType(const lldb_private::CompilerType &);
252 SBType(const lldb::TypeSP &);
253 SBType(const lldb::TypeImplSP &);
254};
255
256class SBTypeList {
257public:
258 SBTypeList();
259
260 SBTypeList(const lldb::SBTypeList &rhs);
261
262 ~SBTypeList();
263
264 lldb::SBTypeList &operator=(const lldb::SBTypeList &rhs);
265
266 explicit operator bool() const;
267
268 bool IsValid();
269
270 void Append(lldb::SBType type);
271
272 lldb::SBType GetTypeAtIndex(uint32_t index);
273
274 uint32_t GetSize();
275
276private:
277 std::unique_ptr<lldb_private::TypeListImpl> m_opaque_up;
278 friend class SBModule;
279 friend class SBCompileUnit;
280};
281
282} // namespace lldb
283
284#endif // LLDB_API_SBTYPE_H
285

source code of lldb/include/lldb/API/SBType.h