LLDB mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
lldb_private::Type Class Reference

#include <Type.h>

Inheritance diagram for lldb_private::Type:
Inheritance graph
[legend]

Classes

struct  ParsedName
 

Public Types

enum  EncodingDataType {
  eEncodingInvalid , eEncodingIsUID , eEncodingIsConstUID , eEncodingIsRestrictUID ,
  eEncodingIsVolatileUID , eEncodingIsTypedefUID , eEncodingIsPointerUID , eEncodingIsLValueReferenceUID ,
  eEncodingIsRValueReferenceUID , eEncodingIsAtomicUID , eEncodingIsSyntheticUID , eEncodingIsLLVMPtrAuthUID
}
 
enum class  ResolveState : unsigned char { Unresolved = 0 , Forward = 1 , Layout = 2 , Full = 3 }
 
typedef uint32_t Payload
 

Public Member Functions

void Dump (Stream *s, bool show_context, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)
 
void DumpTypeName (Stream *s)
 
lldb::ModuleSP GetModule ()
 Since Type instances only keep a "SymbolFile *" internally, other classes like TypeImpl need make sure the module is still around before playing with Type instances.
 
lldb::ModuleSP GetExeModule ()
 GetModule may return module for compile unit's object file.
 
void GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name, ExecutionContextScope *exe_scope)
 
SymbolFileGetSymbolFile ()
 
const SymbolFileGetSymbolFile () const
 
ConstString GetName ()
 
ConstString GetBaseName ()
 
std::optional< uint64_t > GetByteSize (ExecutionContextScope *exe_scope)
 
llvm::Expected< uint32_t > GetNumChildren (bool omit_empty_base_classes)
 
bool IsAggregateType ()
 
bool IsTemplateType ()
 
bool IsValidType ()
 
bool IsTypedef ()
 
lldb::TypeSP GetTypedefType ()
 
ConstString GetName () const
 
ConstString GetQualifiedName ()
 
