1//===-- SBType.h ------------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLDB_SBType_h_
11#define LLDB_SBType_h_
12
13#include "lldb/API/SBDefines.h"
14
15namespace lldb {
16
17class SBTypeList;
18
19class SBTypeMember
20{
21public:
22    SBTypeMember ();
23
24    SBTypeMember (const lldb::SBTypeMember& rhs);
25
26    ~SBTypeMember();
27
28    lldb::SBTypeMember&
29    operator = (const lldb::SBTypeMember& rhs);
30
31    bool
32    IsValid() const;
33
34    const char *
35    GetName ();
36
37    lldb::SBType
38    GetType ();
39
40    uint64_t
41    GetOffsetInBytes();
42
43    uint64_t
44    GetOffsetInBits();
45
46    bool
47    IsBitfield();
48
49    uint32_t
50    GetBitfieldSizeInBits();
51
52    bool
53    GetDescription (lldb::SBStream &description,
54                    lldb::DescriptionLevel description_level);
55
56protected:
57    friend class SBType;
58
59    void
60    reset (lldb_private::TypeMemberImpl *);
61
62    lldb_private::TypeMemberImpl &
63    ref ();
64
65    const lldb_private::TypeMemberImpl &
66    ref () const;
67
68    std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
69};
70
71class SBType
72{
73public:
74
75    SBType();
76
77    SBType (const lldb::SBType &rhs);
78
79    ~SBType ();
80
81    bool
82    IsValid() const;
83
84    uint64_t
85    GetByteSize();
86
87    bool
88    IsPointerType();
89
90    bool
91    IsReferenceType();
92
93    bool
94    IsFunctionType ();
95
96    bool
97    IsPolymorphicClass ();
98
99    lldb::SBType
100    GetPointerType();
101
102    lldb::SBType
103    GetPointeeType();
104
105    lldb::SBType
106    GetReferenceType();
107
108    lldb::SBType
109    GetDereferencedType();
110
111    lldb::SBType
112    GetUnqualifiedType();
113
114    lldb::SBType
115    GetCanonicalType();
116    // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
117    // type eBasicTypeInvalid will be returned
118    lldb::BasicType
119    GetBasicType();
120
121    // The call below confusing and should really be renamed to "CreateBasicType"
122    lldb::SBType
123    GetBasicType(lldb::BasicType type);
124
125    uint32_t
126    GetNumberOfFields ();
127
128    uint32_t
129    GetNumberOfDirectBaseClasses ();
130
131    uint32_t
132    GetNumberOfVirtualBaseClasses ();
133
134    lldb::SBTypeMember
135    GetFieldAtIndex (uint32_t idx);
136
137    lldb::SBTypeMember
138    GetDirectBaseClassAtIndex (uint32_t idx);
139
140    lldb::SBTypeMember
141    GetVirtualBaseClassAtIndex (uint32_t idx);
142
143    uint32_t
144    GetNumberOfTemplateArguments ();
145
146    lldb::SBType
147    GetTemplateArgumentType (uint32_t idx);
148
149    lldb::TemplateArgumentKind
150    GetTemplateArgumentKind (uint32_t idx);
151
152    lldb::SBType
153    GetFunctionReturnType ();
154
155    lldb::SBTypeList
156    GetFunctionArgumentTypes ();
157
158    const char*
159    GetName();
160
161    lldb::TypeClass
162    GetTypeClass ();
163
164    bool
165    IsTypeComplete ();
166
167    bool
168    GetDescription (lldb::SBStream &description,
169                    lldb::DescriptionLevel description_level);
170
171    lldb::SBType &
172    operator = (const lldb::SBType &rhs);
173
174    bool
175    operator == (lldb::SBType &rhs);
176
177    bool
178    operator != (lldb::SBType &rhs);
179
180protected:
181
182    lldb_private::TypeImpl &
183    ref ();
184
185    const lldb_private::TypeImpl &
186    ref () const;
187
188    lldb::TypeImplSP
189    GetSP ();
190
191    void
192    SetSP (const lldb::TypeImplSP &type_impl_sp);
193
194    lldb::TypeImplSP m_opaque_sp;
195
196    friend class SBFunction;
197    friend class SBModule;
198    friend class SBTarget;
199    friend class SBTypeNameSpecifier;
200    friend class SBTypeMember;
201    friend class SBTypeList;
202    friend class SBValue;
203
204    SBType (const lldb_private::ClangASTType &);
205    SBType (const lldb::TypeSP &);
206    SBType (const lldb::TypeImplSP &);
207
208};
209
210class SBTypeList
211{
212public:
213    SBTypeList();
214
215    SBTypeList(const lldb::SBTypeList& rhs);
216
217    ~SBTypeList();
218
219    lldb::SBTypeList&
220    operator = (const lldb::SBTypeList& rhs);
221
222    bool
223    IsValid();
224
225    void
226    Append (lldb::SBType type);
227
228    lldb::SBType
229    GetTypeAtIndex (uint32_t index);
230
231    uint32_t
232    GetSize();
233
234
235private:
236    std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
237    friend class SBModule;
238    friend class SBCompileUnit;
239};
240
241
242} // namespace lldb
243
244#endif // LLDB_SBType_h_
245