27#include "llvm/ADT/APSInt.h"
28#include "llvm/Support/MathExtras.h"
41 : m_opaque_sp(new
TypeImpl(type_sp)) {}
44 : m_opaque_sp(type_impl_sp) {}
115 return this->
operator bool();
117SBType::operator bool()
const {
120 if (m_opaque_sp.get() ==
nullptr)
123 return m_opaque_sp->IsValid();
130 if (std::optional<uint64_t> size =
131 m_opaque_sp->GetCompilerType(
false).GetByteSize(
nullptr))
142 std::optional<uint64_t> bit_align =
144 .GetTypeBitAlign(
nullptr);
145 return llvm::divideCeil(bit_align.value_or(0), 8);
153 return m_opaque_sp->GetCompilerType(
true).IsPointerType();
161 return m_opaque_sp->GetCompilerType(
true).IsArrayType(
nullptr,
nullptr,
170 return m_opaque_sp->GetCompilerType(
true).IsVectorType(
nullptr,
nullptr);
178 return m_opaque_sp->GetCompilerType(
true).IsReferenceType();
228 m_opaque_sp->GetCompilerType(
true).GetArrayElementType(
nullptr))));
246 if (
m_opaque_sp->GetCompilerType(
true).IsVectorType(&vector_element_type,
258 return m_opaque_sp->GetCompilerType(
true).IsFunctionType();
266 return m_opaque_sp->GetCompilerType(
true).IsPolymorphicClass();
274 return m_opaque_sp->GetCompilerType(
true).IsTypedefType();
282 return m_opaque_sp->GetCompilerType(
true).IsAnonymousType();
290 return m_opaque_sp->GetCompilerType(
true).IsScopedEnumerationType();
298 return m_opaque_sp->GetCompilerType(
true).IsAggregateType();
306 m_opaque_sp->GetCompilerType(
true).GetFunctionReturnType());
308 return SBType(return_type);
320 for (
size_t i = 0; i < count; i++) {
331 return m_opaque_sp->GetCompilerType(
true).GetNumMemberFunctions();
342 m_opaque_sp->GetCompilerType(
true).GetMemberFunctionAtIndex(idx)));
349 : m_opaque_up(decl ? std::make_unique<
CompilerDecl>(decl) : nullptr) {}
366SBTypeStaticField::operator bool()
const {
416 return SBValue(std::move(value_obj_sp));
440 m_opaque_sp->GetCompilerType(
true).GetEnumerationIntegerType());
449 return m_opaque_sp->GetCompilerType(
false).GetBasicTypeEnumeration();
458 return SBType(ts->GetBasicTypeFromAST(basic_type));
466 return m_opaque_sp->GetCompilerType(
true).GetNumDirectBaseClasses();
474 return m_opaque_sp->GetCompilerType(
true).GetNumVirtualBaseClasses();
482 return m_opaque_sp->GetCompilerType(
true).GetNumFields();
493 m_opaque_sp->GetDescription(strm, description_level);
505 uint32_t bit_offset = 0;
507 m_opaque_sp->GetCompilerType(
true).GetDirectBaseClassAtIndex(
513 return sb_type_member;
521 uint32_t bit_offset = 0;
523 m_opaque_sp->GetCompilerType(
true).GetVirtualBaseClassAtIndex(
529 return sb_type_member;
539 .GetStaticFieldWithName(name));
552 const llvm::APSInt &value) ->
bool {
556 sb_enum_member_list.
Append(enum_member);
561 return sb_enum_member_list;
571 uint64_t bit_offset = 0;
572 uint32_t bitfield_bit_size = 0;
573 bool is_bitfield =
false;
574 std::string name_sstr;
576 idx, name_sstr, &bit_offset, &bitfield_bit_size, &is_bitfield));
579 if (!name_sstr.empty())
581 sb_type_member.
reset(
583 name, bitfield_bit_size, is_bitfield));
587 return sb_type_member;
608 return m_opaque_sp->GetCompilerType(
true).GetTypeInfo();
635 return m_opaque_sp->GetDisplayTypeName().GetCString();
642 return m_opaque_sp->GetCompilerType(
true).GetTypeClass();
643 return lldb::eTypeClassInvalid;
650 return m_opaque_sp->GetCompilerType(
false).GetNumTemplateArguments(
662 const bool expand_pack =
true;
665 type =
m_opaque_sp->GetCompilerType(
false).GetTypeTemplateArgument(
670 .GetIntegralTemplateArgument(idx, expand_pack)
685 return m_opaque_sp->GetCompilerType(
false).GetTemplateArgumentKind(
713 return this->
operator bool();
715SBTypeList::operator bool()
const {
718 return (m_opaque_up !=
nullptr);
781 return this->
operator bool();
783SBTypeMember::operator bool()
const {
786 return m_opaque_up.get();
846 const uint32_t bit_offset =
m_opaque_up->GetBitOffset();
847 const uint32_t byte_offset = bit_offset / 8u;
848 const uint32_t byte_bit_offset = bit_offset % 8u;
849 const char *name =
m_opaque_up->GetName().GetCString();
851 strm.
Printf(
"+%u + %u bits: (", byte_offset, byte_bit_offset);
853 strm.
Printf(
"+%u: (", byte_offset);
857 type_impl_sp->GetDescription(strm, description_level);
859 strm.
Printf(
") %s", name);
861 const uint32_t bitfield_bit_size =
m_opaque_up->GetBitfieldBitSize();
862 strm.
Printf(
" : %u", bitfield_bit_size);
887 : m_opaque_sp(rhs.m_opaque_sp) {
902 return this->
operator bool();
904SBTypeMemberFunction::operator bool()
const {
907 return m_opaque_sp.get();
1005 m_opaque_sp = std::make_shared<TypeMemberFunctionImpl>();
#define LLDB_INSTRUMENT_VA(...)
void SetSP(const ModuleSP &module_sp)
lldb_private::Stream & ref()
lldb::TargetSP GetSP() const
void Append(SBTypeEnumMember entry)
std::unique_ptr< lldb_private::TypeListImpl > m_opaque_up
lldb::SBType GetTypeAtIndex(uint32_t index)
lldb::SBTypeList & operator=(const lldb::SBTypeList &rhs)
void Append(lldb::SBType type)
lldb::SBType GetArgumentTypeAtIndex(uint32_t)
const char * GetMangledName()
void reset(lldb_private::TypeMemberFunctionImpl *)
lldb::MemberFunctionKind GetKind()
lldb::SBType GetReturnType()
lldb::SBTypeMemberFunction & operator=(const lldb::SBTypeMemberFunction &rhs)
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
lldb::TypeMemberFunctionImplSP m_opaque_sp
uint32_t GetNumberOfArguments()
const char * GetDemangledName()
lldb_private::TypeMemberFunctionImpl & ref()
std::unique_ptr< lldb_private::TypeMemberImpl > m_opaque_up
void reset(lldb_private::TypeMemberImpl *)
lldb::SBTypeMember & operator=(const lldb::SBTypeMember &rhs)
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
uint64_t GetOffsetInBits()
uint64_t GetOffsetInBytes()
uint32_t GetBitfieldSizeInBits()
lldb_private::TypeMemberImpl & ref()
lldb::SBTypeStaticField & operator=(const lldb::SBTypeStaticField &rhs)
const char * GetMangledName()
lldb::SBValue GetConstantValue(lldb::SBTarget target)
std::unique_ptr< lldb_private::CompilerDecl > m_opaque_up
uint32_t GetNumberOfTemplateArguments()
uint32_t GetNumberOfDirectBaseClasses()
lldb::SBType FindDirectNestedType(const char *name)
lldb::SBType GetReferenceType()
lldb::SBType GetArrayType(uint64_t size)
lldb::SBType GetVectorElementType()
uint32_t GetNumberOfFields()
lldb::SBType GetDereferencedType()
lldb::SBModule GetModule()
lldb::BasicType GetBasicType()
bool IsPolymorphicClass()
lldb::SBTypeMember GetDirectBaseClassAtIndex(uint32_t idx)
lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx)
Return the TemplateArgumentKind of the template argument at index idx.
lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx)
lldb::SBType GetPointerType()
uint32_t GetNumberOfMemberFunctions()
lldb::SBType GetTemplateArgumentType(uint32_t idx)
lldb::TypeClass GetTypeClass()
lldb::SBType GetCanonicalType()
friend class SBTypeStaticField
bool operator!=(lldb::SBType &rhs)
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
lldb::SBTypeList GetFunctionArgumentTypes()
uint32_t GetNumberOfVirtualBaseClasses()
lldb::SBType GetTypedefedType()
lldb_private::TypeImpl & ref()
lldb::SBTypeStaticField GetStaticFieldWithName(const char *name)
lldb::SBType & operator=(const lldb::SBType &rhs)
lldb::SBType GetFunctionReturnType()
lldb::TypeImplSP m_opaque_sp
lldb::SBType GetUnqualifiedType()
lldb::SBTypeMember GetVirtualBaseClassAtIndex(uint32_t idx)
const char * GetDisplayTypeName()
lldb::SBType GetArrayElementType()
lldb::SBType GetPointeeType()
lldb::SBTypeMember GetFieldAtIndex(uint32_t idx)
void SetSP(const lldb::TypeImplSP &type_impl_sp)
bool operator==(lldb::SBType &rhs)
lldb::SBType GetEnumerationIntegerType()
lldb::SBTypeEnumMemberList GetEnumMembers()
bool IsScopedEnumerationType()
Represents a generic declaration such as a function declaration.
Generic representation of a type in a programming language.
CompilerType GetFieldAtIndex(size_t idx, std::string &name, uint64_t *bit_offset_ptr, uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) const
bool IsCompleteType() const
CompilerType GetFunctionArgumentAtIndex(const size_t index) const
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.
size_t GetNumberOfFunctionArguments() const
bool IsForcefullyCompleted() const
A uniqued constant string class.
void SetCString(const char *cstr)
Set the C string value.
const char * GetCString() const
Get the string value as a C string.
A class that handles mangled names.
ConstString GetDemangledName() const
Demangled name get accessor.
bool GetData(DataExtractor &data, size_t limit_byte_size=UINT32_MAX) const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
A class that represents a running process on the host machine.
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
std::shared_ptr< lldb_private::TypeEnumMemberImpl > TypeEnumMemberImplSP
std::shared_ptr< lldb_private::Type > TypeSP
@ eTemplateArgumentKindNull
@ eTemplateArgumentKindIntegral
@ eTemplateArgumentKindType
MemberFunctionKind
Kind of member function.
@ eMemberFunctionKindUnknown
Not sure what the type of this is.
std::shared_ptr< lldb_private::TypeImpl > TypeImplSP