xref: /trueos/contrib/llvm/tools/lldb/include/lldb/API/SBType.h (revision fa88ea9f26d1e5430901a9ca6c47daebcc5af5de)
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 
15 namespace lldb {
16 
17 class SBTypeList;
18 
19 class SBTypeMember
20 {
21 public:
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 
56 protected:
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 
71 class SBType
72 {
73 public:
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     GetTypedefedType();
110 
111     lldb::SBType
112     GetDereferencedType();
113 
114     lldb::SBType
115     GetUnqualifiedType();
116 
117     lldb::SBType
118     GetCanonicalType();
119     // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
120     // type eBasicTypeInvalid will be returned
121     lldb::BasicType
122     GetBasicType();
123 
124     // The call below confusing and should really be renamed to "CreateBasicType"
125     lldb::SBType
126     GetBasicType(lldb::BasicType type);
127 
128     uint32_t
129     GetNumberOfFields ();
130 
131     uint32_t
132     GetNumberOfDirectBaseClasses ();
133 
134     uint32_t
135     GetNumberOfVirtualBaseClasses ();
136 
137     lldb::SBTypeMember
138     GetFieldAtIndex (uint32_t idx);
139 
140     lldb::SBTypeMember
141     GetDirectBaseClassAtIndex (uint32_t idx);
142 
143     lldb::SBTypeMember
144     GetVirtualBaseClassAtIndex (uint32_t idx);
145 
146     uint32_t
147     GetNumberOfTemplateArguments ();
148 
149     lldb::SBType
150     GetTemplateArgumentType (uint32_t idx);
151 
152     lldb::TemplateArgumentKind
153     GetTemplateArgumentKind (uint32_t idx);
154 
155     lldb::SBType
156     GetFunctionReturnType ();
157 
158     lldb::SBTypeList
159     GetFunctionArgumentTypes ();
160 
161     const char*
162     GetName();
163 
164     lldb::TypeClass
165     GetTypeClass ();
166 
167     bool
168     IsTypeComplete ();
169 
170     bool
171     GetDescription (lldb::SBStream &description,
172                     lldb::DescriptionLevel description_level);
173 
174     lldb::SBType &
175     operator = (const lldb::SBType &rhs);
176 
177     bool
178     operator == (lldb::SBType &rhs);
179 
180     bool
181     operator != (lldb::SBType &rhs);
182 
183 protected:
184 
185     lldb_private::TypeImpl &
186     ref ();
187 
188     const lldb_private::TypeImpl &
189     ref () const;
190 
191     lldb::TypeImplSP
192     GetSP ();
193 
194     void
195     SetSP (const lldb::TypeImplSP &type_impl_sp);
196 
197     lldb::TypeImplSP m_opaque_sp;
198 
199     friend class SBFunction;
200     friend class SBModule;
201     friend class SBTarget;
202     friend class SBTypeNameSpecifier;
203     friend class SBTypeMember;
204     friend class SBTypeList;
205     friend class SBValue;
206 
207     SBType (const lldb_private::ClangASTType &);
208     SBType (const lldb::TypeSP &);
209     SBType (const lldb::TypeImplSP &);
210 
211 };
212 
213 class SBTypeList
214 {
215 public:
216     SBTypeList();
217 
218     SBTypeList(const lldb::SBTypeList& rhs);
219 
220     ~SBTypeList();
221 
222     lldb::SBTypeList&
223     operator = (const lldb::SBTypeList& rhs);
224 
225     bool
226     IsValid();
227 
228     void
229     Append (lldb::SBType type);
230 
231     lldb::SBType
232     GetTypeAtIndex (uint32_t index);
233 
234     uint32_t
235     GetSize();
236 
237 
238 private:
239     std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
240     friend class SBModule;
241     friend class SBCompileUnit;
242 };
243 
244 
245 } // namespace lldb
246 
247 #endif // LLDB_SBType_h_
248