LLDB  mainline
SBType.h
Go to the documentation of this file.
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 
14 namespace lldb {
15 
16 class SBTypeList;
17 
19 public:
20  SBTypeMember();
21 
22  SBTypeMember(const lldb::SBTypeMember &rhs);
23 
24  ~SBTypeMember();
25 
26  lldb::SBTypeMember &operator=(const lldb::SBTypeMember &rhs);
27 
28  explicit operator bool() const;
29 
30  bool IsValid() const;
31 
32  const char *GetName();
33 
34  lldb::SBType GetType();
35 
36  uint64_t GetOffsetInBytes();
37 
38  uint64_t GetOffsetInBits();
39 
40  bool IsBitfield();
41 
42  uint32_t GetBitfieldSizeInBits();
43 
44  bool GetDescription(lldb::SBStream &description,
45  lldb::DescriptionLevel description_level);
46 
47 protected:
48  friend class SBType;
49 
50  void reset(lldb_private::TypeMemberImpl *);
51 
53 
54  const lldb_private::TypeMemberImpl &ref() const;
55 
56  std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_up;
57 };
58 
60 public:
62 
64 
66 
68 
69  explicit operator bool() const;
70 
71  bool IsValid() const;
72 
73  const char *GetName();
74 
75  const char *GetDemangledName();
76 
77  const char *GetMangledName();
78 
80 
82 
84 
86 
88 
89  bool GetDescription(lldb::SBStream &description,
90  lldb::DescriptionLevel description_level);
91 
92 protected:
93  friend class SBType;
94 
96 
98 
100 
101  lldb::TypeMemberFunctionImplSP m_opaque_sp;
102 };
103 
104 class SBType {
105 public:
106  SBType();
107 
108  SBType(const lldb::SBType &rhs);
109 
110  ~SBType();
111 
112  explicit operator bool() const;
113 
114  bool IsValid() const;
115 
116  uint64_t GetByteSize();
117 
118  bool IsPointerType();
119 
120  bool IsReferenceType();
121 
122  bool IsFunctionType();
123 
124  bool IsPolymorphicClass();
125 
126  bool IsArrayType();
127 
128  bool IsVectorType();
129 
130  bool IsTypedefType();
131 
132  bool IsAnonymousType();
133 
135 
137 
139 
141 
143 
145 
147 
149 
150  lldb::SBType GetArrayType(uint64_t size);
151 
153 
155 
157 
158  // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
159  // type eBasicTypeInvalid will be returned
161 
162  // The call below confusing and should really be renamed to "CreateBasicType"
164 
166 
168 
170 
172 
174 
176 
178 
180 
182 
184 
186 
188 
190 
192 
194 
195  const char *GetName();
196 
197  const char *GetDisplayTypeName();
198 
199  lldb::TypeClass GetTypeClass();
200 
201  bool IsTypeComplete();
202 
204 
205  bool GetDescription(lldb::SBStream &description,
206  lldb::DescriptionLevel description_level);
207 
208  lldb::SBType &operator=(const lldb::SBType &rhs);
209 
210  bool operator==(lldb::SBType &rhs);
211 
212  bool operator!=(lldb::SBType &rhs);
213 
214 protected:
216 
217  const lldb_private::TypeImpl &ref() const;
218 
219  lldb::TypeImplSP GetSP();
220 
221  void SetSP(const lldb::TypeImplSP &type_impl_sp);
222 
223  lldb::TypeImplSP m_opaque_sp;
224 
225  friend class SBFunction;
226  friend class SBModule;
227  friend class SBTarget;
228  friend class SBTypeEnumMember;
229  friend class SBTypeEnumMemberList;
230  friend class SBTypeNameSpecifier;
231  friend class SBTypeMember;
232  friend class SBTypeMemberFunction;
233  friend class SBTypeList;
234  friend class SBValue;
235 
237  SBType(const lldb::TypeSP &);
238  SBType(const lldb::TypeImplSP &);
239 };
240 
241 class SBTypeList {
242 public:
243  SBTypeList();
244 
245  SBTypeList(const lldb::SBTypeList &rhs);
246 
247  ~SBTypeList();
248 
250 
251  explicit operator bool() const;
252 
253  bool IsValid();
254 
255  void Append(lldb::SBType type);
256 
258 
259  uint32_t GetSize();
260 
261 private:
262  std::unique_ptr<lldb_private::TypeListImpl> m_opaque_up;
263  friend class SBModule;
264  friend class SBCompileUnit;
265 };
266 
267 } // namespace lldb
268 
269 #endif // LLDB_API_SBTYPE_H
lldb::SBTypeMemberFunction::GetType
lldb::SBType GetType()
Definition: SBType.cpp:848
lldb::SBType::GetTemplateArgumentKind
lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx)
Definition: SBType.cpp:583
lldb::SBTypeList::GetTypeAtIndex
lldb::SBType GetTypeAtIndex(uint32_t index)
Definition: SBType.cpp:635
lldb::SBTypeMemberFunction::GetNumberOfArguments
uint32_t GetNumberOfArguments()
Definition: SBType.cpp:868
lldb_private::TypeMemberImpl
Definition: Type.h:340
lldb::SBTypeMemberFunction::operator=
lldb::SBTypeMemberFunction & operator=(const lldb::SBTypeMemberFunction &rhs)
Definition: SBType.cpp:796
lldb::SBTypeNameSpecifier
Definition: SBTypeNameSpecifier.h:17
lldb::SBTypeList::operator=
lldb::SBTypeList & operator=(const lldb::SBTypeList &rhs)
Definition: SBType.cpp:615
lldb::SBType::GetReferenceType
lldb::SBType GetReferenceType()
Definition: SBType.cpp:184
lldb::SBType::GetFieldAtIndex
lldb::SBTypeMember GetFieldAtIndex(uint32_t idx)
Definition: SBType.cpp:472
lldb::SBType::IsVectorType
bool IsVectorType()
Definition: SBType.cpp:149
SBDefines.h
lldb::SBType::operator==
bool operator==(lldb::SBType &rhs)
Definition: SBType.cpp:53
lldb::SBTypeEnumMemberList
Definition: SBTypeEnumMember.h:57
lldb::SBType::m_opaque_sp
lldb::TypeImplSP m_opaque_sp
Definition: SBType.h:223
lldb::SBCompileUnit
Definition: SBCompileUnit.h:17
lldb::SBType::operator=
lldb::SBType & operator=(const lldb::SBType &rhs)
Definition: SBType.cpp:83
lldb::SBType::GetNumberOfDirectBaseClasses
uint32_t GetNumberOfDirectBaseClasses()
Definition: SBType.cpp:375
lldb::SBType::GetMemberFunctionAtIndex
lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx)
Definition: SBType.cpp:318
lldb::SBType::GetVirtualBaseClassAtIndex
lldb::SBTypeMember GetVirtualBaseClassAtIndex(uint32_t idx)
Definition: SBType.cpp:432
lldb::SBValue
Definition: SBValue.h:21
lldb::SBTypeMember::m_opaque_up
std::unique_ptr< lldb_private::TypeMemberImpl > m_opaque_up
Definition: SBType.h:56
lldb::SBType::IsArrayType
bool IsArrayType()
Definition: SBType.cpp:140
lldb::SBTypeList::SBTypeList
SBTypeList()
Definition: SBType.cpp:592
lldb::SBType::IsTypeComplete
bool IsTypeComplete()
Definition: SBType.cpp:499
LLDB_API
#define LLDB_API
Definition: lldb-defines.h:23
lldb::SBType::GetArrayType
lldb::SBType GetArrayType(uint64_t size)
Definition: SBType.cpp:220
lldb::SBTypeMemberFunction
Definition: SBType.h:59
lldb::BasicType
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Definition: lldb-enumerations.h:741
lldb::SBType::GetNumberOfTemplateArguments
uint32_t GetNumberOfTemplateArguments()
Definition: SBType.cpp:550
lldb::SBType::GetNumberOfMemberFunctions
uint32_t GetNumberOfMemberFunctions()
Definition: SBType.cpp:309
lldb::SBTypeMemberFunction::GetArgumentTypeAtIndex
lldb::SBType GetArgumentTypeAtIndex(uint32_t)
Definition: SBType.cpp:877
lldb::SBTypeMemberFunction::GetReturnType
lldb::SBType GetReturnType()
Definition: SBType.cpp:858
lldb::SBType::GetTemplateArgumentType
lldb::SBType GetTemplateArgumentType(uint32_t idx)
Definition: SBType.cpp:558
lldb::SBType::GetDereferencedType
lldb::SBType GetDereferencedType()
Definition: SBType.cpp:202
lldb::SBTarget
Definition: SBTarget.h:29
lldb::SBType::GetDescription
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBType.cpp:399
lldb::SBTypeMemberFunction::SBTypeMemberFunction
SBTypeMemberFunction()
Definition: SBType.cpp:783
lldb::SBType::GetPointeeType
lldb::SBType GetPointeeType()
Definition: SBType.cpp:175
GetName
static llvm::StringRef GetName(XcodeSDK::Type type)
Definition: XcodeSDK.cpp:21
lldb::SBType::GetTypeClass
lldb::TypeClass GetTypeClass()
Definition: SBType.cpp:542
lldb::SBType::GetUnqualifiedType
lldb::SBType GetUnqualifiedType()
Definition: SBType.cpp:329
lldb::SBType::GetModule
lldb::SBModule GetModule()
Definition: SBType.cpp:515
lldb::SBType::IsAnonymousType
bool IsAnonymousType()
Definition: SBType.cpp:266
lldb::SBFunction
Definition: SBFunction.h:18
lldb::SBTypeList
class LLDB_API SBTypeList
Definition: SBDefines.h:90
lldb::SBType::GetFunctionArgumentTypes
lldb::SBTypeList GetFunctionArgumentTypes()
Definition: SBType.cpp:294
lldb::SBTypeList::IsValid
bool IsValid()
Definition: SBType.cpp:605
lldb::SBType::GetDisplayTypeName
const char * GetDisplayTypeName()
Definition: SBType.cpp:534
lldb::SBType::GetNumberOfFields
uint32_t GetNumberOfFields()
Definition: SBType.cpp:391
lldb::SBType::operator!=
bool operator!=(lldb::SBType &rhs)
Definition: SBType.cpp:65
lldb::TemplateArgumentKind
TemplateArgumentKind
Definition: lldb-enumerations.h:814
lldb::SBTypeList::m_opaque_up
std::unique_ptr< lldb_private::TypeListImpl > m_opaque_up
Definition: SBType.h:262
lldb::SBType
Definition: SBType.h:104
lldb::SBType::ref
lldb_private::TypeImpl & ref()
Definition: SBType.cpp:95
lldb::SBTypeList::GetSize
uint32_t GetSize()
Definition: SBType.cpp:644
lldb::SBType::IsFunctionType
bool IsFunctionType()
Definition: SBType.cpp:242
lldb::SBTypeList
Definition: SBType.h:241
lldb::SBTypeMemberFunction::GetName
const char * GetName()
Definition: SBType.cpp:817
lldb::SBTypeMemberFunction::ref
lldb_private::TypeMemberFunctionImpl & ref()
Definition: SBType.cpp:916
lldb::SBType::IsPointerType
bool IsPointerType()
Definition: SBType.cpp:132
lldb::SBType::GetFunctionReturnType
lldb::SBType GetFunctionReturnType()
Definition: SBType.cpp:282
lldb::SBType::GetTypeFlags
uint32_t GetTypeFlags()
Definition: SBType.cpp:507
lldb::SBType::IsPolymorphicClass
bool IsPolymorphicClass()
Definition: SBType.cpp:250
uint32_t
lldb::SBTypeMemberFunction::IsValid
bool IsValid() const
Definition: SBType.cpp:807
lldb::SBType::SBType
SBType()
Definition: SBType.cpp:29
lldb::SBTypeMemberFunction::reset
void reset(lldb_private::TypeMemberFunctionImpl *)
Definition: SBType.cpp:912
lldb::SBType::GetPointerType
lldb::SBType GetPointerType()
Definition: SBType.cpp:165
lldb::SBModule
Definition: SBModule.h:20
lldb::SBTypeMemberFunction::~SBTypeMemberFunction
~SBTypeMemberFunction()
lldb::SBType::IsTypedefType
bool IsTypedefType()
Definition: SBType.cpp:258
lldb::SBType::GetSP
lldb::TypeImplSP GetSP()
Definition: SBType.cpp:77
lldb::SBTypeMember
Definition: SBType.h:18
lldb::SBTypeMemberFunction::GetKind
lldb::MemberFunctionKind GetKind()
Definition: SBType.cpp:889
lldb::SBType::IsScopedEnumerationType
bool IsScopedEnumerationType()
Definition: SBType.cpp:274
lldb::SBType::GetNumberOfVirtualBaseClasses
uint32_t GetNumberOfVirtualBaseClasses()
Definition: SBType.cpp:383
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb::SBType::GetTypedefedType
lldb::SBType GetTypedefedType()
Definition: SBType.cpp:193
lldb::SBType::GetName
const char * GetName()
Definition: SBType.cpp:526
lldb_private::TypeImpl
Definition: Type.h:238
lldb::SBType::GetEnumerationIntegerType
lldb::SBType GetEnumerationIntegerType()
Definition: SBType.cpp:347
lldb::SBTypeList::~SBTypeList
~SBTypeList()
lldb::SBType::GetCanonicalType
lldb::SBType GetCanonicalType()
Definition: SBType.cpp:338
lldb::SBType::GetBasicType
lldb::BasicType GetBasicType()
Definition: SBType.cpp:357
lldb::SBType::GetArrayElementType
lldb::SBType GetArrayElementType()
Definition: SBType.cpp:211
lldb::MemberFunctionKind
MemberFunctionKind
Kind of member function.
Definition: lldb-enumerations.h:1020
lldb::SBTypeList::Append
void Append(lldb::SBType type)
Definition: SBType.cpp:628
lldb::SBTypeMemberFunction::GetMangledName
const char * GetMangledName()
Definition: SBType.cpp:839
lldb::SBType::IsValid
bool IsValid() const
Definition: SBType.cpp:109
lldb::SBType::GetEnumMembers
lldb::SBTypeEnumMemberList GetEnumMembers()
Definition: SBType.cpp:449
lldb::SBStream
Definition: SBStream.h:18
lldb::SBType::GetDirectBaseClassAtIndex
lldb::SBTypeMember GetDirectBaseClassAtIndex(uint32_t idx)
Definition: SBType.cpp:415
lldb_private::TypeMemberFunctionImpl
Definition: Type.h:435
lldb::SBType::GetVectorElementType
lldb::SBType GetVectorElementType()
Definition: SBType.cpp:229
lldb::SBType::GetByteSize
uint64_t GetByteSize()
Definition: SBType.cpp:122
lldb::SBType::IsReferenceType
bool IsReferenceType()
Definition: SBType.cpp:157
lldb::SBTypeMemberFunction::GetDescription
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBType.cpp:898
lldb::SBTypeMemberFunction::m_opaque_sp
lldb::TypeMemberFunctionImplSP m_opaque_sp
Definition: SBType.h:101
lldb
Definition: SBAddress.h:15
lldb::SBType::SetSP
void SetSP(const lldb::TypeImplSP &type_impl_sp)
Definition: SBType.cpp:79
lldb::SBTypeEnumMember
Definition: SBTypeEnumMember.h:17
lldb::SBType::~SBType
~SBType()
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb::SBTypeMemberFunction::GetDemangledName
const char * GetDemangledName()
Definition: SBType.cpp:825