bool ReadFromMemory (ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
 
bool WriteToMemory (ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
 
lldb::Format GetFormat ()
 
lldb::Encoding GetEncoding (uint64_t &count)
 
SymbolContextScopeGetSymbolContextScope ()
 
const SymbolContextScopeGetSymbolContextScope () const
 
void SetSymbolContextScope (SymbolContextScope *context)
 
const lldb_private::DeclarationGetDeclaration () const
 
CompilerType GetFullCompilerType ()
 
CompilerType GetLayoutCompilerType ()
 
CompilerType GetForwardCompilerType ()
 
void SetEncodingType (Type *encoding_type)
 
uint32_t GetEncodingMask ()
 
Payload GetPayload ()
 Return the language-specific payload.
 
void SetPayload (Payload opaque_payload)
 Return the language-specific payload.
 
- Public Member Functions inherited from lldb_private::UserID
 UserID (lldb::user_id_t uid=LLDB_INVALID_UID)
 Construct with optional user ID.
 
 ~UserID ()=default
 Destructor.
 
void Clear ()
 Clears the object state.
 
lldb::user_id_t GetID () const
 Get accessor for the user ID.
 
void SetID (lldb::user_id_t uid)
 Set accessor for the user ID.
 

Static Public Member Functions

static int Compare (const Type &a, const Type &b)
 
static std::optional< ParsedNameGetTypeScopeAndBasename (llvm::StringRef name)
 

Protected Member Functions

TypeGetEncodingType ()
 
bool ResolveCompilerType (ResolveState compiler_type_resolve_state)
 

Protected Attributes

ConstString m_name
 
SymbolFilem_symbol_file = nullptr
 
SymbolContextScopem_context = nullptr
 The symbol context in which this type is defined.
 
Typem_encoding_type = nullptr
 
lldb::user_id_t m_encoding_uid = LLDB_INVALID_UID
 
EncodingDataType m_encoding_uid_type = eEncodingInvalid
 
uint64_t m_byte_size: 63
 
uint64_t m_byte_size_has_value: 1
 
Declaration m_decl
 
CompilerType m_compiler_type
 
ResolveState m_compiler_type_resolve_state = ResolveState::Unresolved
 
Payload m_payload
 Language-specific flags.
 
- Protected Attributes inherited from lldb_private::UserID
lldb::user_id_t m_uid
 The user ID that uniquely identifies an object.
 

Private Member Functions

 Type (lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name, std::optional< uint64_t > byte_size, SymbolContextScope *context, lldb::user_id_t encoding_uid, EncodingDataType encoding_uid_type, const Declaration &decl, const CompilerType &compiler_qual_type, ResolveState compiler_type_resolve_state, uint32_t opaque_payload=0)
 
 Type ()
 
 Type (Type &t)=default
 
 Type (Type &&t)=default
 
Typeoperator= (const Type &t)=default
 
Typeoperator= (Type &&t)=default
 

Friends

class lldb_private::SymbolFileCommon
 Only allow Symbol File to create types, as they should own them by keeping them in their TypeList.
 

Detailed Description

Definition at line 383 of file Type.h.

Member Typedef Documentation

◆ Payload

typedef uint32_t lldb_private::Type::Payload

Definition at line 536 of file Type.h.

Member Enumeration Documentation

◆ EncodingDataType

Enumerator
eEncodingInvalid 

Invalid encoding.

eEncodingIsUID 

This type is the type whose UID is m_encoding_uid.

eEncodingIsConstUID 

This type is the type whose UID is m_encoding_uid with the const qualifier added.

eEncodingIsRestrictUID 

This type is the type whose UID is m_encoding_uid with the restrict qualifier added.

eEncodingIsVolatileUID 

This type is the type whose UID is m_encoding_uid with the volatile qualifier added.

eEncodingIsTypedefUID 

This type is alias to a type whose UID is m_encoding_uid.

eEncodingIsPointerUID 

This type is pointer to a type whose UID is m_encoding_uid.

eEncodingIsLValueReferenceUID 

This type is L value reference to a type whose UID is m_encoding_uid.

eEncodingIsRValueReferenceUID 

This type is R value reference to a type whose UID is m_encoding_uid.

eEncodingIsAtomicUID 

This type is the type whose UID is m_encoding_uid as an atomic type.

eEncodingIsSyntheticUID 

This type is the synthetic type whose UID is m_encoding_uid.

eEncodingIsLLVMPtrAuthUID 

This type is a signed pointer.

Definition at line 385 of file Type.h.

◆ ResolveState

enum class lldb_private::Type::ResolveState : unsigned char
strong
Enumerator
Unresolved 
Forward 
Layout 
Full 

Definition at line 415 of file Type.h.

Constructor & Destructor Documentation

◆ Type() [1/4]

Type::Type ( lldb::user_id_t  uid,
SymbolFile symbol_file,
ConstString  name,
std::optional< uint64_t >  byte_size,
SymbolContextScope context,
lldb::user_id_t  encoding_uid,
EncodingDataType  encoding_uid_type,
const Declaration decl,
const CompilerType compiler_qual_type,
ResolveState  compiler_type_resolve_state,
uint32_t  opaque_payload = 0 
)
private

Definition at line 256 of file Type.cpp.

References m_byte_size, and m_byte_size_has_value.

◆ Type() [2/4]

Type::Type ( )
private

Definition at line 277 of file Type.cpp.

References m_byte_size, and m_byte_size_has_value.

◆ Type() [3/4]

lldb_private::Type::Type ( Type t)
privatedefault

◆ Type() [4/4]

lldb_private::Type::Type ( Type &&  t)
privatedefault

Member Function Documentation

◆ Compare()

static int lldb_private::Type::Compare ( const Type a,
const Type b 
)
static

◆ Dump()

void Type::Dump ( Stream s,
bool  show_context,
lldb::DescriptionLevel  level = lldb::eDescriptionLevelFull 
)

◆ DumpTypeName()

void Type::DumpTypeName ( Stream s)

Definition at line 430 of file Type.cpp.

References lldb_private::ConstString::Dump(), and GetName().

Referenced by lldb_private::Variable::Dump().

◆ GetBaseName()

ConstString Type::GetBaseName ( )

◆ GetByteSize()

std::optional< uint64_t > Type::GetByteSize ( ExecutionContextScope exe_scope)

◆ GetDeclaration()

const Declaration & Type::GetDeclaration ( ) const

Definition at line 556 of file Type.cpp.

References m_decl.

Referenced by lldb_private::Block::AddRange(), and lldb_private::Function::GetStartLineSourceInfo().

◆ GetDescription()

void Type::GetDescription ( Stream s,
lldb::DescriptionLevel  level,
bool  show_name,
ExecutionContextScope exe_scope 
)

◆ GetEncoding()

lldb::Encoding Type::GetEncoding ( uint64_t &  count)

◆ GetEncodingMask()

uint32_t Type::GetEncodingMask ( )

◆ GetEncodingType()

Type * Type::GetEncodingType ( )
protected

◆ GetExeModule()

ModuleSP Type::GetExeModule ( )

GetModule may return module for compile unit's object file.

GetExeModule returns module for executable object file that contains compile unit where type was actually defined. GetModule and GetExeModule may return the same value.

Definition at line 821 of file Type.cpp.

References lldb_private::ModuleChild::GetModule(), lldb_private::SymbolFile::GetObjectFile(), lldb_private::CompilerType::GetTypeSystem(), and m_compiler_type.

◆ GetFormat()

lldb::Format Type::GetFormat ( )

Definition at line 506 of file Type.cpp.

References lldb_private::CompilerType::GetFormat(), and GetForwardCompilerType().

◆ GetForwardCompilerType()

CompilerType Type::GetForwardCompilerType ( )

◆ GetFullCompilerType()

CompilerType Type::GetFullCompilerType ( )

◆ GetLayoutCompilerType()

CompilerType Type::GetLayoutCompilerType ( )

◆ GetModule()

ModuleSP Type::GetModule ( )

Since Type instances only keep a "SymbolFile *" internally, other classes like TypeImpl need make sure the module is still around before playing with Type instances.

They can store a weak pointer to the Module;

Definition at line 815 of file Type.cpp.

References lldb_private::ModuleChild::GetModule(), lldb_private::SymbolFile::GetObjectFile(), and m_symbol_file.

◆ GetName() [1/2]

ConstString Type::GetName ( )

◆ GetName() [2/2]

ConstString lldb_private::Type::GetName ( ) const
inline

Definition at line 464 of file Type.h.

References m_name.

◆ GetNumChildren()

llvm::Expected< uint32_t > Type::GetNumChildren ( bool  omit_empty_base_classes)

◆ GetPayload()

Payload lldb_private::Type::GetPayload ( )
inline

Return the language-specific payload.

Definition at line 538 of file Type.h.

References m_payload.

◆ GetQualifiedName()

ConstString Type::GetQualifiedName ( )

◆ GetSymbolContextScope() [1/2]

SymbolContextScope * lldb_private::Type::GetSymbolContextScope ( )
inline

Definition at line 478 of file Type.h.

References m_context.

◆ GetSymbolContextScope() [2/2]

const SymbolContextScope * lldb_private::Type::GetSymbolContextScope ( ) const
inline

Definition at line 479 of file Type.h.

References m_context.

◆ GetSymbolFile() [1/2]

SymbolFile * lldb_private::Type::GetSymbolFile ( )
inline

◆ GetSymbolFile() [2/2]

const SymbolFile * lldb_private::Type::GetSymbolFile ( ) const
inline

Definition at line 443 of file Type.h.

References m_symbol_file.

◆ GetTypedefType()

lldb::TypeSP Type::GetTypedefType ( )

◆ GetTypeScopeAndBasename()

std::optional< Type::ParsedName > Type::GetTypeScopeAndBasename ( llvm::StringRef  name)
static

◆ IsAggregateType()

bool Type::IsAggregateType ( )

◆ IsTemplateType()

bool Type::IsTemplateType ( )

◆ IsTypedef()

bool lldb_private::Type::IsTypedef ( )
inline

Definition at line 460 of file Type.h.

References eEncodingIsTypedefUID, and m_encoding_uid_type.

Referenced by GetTypedefType().

◆ IsValidType()

bool lldb_private::Type::IsValidType ( )
inline

Definition at line 458 of file Type.h.

References eEncodingInvalid, and m_encoding_uid_type.

◆ operator=() [1/2]

Type & lldb_private::Type::operator= ( const Type t)
privatedefault

◆ operator=() [2/2]

Type & lldb_private::Type::operator= ( Type &&  t)
privatedefault

◆ ReadFromMemory()

bool Type::ReadFromMemory ( ExecutionContext exe_ctx,
lldb::addr_t  address,
AddressType  address_type,
DataExtractor data 
)

◆ ResolveCompilerType()

bool Type::ResolveCompilerType ( ResolveState  compiler_type_resolve_state)
protected

Definition at line 558 of file Type.cpp.

References lldb_private::CompilerType::AddConstModifier(), lldb_private::CompilerType::AddPtrAuthModifier(), lldb_private::CompilerType::AddRestrictModifier(), lldb_private::CompilerType::AddVolatileModifier(), lldb_private::ConstString::AsCString(), lldb_private::ConstString::Clear(), lldb_private::SymbolFile::CompleteType(), lldb_private::CompilerType::CreateTypedef(), lldb::eBasicTypeVoid, eEncodingIsAtomicUID, eEncodingIsConstUID, eEncodingIsLLVMPtrAuthUID, eEncodingIsLValueReferenceUID, eEncodingIsPointerUID, eEncodingIsRestrictUID, eEncodingIsRValueReferenceUID, eEncodingIsTypedefUID, eEncodingIsUID, eEncodingIsVolatileUID, lldb::eLanguageTypeC, Forward, Full, lldb_private::CompilerType::GetAtomicType(), lldb_private::CompilerType::GetBasicTypeFromAST(), GetEncodingType(), GetForwardCompilerType(), lldb_private::UserID::GetID(), lldb_private::GetLog(), lldb_private::CompilerType::GetLValueReferenceType(), lldb_private::CompilerType::GetPointerType(), lldb_private::CompilerType::GetRValueReferenceType(), GetSymbolFile(), lldb_private::SymbolFile::GetTypeSystemForLanguage(), lldb_private::CompilerType::IsDefined(), lldb_private::CompilerType::IsValid(), Layout, LLDB_INVALID_UID, LLDB_LOG_ERROR, m_compiler_type, m_compiler_type_resolve_state, m_encoding_uid, m_encoding_uid_type, m_name, m_payload, m_symbol_file, ResolveCompilerType(), and lldb_private::Symbols.

Referenced by GetForwardCompilerType(), GetFullCompilerType(), GetLayoutCompilerType(), and ResolveCompilerType().

◆ SetEncodingType()

void lldb_private::Type::SetEncodingType ( Type encoding_type)
inline

Definition at line 532 of file Type.h.

References m_encoding_type.

◆ SetPayload()

void lldb_private::Type::SetPayload ( Payload  opaque_payload)
inline

Return the language-specific payload.

Definition at line 540 of file Type.h.

References m_payload.

◆ SetSymbolContextScope()

void lldb_private::Type::SetSymbolContextScope ( SymbolContextScope context)
inline

Definition at line 480 of file Type.h.

References m_context.

◆ WriteToMemory()

bool Type::WriteToMemory ( ExecutionContext exe_ctx,
lldb::addr_t  address,
AddressType  address_type,
DataExtractor data 
)

Definition at line 551 of file Type.cpp.

Friends And Related Function Documentation

◆ lldb_private::SymbolFileCommon

friend class lldb_private::SymbolFileCommon
friend

Only allow Symbol File to create types, as they should own them by keeping them in their TypeList.

See also
SymbolFileCommon::MakeType() reference in the header documentation here so users will know what function to use if the get a compile error.

Definition at line 566 of file Type.h.

Member Data Documentation

◆ m_byte_size

uint64_t lldb_private::Type::m_byte_size
protected

Definition at line 550 of file Type.h.

Referenced by Dump(), GetByteSize(), GetDescription(), and Type().

◆ m_byte_size_has_value

uint64_t lldb_private::Type::m_byte_size_has_value
protected

Definition at line 551 of file Type.h.

Referenced by Dump(), GetByteSize(), and Type().

◆ m_compiler_type

CompilerType lldb_private::Type::m_compiler_type
protected

◆ m_compiler_type_resolve_state

ResolveState lldb_private::Type::m_compiler_type_resolve_state = ResolveState::Unresolved
protected

Definition at line 554 of file Type.h.

Referenced by ResolveCompilerType().

◆ m_context

SymbolContextScope* lldb_private::Type::m_context = nullptr
protected

The symbol context in which this type is defined.

Definition at line 546 of file Type.h.

Referenced by Dump(), GetSymbolContextScope(), and SetSymbolContextScope().

◆ m_decl

Declaration lldb_private::Type::m_decl
protected

Definition at line 552 of file Type.h.

Referenced by Dump(), GetDeclaration(), and GetDescription().

◆ m_encoding_type

Type* lldb_private::Type::m_encoding_type = nullptr
protected

Definition at line 547 of file Type.h.

Referenced by GetEncodingType(), and SetEncodingType().

◆ m_encoding_uid

lldb::user_id_t lldb_private::Type::m_encoding_uid = LLDB_INVALID_UID
protected

Definition at line 548 of file Type.h.

Referenced by Dump(), GetDescription(), GetEncodingType(), GetTypedefType(), and ResolveCompilerType().

◆ m_encoding_uid_type

EncodingDataType lldb_private::Type::m_encoding_uid_type = eEncodingInvalid
protected

◆ m_name

ConstString lldb_private::Type::m_name
protected

Definition at line 543 of file Type.h.

Referenced by Dump(), GetName(), and ResolveCompilerType().

◆ m_payload

Payload lldb_private::Type::m_payload
protected

Language-specific flags.

Definition at line 556 of file Type.h.

Referenced by GetPayload(), ResolveCompilerType(), and SetPayload().

◆ m_symbol_file

SymbolFile* lldb_private::Type::m_symbol_file = nullptr
protected

The documentation for this class was generated from the following files: