LLDB mainline
CompilerType.h
Go to the documentation of this file.
1//===-- CompilerType.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_SYMBOL_COMPILERTYPE_H
10#define LLDB_SYMBOL_COMPILERTYPE_H
11
12#include <functional>
13#include <optional>
14#include <string>
15#include <vector>
16
17#include "lldb/Utility/Scalar.h"
18#include "lldb/lldb-private.h"
19#include "llvm/ADT/APSInt.h"
20#include "llvm/Support/Casting.h"
21
22namespace lldb_private {
23
24class DataExtractor;
25class TypeSystem;
26
27/// Generic representation of a type in a programming language.
28///
29/// This class serves as an abstraction for a type inside one of the TypeSystems
30/// implemented by the language plugins. It does not have any actual logic in it
31/// but only stores an opaque pointer and a pointer to the TypeSystem that
32/// gives meaning to this opaque pointer. All methods of this class should call
33/// their respective method in the TypeSystem interface and pass the opaque
34/// pointer along.
35///
36/// \see lldb_private::TypeSystem
38public:
39 /// Creates a CompilerType with the given TypeSystem and opaque compiler type.
40 ///
41 /// This constructor should only be called from the respective TypeSystem
42 /// implementation.
43 ///
44 /// \see lldb_private::TypeSystemClang::GetType(clang::QualType)
47
48 /// This is a minimal wrapper of a TypeSystem shared pointer as
49 /// returned by CompilerType which conventien dyn_cast support.
52
53 public:
56 : m_typesystem_sp(typesystem_sp) {}
57
58 template <class TypeSystemType> bool isa_and_nonnull() {
59 if (auto *ts = m_typesystem_sp.get())
60 return llvm::isa<TypeSystemType>(ts);
61 return false;
62 }
63
64 /// Return a shared_ptr<TypeSystemType> if dyn_cast succeeds.
65 template <class TypeSystemType>
66 std::shared_ptr<TypeSystemType> dyn_cast_or_null() {
68 return std::shared_ptr<TypeSystemType>(
69 m_typesystem_sp, llvm::cast<TypeSystemType>(m_typesystem_sp.get()));
70 return nullptr;
71 }
72
73 explicit operator bool() const {
74 return static_cast<bool>(m_typesystem_sp);
75 }
76 bool operator==(const TypeSystemSPWrapper &other) const;
77 bool operator!=(const TypeSystemSPWrapper &other) const {
78 return !(*this == other);
79 }
80
81 /// Only to be used in a one-off situations like
82 /// if (typesystem && typesystem->method())
83 /// Do not store this pointer!
84 TypeSystem *operator->() const;
85
87 };
88
89 CompilerType(TypeSystemSPWrapper type_system,
91
94
95 CompilerType() = default;
96
97 /// Operators.
98 /// \{
99 const CompilerType &operator=(const CompilerType &rhs) {
101 m_type = rhs.m_type;
102 return *this;
103 }
104
105 bool operator<(const CompilerType &rhs) const {
106 auto lts = m_type_system.lock();
107 auto rts = rhs.m_type_system.lock();
108 if (lts.get() == rts.get())
109 return m_type < rhs.m_type;
110 return lts.get() < rts.get();
111 }
112 /// \}
113
114 /// Tests.
115 /// \{
116 explicit operator bool() const {
117 return m_type_system.lock() && m_type;
118 }
119
120 bool IsValid() const { return (bool)*this; }
121
122 bool IsArrayType(CompilerType *element_type = nullptr,
123 uint64_t *size = nullptr,
124 bool *is_incomplete = nullptr) const;
125
126 bool IsVectorType(CompilerType *element_type = nullptr,
127 uint64_t *size = nullptr) const;
128
129 bool IsArrayOfScalarType() const;
130
131 bool IsAggregateType() const;
132
133 bool IsAnonymousType() const;
134
135 bool IsScopedEnumerationType() const;
136
137 bool IsBeingDefined() const;
138
139 bool IsCharType() const;
140
141 bool IsCompleteType() const;
142
143 bool IsConst() const;
144
145 bool IsDefined() const;
146
147 bool IsComplexType() const;
148
149 /// Returns \c true for floating point types (including complex floats).
150 bool IsFloatingPointType() const;
151
152 /// Returns \c true for non-complex float types.
153 bool IsRealFloatingPointType() const;
154
155 bool IsFunctionType() const;
156
157 uint32_t IsHomogeneousAggregate(CompilerType *base_type_ptr) const;
158
159 size_t GetNumberOfFunctionArguments() const;
160
161 CompilerType GetFunctionArgumentAtIndex(const size_t index) const;
162
164
165 bool IsFunctionPointerType() const;
166
167 bool IsMemberFunctionPointerType() const;
168
169 bool IsMemberDataPointerType() const;
170
171 bool
172 IsBlockPointerType(CompilerType *function_pointer_type_ptr = nullptr) const;
173
174 bool IsIntegerType(bool &is_signed) const;
175
176 bool IsEnumerationType(bool &is_signed) const;
177
178 bool IsIntegerOrEnumerationType(bool &is_signed) const;
179
180 bool IsPolymorphicClass() const;
181
182 /// \param target_type Can pass nullptr.
183 bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus,
184 bool check_objc) const;
185
186 bool IsPointerToScalarType() const;
187
188 bool IsRuntimeGeneratedType() const;
189
190 bool IsPointerType(CompilerType *pointee_type = nullptr) const;
191
192 bool IsPointerOrReferenceType(CompilerType *pointee_type = nullptr) const;
193
194 bool IsReferenceType(CompilerType *pointee_type = nullptr,
195 bool *is_rvalue = nullptr) const;
196
198
199 bool IsScalarType() const;
200
201 bool IsTemplateType() const;
202
203 bool IsTypedefType() const;
204
205 bool IsVoidType() const;
206
207 bool HasPointerAuthQualifier() const;
208
209 std::optional<uint32_t> GetTargetAddressSpace() const;
210
211 /// This is used when you don't care about the signedness of the integer.
212 bool IsInteger() const;
213
214 /// This is used when you don't care about the signedness of the enum.
215 bool IsEnumerationType() const;
216
217 bool IsUnscopedEnumerationType() const;
218
220
221 bool IsSigned() const;
222
223 bool IsNullPtrType() const;
224
225 bool IsBoolean() const;
226
228
230
231 /// Checks if the type is eligible for integral promotion.
232 /// \see GetPromotedIntegerType
233 bool IsPromotableIntegerType() const;
234
235 bool IsPointerToVoid() const;
236
237 bool IsRecordType() const;
238
239 //// Checks whether `target_base` is a virtual base of `type` (direct or
240 /// indirect). If it is, stores the first virtual base type on the path from
241 /// `type` to `target_type`. Parameter "virtual_base" is where the first
242 /// virtual base type gets stored. Parameter "carry_virtual" is used to
243 /// denote that we're in a recursive check of virtual base classes and we
244 /// have already seen a virtual base class (so should only check direct
245 /// base classes).
246 /// Note: This may only be defined in TypeSystemClang.
247 bool IsVirtualBase(CompilerType target_base, CompilerType *virtual_base,
248 bool carry_virtual = false) const;
249
250 /// This may only be defined in TypeSystemClang.
252
253 bool IsBasicType() const;
254
255 std::string TypeDescription();
256
257 bool CompareTypes(CompilerType rhs) const;
258
259 const char *GetTypeTag();
260
261 /// Go through the base classes and count non-empty ones.
263
264 /// \}
265
266 /// Type Completion.
267 /// \{
268 bool GetCompleteType() const;
269 /// \}
270
271 bool IsForcefullyCompleted() const;
272
273 /// AST related queries.
274 /// \{
275 size_t GetPointerByteSize() const;
276 /// \}
277
278 unsigned GetPtrAuthKey() const;
279
280 unsigned GetPtrAuthDiscriminator() const;
281
282 bool GetPtrAuthAddressDiversity() const;
283
284 /// Accessors.
285 /// \{
286
287 /// Returns a shared pointer to the type system. The
288 /// TypeSystem::TypeSystemSPWrapper can be compared for equality.
290
291 template <typename TypeSystemType>
292 std::shared_ptr<TypeSystemType> GetTypeSystem() const {
293 return GetTypeSystem().dyn_cast_or_null<TypeSystemType>();
294 }
295
296 ConstString GetTypeName(bool BaseOnly = false) const;
297
299
301
302 uint32_t
303 GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr) const;
304
306
308
309 lldb::TypeClass GetTypeClass() const;
310
311 void SetCompilerType(lldb::TypeSystemWP type_system,
313 void SetCompilerType(TypeSystemSPWrapper type_system,
315
316 unsigned GetTypeQualifiers() const;
317 /// \}
318
319 /// Creating related types.
320 /// \{
322
323 CompilerType GetArrayType(uint64_t size) const;
324
326
328
330
331 /// Returns -1 if this isn't a function of if the function doesn't
332 /// have a prototype Returns a value >= 0 if there is a prototype.
333 int GetFunctionArgumentCount() const;
334
336
338
339 size_t GetNumMemberFunctions() const;
340
342
343 /// If this type is a reference to a type (L value or R value reference),
344 /// return a new type with the reference removed, else return the current type
345 /// itself.
347
348 /// If this type is a pointer type, return the type that the pointer points
349 /// to, else return an invalid type.
351
352 /// Return a new CompilerType that is a pointer to this type
354
355 /// Return a new CompilerType that is a L value reference to this type if this
356 /// type is valid and the type system supports L value references, else return
357 /// an invalid type.
359
360 /// Return a new CompilerType that is a R value reference to this type if this
361 /// type is valid and the type system supports R value references, else return
362 /// an invalid type.
364
365 /// Return a new CompilerType adds a const modifier to this type if this type
366 /// is valid and the type system supports const modifiers, else return an
367 /// invalid type.
369
370 /// Return a new CompilerType adds a volatile modifier to this type if this
371 /// type is valid and the type system supports volatile modifiers, else return
372 /// an invalid type.
374
375 /// Return a new CompilerType that is the atomic type of this type. If this
376 /// type is not valid or the type system doesn't support atomic types, this
377 /// returns an invalid type.
379
380 /// Return a new CompilerType adds a restrict modifier to this type if this
381 /// type is valid and the type system supports restrict modifiers, else return
382 /// an invalid type.
384
385 /// Create a typedef to this type using "name" as the name of the typedef this
386 /// type is valid and the type system supports typedefs, else return an
387 /// invalid type.
388 /// \param payload The typesystem-specific \p lldb::Type payload.
389 CompilerType CreateTypedef(const char *name,
390 const CompilerDeclContext &decl_ctx,
391 uint32_t payload) const;
392
393 /// If the current object represents a typedef type, get the underlying type
395
396 /// Create related types using the current type's AST
398
399 /// Return a new CompilerType adds a ptrauth modifier from the given 32-bit
400 /// opaque payload to this type if this type is valid and the type system
401 /// supports ptrauth modifiers, else return an invalid type. Note that this
402 /// does not check if this type is a pointer.
403 CompilerType AddPtrAuthModifier(uint32_t payload) const;
404
405 /// Return a new CompilerType that qualifies this type with the given target
406 /// address space if this type is valid and the type system supports target
407 /// address spaces.
408 CompilerType AddAddressSpaceModifier(uint32_t address_space) const;
409 /// \}
410
411 /// Exploring the type.
412 /// \{
413 struct IntegralTemplateArgument;
414
415 /// Return the size of the type in bytes.
416 llvm::Expected<uint64_t> GetByteSize(ExecutionContextScope *exe_scope) const;
417 /// Return the size of the type in bits.
418 llvm::Expected<uint64_t> GetBitSize(ExecutionContextScope *exe_scope) const;
419
421
422 lldb::Format GetFormat() const;
423
424 std::optional<size_t> GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
425
426 llvm::Expected<uint32_t>
427 GetNumChildren(bool omit_empty_base_classes,
428 const ExecutionContext *exe_ctx) const;
429
431
432 /// If this type is an enumeration, iterate through all of its enumerators
433 /// using a callback. If the callback returns true, keep iterating, else abort
434 /// the iteration.
436 std::function<bool(const CompilerType &integer_type, ConstString name,
437 const llvm::APSInt &value)> const &callback) const;
438
439 uint32_t GetNumFields() const;
440
441 CompilerType GetFieldAtIndex(size_t idx, std::string &name,
442 uint64_t *bit_offset_ptr,
443 uint32_t *bitfield_bit_size_ptr,
444 bool *is_bitfield_ptr) const;
445
446 uint32_t GetNumDirectBaseClasses() const;
447
448 uint32_t GetNumVirtualBaseClasses() const;
449
451 uint32_t *bit_offset_ptr) const;
452
454 uint32_t *bit_offset_ptr) const;
455
456 CompilerDecl GetStaticFieldWithName(llvm::StringRef name) const;
457
458 llvm::Expected<CompilerType>
459 GetDereferencedType(ExecutionContext *exe_ctx, std::string &deref_name,
460 uint32_t &deref_byte_size, int32_t &deref_byte_offset,
461 ValueObject *valobj, uint64_t &language_flags) const;
462
463 llvm::Expected<CompilerType> GetChildCompilerTypeAtIndex(
464 ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers,
465 bool omit_empty_base_classes, bool ignore_array_bounds,
466 std::string &child_name, uint32_t &child_byte_size,
467 int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size,
468 uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
469 bool &child_is_deref_of_parent, ValueObject *valobj,
470 uint64_t &language_flags) const;
471
472 /// Lookup a child given a name. This function will match base class names and
473 /// member member names in "clang_type" only, not descendants.
474 llvm::Expected<uint32_t>
475 GetIndexOfChildWithName(llvm::StringRef name,
476 bool omit_empty_base_classes) const;
477
478 /// Lookup a child member given a name. This function will match member names
479 /// only and will descend into "clang_type" children in search for the first
480 /// member in this class, or any base class that matches "name".
481 ///
482 /// \param child_indexes returns an index path for the result.
483 /// \returns 0 if unsuccessful, otherwise the length of the index path.
484 ///
485 /// TODO: Return all matches for a given name by returning a
486 /// vector<vector<uint32_t>> so we catch all names that match a
487 /// given child name, not just the first.
488 size_t
489 GetIndexOfChildMemberWithName(llvm::StringRef name,
490 bool omit_empty_base_classes,
491 std::vector<uint32_t> &child_indexes) const;
492
493 CompilerType GetDirectNestedTypeWithName(llvm::StringRef name) const;
494
495 /// Return the number of template arguments the type has.
496 /// If expand_pack is true, then variadic argument packs are automatically
497 /// expanded to their supplied arguments. If it is false an argument pack
498 /// will only count as 1 argument.
499 size_t GetNumTemplateArguments(bool expand_pack = false) const;
500
501 // Return the TemplateArgumentKind of the template argument at index idx.
502 // If expand_pack is true, then variadic argument packs are automatically
503 // expanded to their supplied arguments. With expand_pack set to false, an
504 // arguement pack will count as 1 argument and return a type of Pack.
506 GetTemplateArgumentKind(size_t idx, bool expand_pack = false) const;
508 bool expand_pack = false) const;
509
510 /// Returns the value of the template argument and its type.
511 /// If expand_pack is true, then variadic argument packs are automatically
512 /// expanded to their supplied arguments. With expand_pack set to false, an
513 /// arguement pack will count as 1 argument and it is invalid to call this
514 /// method on the pack argument.
515 std::optional<IntegralTemplateArgument>
516 GetIntegralTemplateArgument(size_t idx, bool expand_pack = false) const;
517
519
520 /// If the type is promotable, returns the type promoted to a larger
521 /// integer type according to the type system rules.
522 /// \see IsPromotableIntegerType
524
526
528 /// \}
529
530 /// Dumping types.
531 /// \{
532#ifndef NDEBUG
533 /// Convenience LLVM-style dump method for use in the debugger only.
534 /// Don't call this function from actual code.
535 LLVM_DUMP_METHOD void dump() const;
536#endif
537
538 bool DumpTypeValue(Stream *s, lldb::Format format, const DataExtractor &data,
539 lldb::offset_t data_offset, size_t data_byte_size,
540 uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
541 ExecutionContextScope *exe_scope);
542
543 /// Dump to stdout.
546
547 /// Print a description of the type to a stream. The exact implementation
548 /// varies, but the expectation is that eDescriptionLevelFull returns a
549 /// source-like representation of the type, whereas eDescriptionLevelVerbose
550 /// does a dump of the underlying AST if applicable.
553 /// \}
554
555 bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset,
556 size_t data_byte_size, Scalar &value,
557 ExecutionContextScope *exe_scope) const;
558 void Clear() {
559 m_type_system = {};
560 m_type = nullptr;
561 }
562
563private:
564#ifndef NDEBUG
565 /// If the type is valid, ask the TypeSystem to verify the integrity
566 /// of the type to catch CompilerTypes that mix and match invalid
567 /// TypeSystem/Opaque type pairs.
568 bool Verify() const;
569#endif
570
573};
574
575bool operator==(const CompilerType &lhs, const CompilerType &rhs);
576bool operator!=(const CompilerType &lhs, const CompilerType &rhs);
577
582
583} // namespace lldb_private
584
585#endif // LLDB_SYMBOL_COMPILERTYPE_H
Represents a generic declaration context in a program.
Represents a generic declaration such as a function declaration.
This is a minimal wrapper of a TypeSystem shared pointer as returned by CompilerType which conventien...
bool operator!=(const TypeSystemSPWrapper &other) const
bool operator==(const TypeSystemSPWrapper &other) const
std::shared_ptr< TypeSystemType > dyn_cast_or_null()
Return a shared_ptr<TypeSystemType> if dyn_cast succeeds.
TypeSystem * operator->() const
Only to be used in a one-off situations like if (typesystem && typesystem->method()) Do not store thi...
TypeSystemSPWrapper(lldb::TypeSystemSP typesystem_sp)
Generic representation of a type in a programming language.
uint32_t GetNumberOfNonEmptyBaseClasses()
Go through the base classes and count non-empty ones.
CompilerType GetTypeForFormatters() const
CompilerType GetTypeTemplateArgument(size_t idx, bool expand_pack=false) const
lldb::LanguageType GetMinimumLanguage()
bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, Scalar &value, ExecutionContextScope *exe_scope) const
bool Verify() const
If the type is valid, ask the TypeSystem to verify the integrity of the type to catch CompilerTypes t...
lldb::BasicType GetBasicTypeEnumeration() const
std::optional< IntegralTemplateArgument > GetIntegralTemplateArgument(size_t idx, bool expand_pack=false) const
Returns the value of the template argument and its type.
TypeSystemSPWrapper GetTypeSystem() const
Accessors.
CompilerType GetArrayType(uint64_t size) const
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const
Create related types using the current type's AST.
bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus, bool check_objc) const
void SetCompilerType(lldb::TypeSystemWP type_system, lldb::opaque_compiler_type_t type)
CompilerType AddConstModifier() const
Return a new CompilerType adds a const modifier to this type if this type is valid and the type syste...
bool IsArrayType(CompilerType *element_type=nullptr, uint64_t *size=nullptr, bool *is_incomplete=nullptr) const
ConstString GetDisplayTypeName() const
CompilerType GetVirtualBaseClassAtIndex(size_t idx, uint32_t *bit_offset_ptr) const
size_t GetNumMemberFunctions() const
CompilerType GetFunctionArgumentTypeAtIndex(size_t idx) const
uint32_t IsHomogeneousAggregate(CompilerType *base_type_ptr) const
CompilerType GetFieldAtIndex(size_t idx, std::string &name, uint64_t *bit_offset_ptr, uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) const
CompilerType GetRValueReferenceType() const
Return a new CompilerType that is a R value reference to this type if this type is valid and the type...
bool IsIntegerOrUnscopedEnumerationType() const
size_t GetIndexOfChildMemberWithName(llvm::StringRef name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes) const
Lookup a child member given a name.
bool IsScalarOrUnscopedEnumerationType() const
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
bool IsContextuallyConvertibleToBool() const
This may only be defined in TypeSystemClang.
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
CompilerDecl GetStaticFieldWithName(llvm::StringRef name) const
lldb::TypeClass GetTypeClass() const
lldb::opaque_compiler_type_t GetOpaqueQualType() const
size_t GetNumTemplateArguments(bool expand_pack=false) const
Return the number of template arguments the type has.
CompilerType AddVolatileModifier() const
Return a new CompilerType adds a volatile modifier to this type if this type is valid and the type sy...
bool IsVirtualBase(CompilerType target_base, CompilerType *virtual_base, bool carry_virtual=false) const
Checks whether target_base is a virtual base of type (direct or indirect).
CompilerType AddRestrictModifier() const
Return a new CompilerType adds a restrict modifier to this type if this type is valid and the type sy...
lldb::TypeSystemWP m_type_system
CompilerType GetDirectNestedTypeWithName(llvm::StringRef name) const
bool GetPtrAuthAddressDiversity() const
uint32_t GetNumVirtualBaseClasses() const
lldb::Encoding GetEncoding() const
size_t GetPointerByteSize() const
AST related queries.
CompilerType GetFunctionArgumentAtIndex(const size_t index) const
CompilerType(const CompilerType &rhs)
void ForEachEnumerator(std::function< bool(const CompilerType &integer_type, ConstString name, const llvm::APSInt &value)> const &callback) const
If this type is an enumeration, iterate through all of its enumerators using a callback.
LLVM_DUMP_METHOD void dump() const
Dumping types.
CompilerType GetLValueReferenceType() const
Return a new CompilerType that is a L value reference to this type if this type is valid and the type...
uint32_t GetNumFields() const
bool IsPromotableIntegerType() const
Checks if the type is eligible for integral promotion.
size_t GetNumberOfFunctionArguments() const
bool IsVariadicFunctionType() const
bool IsIntegerOrEnumerationType(bool &is_signed) const
bool IsScopedEnumerationType() const
bool ShouldTreatScalarValueAsAddress() const
CompilerType GetNonReferenceType() const
If this type is a reference to a type (L value or R value reference), return a new type with the refe...
uint32_t GetNumDirectBaseClasses() const
bool IsMeaninglessWithoutDynamicResolution() const
bool IsBlockPointerType(CompilerType *function_pointer_type_ptr=nullptr) const
ConstString GetTypeName(bool BaseOnly=false) const
bool IsEnumerationIntegerTypeSigned() const
CompilerType GetTypedefedType() const
If the current object represents a typedef type, get the underlying type.
bool IsReferenceType(CompilerType *pointee_type=nullptr, bool *is_rvalue=nullptr) const
bool DumpTypeValue(Stream *s, lldb::Format format, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, ExecutionContextScope *exe_scope)
CompilerType GetArrayElementType(ExecutionContextScope *exe_scope) const
Creating related types.
bool IsInteger() const
This is used when you don't care about the signedness of the integer.
CompilerType AddAddressSpaceModifier(uint32_t address_space) const
Return a new CompilerType that qualifies this type with the given target address space if this type i...
llvm::Expected< CompilerType > GetDereferencedType(ExecutionContext *exe_ctx, std::string &deref_name, uint32_t &deref_byte_size, int32_t &deref_byte_offset, ValueObject *valobj, uint64_t &language_flags) const
bool operator<(const CompilerType &rhs) const
lldb::Format GetFormat() const
CompilerType GetFullyUnqualifiedType() const
ConstString GetMangledTypeName() const
unsigned GetTypeQualifiers() const
llvm::Expected< CompilerType > GetChildCompilerTypeAtIndex(ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers, bool omit_empty_base_classes, bool ignore_array_bounds, std::string &child_name, uint32_t &child_byte_size, int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset, bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) const
CompilerType GetDirectBaseClassAtIndex(size_t idx, uint32_t *bit_offset_ptr) const
std::optional< size_t > GetTypeBitAlign(ExecutionContextScope *exe_scope) const
CompilerType GetPointeeType() const
If this type is a pointer type, return the type that the pointer points to, else return an invalid ty...
bool IsIntegerType(bool &is_signed) const
bool GetCompleteType() const
Type Completion.
bool IsUnscopedEnumerationType() const
bool IsFloatingPointType() const
Returns true for floating point types (including complex floats).
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
std::optional< uint32_t > GetTargetAddressSpace() const
int GetFunctionArgumentCount() const
Returns -1 if this isn't a function of if the function doesn't have a prototype Returns a value >= 0 ...
llvm::Expected< uint32_t > GetIndexOfChildWithName(llvm::StringRef name, bool omit_empty_base_classes) const
Lookup a child given a name.
unsigned GetPtrAuthDiscriminator() const
bool IsRealFloatingPointType() const
Returns true for non-complex float types.
llvm::Expected< uint32_t > GetNumChildren(bool omit_empty_base_classes, const ExecutionContext *exe_ctx) const
CompilerType GetEnumerationIntegerType() const
const CompilerType & operator=(const CompilerType &rhs)
Operators.
lldb::opaque_compiler_type_t m_type
bool CompareTypes(CompilerType rhs) const
llvm::Expected< uint64_t > GetBitSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bits.
std::shared_ptr< TypeSystemType > GetTypeSystem() const
bool IsEnumerationType() const
This is used when you don't care about the signedness of the enum.
unsigned GetPtrAuthKey() const
CompilerType GetPromotedIntegerType() const
If the type is promotable, returns the type promoted to a larger integer type according to the type s...
CompilerType CreateTypedef(const char *name, const CompilerDeclContext &decl_ctx, uint32_t payload) const
Create a typedef to this type using "name" as the name of the typedef this type is valid and the type...
CompilerType GetFunctionReturnType() const
bool IsVectorType(CompilerType *element_type=nullptr, uint64_t *size=nullptr) const
bool IsMemberFunctionPointerType() const
CompilerType GetAtomicType() const
Return a new CompilerType that is the atomic type of this type.
CompilerType GetCanonicalType() const
void DumpTypeDescription(lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) const
Dump to stdout.
bool IsRuntimeGeneratedType() const
lldb::TemplateArgumentKind GetTemplateArgumentKind(size_t idx, bool expand_pack=false) const
LazyBool ShouldPrintAsOneLiner(ValueObject *valobj) const
TypeMemberFunctionImpl GetMemberFunctionAtIndex(size_t idx)
bool IsPointerOrReferenceType(CompilerType *pointee_type=nullptr) const
CompilerType(lldb::TypeSystemWP type_system, lldb::opaque_compiler_type_t type)
Creates a CompilerType with the given TypeSystem and opaque compiler type.
bool IsPointerType(CompilerType *pointee_type=nullptr) const
CompilerType AddPtrAuthModifier(uint32_t payload) const
Return a new CompilerType adds a ptrauth modifier from the given 32-bit opaque payload to this type i...
A uniqued constant string class.
Definition ConstString.h:40
An data extractor class.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A stream class that can stream formatted output to a file.
Definition Stream.h:28
Interface for representing a type system.
Definition TypeSystem.h:72
A class that represents a running process on the host machine.
bool operator!=(const Address &lhs, const Address &rhs)
Definition Address.cpp:1011
bool operator==(const Address &lhs, const Address &rhs)
Definition Address.cpp:1005
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
void * opaque_compiler_type_t
Definition lldb-types.h:91
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelFull
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Format
Display format definitions.
uint64_t offset_t
Definition lldb-types.h:86
LanguageType
Programming language type.
Encoding
Register encoding definitions.
std::weak_ptr< lldb_private::TypeSystem > TypeSystemWP