9#ifndef LLDB_SYMBOL_TYPE_H
10#define LLDB_SYMBOL_TYPE_H
22#include "llvm/ADT/APSInt.h"
23#include "llvm/ADT/DenseSet.h"
24#include "llvm/ADT/STLForwardCompat.h"
25#include "llvm/Support/raw_ostream.h"
31class SymbolFileCommon;
65llvm::raw_ostream &
operator<<(llvm::raw_ostream &os,
73 e_exact_match = (1u << 0),
76 e_module_search = (1u << 1),
79 e_ignore_modules = (1u << 2),
82 e_strict_namespaces = (1u << 3),
86 e_find_one = (1u << 4),
89 e_search_by_mangled_name = (1u << 5),
148 TypeQuery(llvm::StringRef name, TypeQueryOptions options = e_none);
170 TypeQueryOptions options = e_none);
208 TypeQuery(
const llvm::ArrayRef<lldb_private::CompilerContext> &context,
209 TypeQueryOptions options = e_none);
237 ContextMatches(llvm::ArrayRef<lldb_private::CompilerContext> context)
const;
275 m_options |= e_ignore_modules;
277 m_options &= ~e_ignore_modules;
281 return (m_options & e_strict_namespaces) != 0;
285 m_options |= e_strict_namespaces;
287 m_options &= ~e_strict_namespaces;
298 bool GetFindOne()
const {
return (m_options & e_find_one) != 0; }
301 m_options |= e_find_one;
303 m_options &= ~e_find_one;
309 return (m_options & e_search_by_mangled_name) != 0;
314 m_options |= e_search_by_mangled_name;
316 m_options &= ~e_search_by_mangled_name;
417class Type :
public std::enable_shared_from_this<Type>,
public UserID {
485 llvm::Expected<uint32_t>
GetNumChildren(
bool omit_empty_base_classes);
543 llvm::SmallVector<llvm::StringRef>
scope;
554 return os << llvm::formatv(
555 "Type::ParsedName({0:x}, [{1}], {2})",
557 llvm::make_range(name.
scope.begin(), name.
scope.end()),
563 static std::optional<ParsedName>
606 ResolveState compiler_type_resolve_state, uint32_t opaque_payload = 0);
652 explicit operator bool()
const;
734 bool is_bitfield =
false)
797 void SetName(
const char *type_name_cstr);
799 void SetName(llvm::StringRef name);
815 explicit operator bool() {
return !
IsEmpty(); }
827 const std::string &name,
864 const llvm::APSInt &value);
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...
Generic representation of a type in a programming language.
A uniqued constant string class.
A class that describes the declaration location of a lldb object.
"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.
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
Containing protected virtual methods for child classes to override.
SymbolFile & m_symbol_file
SymbolFileType(SymbolFile &symbol_file, lldb::user_id_t uid)
SymbolFile & GetSymbolFile() const
~SymbolFileType()=default
Provides public interface for all SymbolFiles.
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
void SetName(ConstString type_name)
TypeAndOrName(const CompilerType &compiler_type)
bool operator!=(const TypeAndOrName &other) const
bool operator==(const TypeAndOrName &other) const
CompilerType GetCompilerType() const
ConstString GetName() const
bool HasCompilerType() const
void SetCompilerType(CompilerType compiler_type)
void SetTypeSP(lldb::TypeSP type_sp)
CompilerType m_compiler_type
int64_t GetValueAsSigned() const
ConstString GetName() const
const lldb::TypeImplSP & GetIntegerType() const
TypeEnumMemberImpl(const TypeEnumMemberImpl &rhs)=default
TypeEnumMemberImpl & operator=(const TypeEnumMemberImpl &rhs)
lldb::TypeImplSP m_integer_type_sp
uint64_t GetValueAsUnsigned() const
TypeEnumMemberListImpl()=default
lldb::TypeEnumMemberImplSP GetTypeEnumMemberAtIndex(size_t idx)
std::vector< lldb::TypeEnumMemberImplSP > m_content
void Append(const lldb_private::TypeEnumMemberListImpl &type_list)
void Append(const lldb::TypeEnumMemberImplSP &type)
CompilerType GetCompilerType(bool prefer_dynamic)
bool operator!=(const TypeImpl &rhs) const
bool CheckExeModule(lldb::ModuleSP &module_sp) const
bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level)
bool operator==(const TypeImpl &rhs) const
bool CheckModuleCommon(const lldb::ModuleWP &input_module_wp, lldb::ModuleSP &module_sp) const
TypeImpl GetCanonicalType() const
void SetType(const lldb::TypeSP &type_sp)
TypeImpl GetUnqualifiedType() const
TypeImpl GetPointeeType() const
CompilerType m_dynamic_type
CompilerType::TypeSystemSPWrapper GetTypeSystem(bool prefer_dynamic)
CompilerType m_static_type
bool CheckModule(lldb::ModuleSP &module_sp) const
lldb::ModuleSP GetModule() const
TypeImpl GetDereferencedType() const
TypeImpl GetPointerType() const
lldb::ModuleWP m_exe_module_wp
TypeImpl GetReferenceType() const
TypeImpl GetTypedefedType() const
lldb::ModuleWP m_module_wp
ConstString GetName() const
CompilerType FindDirectNestedType(llvm::StringRef name)
ConstString GetDisplayTypeName() const
void operator()(const lldb::TypeImplSP &type)
TypeListImpl & m_type_list
AppendVisitor(TypeListImpl &type_list)
lldb::TypeImplSP GetTypeAtIndex(size_t idx)
void Append(const lldb::TypeImplSP &type)
std::vector< lldb::TypeImplSP > m_content
lldb::TypeSP FirstType() const
TypeMemberFunctionImpl()=default
size_t GetNumArguments() const
CompilerType GetReturnType() const
ConstString GetMangledName() const
CompilerType GetType() const
ConstString GetName() const
TypeMemberFunctionImpl(const CompilerType &type, const CompilerDecl &decl, const std::string &name, const lldb::MemberFunctionKind &kind)
CompilerType GetArgumentAtIndex(size_t idx) const
bool GetDescription(Stream &stream)
lldb::MemberFunctionKind GetKind() const
std::string GetPrintableTypeName()
lldb::MemberFunctionKind m_kind
bool GetIsBitfield() const
uint32_t GetBitfieldBitSize() const
void SetIsBitfield(bool is_bitfield)
const lldb::TypeImplSP & GetTypeImpl()
ConstString GetName() const
TypeMemberImpl(const lldb::TypeImplSP &type_impl_sp, uint64_t bit_offset, ConstString name, uint32_t bitfield_bit_size=0, bool is_bitfield=false)
uint32_t m_bitfield_bit_size
uint64_t GetBitOffset() const
TypeMemberImpl(const lldb::TypeImplSP &type_impl_sp, uint64_t bit_offset)
lldb::TypeImplSP m_type_impl_sp
void SetBitfieldBitSize(uint32_t bitfield_bit_size)
A class that contains all state required for type lookups.
TypeQuery(const TypeQuery &rhs)=default
Construct a type-match object that duplicates all matching criterea, but not any searched symbol file...
std::vector< lldb_private::CompilerContext > m_context
A full or partial compiler context array where the parent declaration contexts appear at the top of t...
bool GetModuleSearch() const
The m_context can be used in two ways: normal types searching with the context containing a stanadard...
std::vector< lldb_private::CompilerContext > & GetContextRef()
Access the internal compiler context array.
TypeQuery & operator=(const TypeQuery &rhs)=default
Assign a type-match object that duplicates all matching criterea, but not any searched symbol files o...
bool HasLanguage() const
Returns true if any matching languages have been specified in this type matching object.
bool GetStrictNamespaces() const
TypeQueryOptions m_options
An options bitmask that contains enabled options for the type query.
bool GetExactMatch() const
bool GetIgnoreModules() const
std::optional< LanguageSet > m_languages
If this variable has a value, then the language family must match at least one of the specified langu...
void SetSearchByMangledName(bool b)
bool GetSearchByMangledName() const
Returns true if the type query is supposed to treat the name to be searched as a mangled name.
void SetStrictNamespaces(bool b)
void SetIgnoreModules(bool b)
bool GetFindOne() const
Returns true if the type query is supposed to find only a single matching type.
This class tracks the state and results of a TypeQuery.
bool InsertUnique(const lldb::TypeSP &type_sp)
When types that match a TypeQuery are found, this API is used to insert the matching types.
const TypeMap & GetTypeMap() const
llvm::DenseSet< lldb_private::SymbolFile * > m_searched_symbol_files
This set is used to track and make sure we only perform lookups in a symbol file one time.
TypeResults()=default
Construct a type results object.
lldb::TypeSP GetFirstType() const
bool AlreadySearched(lldb_private::SymbolFile *sym_file)
Check if a SymbolFile object has already been searched by this type match object.
llvm::DenseSet< lldb_private::SymbolFile * > & GetSearchedSymbolFiles()
Access the set of searched symbol files.
TypeMap m_type_map
Matching types get added to this map as type search continues.
void SetEncodingType(Type *encoding_type)
CompilerType m_compiler_type
CompilerType GetForwardCompilerType()
Type & operator=(const Type &t)=default
const SymbolContextScope * GetSymbolContextScope() const
void SetSymbolContextScope(SymbolContextScope *context)
const lldb_private::Declaration & GetDeclaration() const
uint64_t m_byte_size_has_value
ResolveState m_compiler_type_resolve_state
static int Compare(const Type &a, const Type &b)
uint32_t GetEncodingMask()
void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name, ExecutionContextScope *exe_scope)
Type & operator=(Type &&t)=default
const SymbolFile * GetSymbolFile() const
llvm::Expected< uint32_t > GetNumChildren(bool omit_empty_base_classes)
SymbolContextScope * m_context
The symbol context in which this type is defined.
lldb::user_id_t m_encoding_uid
@ eEncodingIsRestrictUID
This type is the type whose UID is m_encoding_uid with the restrict qualifier added.
@ eEncodingIsConstUID
This type is the type whose UID is m_encoding_uid with the const qualifier added.
@ eEncodingIsVolatileUID
This type is the type whose UID is m_encoding_uid with the volatile qualifier added.
@ eEncodingIsAtomicUID
This type is the type whose UID is m_encoding_uid as an atomic type.
@ eEncodingIsLLVMPtrAuthUID
This type is a signed pointer.
@ eEncodingIsSyntheticUID
This type is the synthetic type whose UID is m_encoding_uid.
@ eEncodingInvalid
Invalid encoding.
@ 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.
@ eEncodingIsUID
This type is the type whose UID is m_encoding_uid.
Payload m_payload
Language-specific flags.
SymbolFile * GetSymbolFile()
void Dump(Stream *s, bool show_context, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)
Payload GetPayload()
Return the language-specific payload.
CompilerType GetLayoutCompilerType()
void SetPayload(Payload opaque_payload)
Return the language-specific payload.
lldb::Encoding GetEncoding(uint64_t &count)
lldb::ModuleSP GetExeModule()
GetModule may return module for compile unit's object file.
void DumpTypeName(Stream *s)
static std::optional< ParsedName > GetTypeScopeAndBasename(llvm::StringRef name)
SymbolContextScope * GetSymbolContextScope()
lldb::TypeSP GetTypedefType()
bool ResolveCompilerType(ResolveState compiler_type_resolve_state)
SymbolFile * m_symbol_file
ConstString GetName() const
EncodingDataType m_encoding_uid_type
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope)
bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
ConstString GetBaseName()
ConstString GetQualifiedName()
CompilerType GetFullCompilerType()
lldb::ModuleSP GetModule()
Since Type instances only keep a "SymbolFile *" internally, other classes like TypeImpl need make sur...
bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
#define LLDB_MARK_AS_BITMASK_ENUM(Enum)
A class that represents a running process on the host machine.
Stream & operator<<(Stream &s, const Mangled &obj)
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::weak_ptr< lldb_private::Module > ModuleWP
Format
Display format definitions.
std::shared_ptr< lldb_private::TypeEnumMemberImpl > TypeEnumMemberImplSP
LanguageType
Programming language type.
std::shared_ptr< lldb_private::Type > TypeSP
Encoding
Register encoding definitions.
MemberFunctionKind
Kind of member function.
@ eMemberFunctionKindUnknown
Not sure what the type of this is.
std::shared_ptr< lldb_private::TypeImpl > TypeImplSP
std::shared_ptr< lldb_private::Module > ModuleSP
CompilerContext allows an array of these items to be passed to perform detailed lookups in SymbolVend...
void Dump(Stream &s) const
bool operator==(const CompilerContext &rhs) const
bool operator!=(const CompilerContext &rhs) const
CompilerContext(CompilerContextKind t, ConstString n)
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
llvm::SmallBitVector bitvector
std::optional< lldb::LanguageType > GetSingularLanguage()
If the set contains a single language only, return it.
bool operator[](unsigned i) const
void Insert(lldb::LanguageType language)
friend bool operator==(const ParsedName &lhs, const ParsedName &rhs)
llvm::SmallVector< llvm::StringRef > scope
lldb::TypeClass type_class
friend llvm::raw_ostream & operator<<(llvm::raw_ostream &os, const ParsedName &name)
A mix in class that contains a generic user ID.