9#ifndef LLDB_SYMBOL_TYPESYSTEM_H
10#define LLDB_SYMBOL_TYPESYSTEM_H
17#include "llvm/ADT/APFloat.h"
18#include "llvm/ADT/APSInt.h"
19#include "llvm/ADT/DenseMap.h"
20#include "llvm/ADT/SmallBitVector.h"
21#include "llvm/Support/Casting.h"
22#include "llvm/Support/Error.h"
23#include "llvm/Support/JSON.h"
70 public std::enable_shared_from_this<TypeSystem> {
77 virtual bool isA(
const void *ClassID)
const = 0;
112 virtual std::vector<lldb_private::CompilerContext>
121 virtual std::vector<CompilerDecl>
123 const bool ignore_imported_decls);
133 void *other_opaque_decl_ctx) = 0;
141 virtual std::vector<lldb_private::CompilerContext>
153 bool *is_incomplete) = 0;
166 uint32_t &count,
bool &is_complex) = 0;
175 const size_t index) = 0;
186 bool &is_signed) = 0;
198 bool check_cplusplus,
bool check_objc) = 0;
309 uint32_t opaque_payload);
315 virtual std::optional<uint64_t>
320 uint64_t &count) = 0;
324 virtual llvm::Expected<uint32_t>
326 bool omit_empty_base_classes,
338 const llvm::APSInt &value)>
const &callback) {}
343 size_t idx, std::string &name,
344 uint64_t *bit_offset_ptr,
345 uint32_t *bitfield_bit_size_ptr,
346 bool *is_bitfield_ptr) = 0;
356 uint32_t *bit_offset_ptr) = 0;
360 uint32_t *bit_offset_ptr) = 0;
363 llvm::StringRef name) {
369 bool transparent_pointers,
bool omit_empty_base_classes,
370 bool ignore_array_bounds, std::string &child_name,
371 uint32_t &child_byte_size, int32_t &child_byte_offset,
372 uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
373 bool &child_is_base_class,
bool &child_is_deref_of_parent,
374 ValueObject *valobj, uint64_t &language_flags) = 0;
379 llvm::StringRef name,
380 bool omit_empty_base_classes) = 0;
390 bool omit_empty_base_classes, std::vector<uint32_t> &child_indexes) = 0;
394 llvm::StringRef name) {
409 virtual std::optional<CompilerType::IntegralTemplateArgument>
417 LLVM_DUMP_METHOD
virtual void
424 uint32_t bitfield_bit_size,
425 uint32_t bitfield_bit_offset,
445 virtual void Dump(llvm::raw_ostream &output) = 0;
457 virtual std::optional<size_t>
469 size_t bit_size) = 0;
503 llvm::StringRef expr, llvm::StringRef prefix,
SourceLanguage language,
510 const Address &function_address,
516 virtual std::unique_ptr<UtilityFunction>
565 llvm::Expected<lldb::TypeSystemSP>
569 llvm::Expected<lldb::TypeSystemSP>
577 typedef llvm::DenseMap<uint16_t, lldb::TypeSystemSP>
collection;
599 std::optional<CreateCallback> create_callback = std::nullopt);
A section + offset based address class.
Represents a generic declaration context in a program.
Represents a generic declaration such as a function declaration.
Generic representation of a type in a programming language.
A uniqued constant string 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.
Encapsulates a function that can be called.
A class that describes an executable image and its associated object and symbol files.
A stream class that can stream formatted output to a file.
Provides public interface for all SymbolFiles.
llvm::DenseMap< uint16_t, lldb::TypeSystemSP > collection
std::mutex m_mutex
A mutex to keep this object happy in multi-threaded environments.
bool GetHasForcefullyCompletedTypes() const
Check all type systems in the map to see if any have forcefully completed types;.
llvm::function_ref< lldb::TypeSystemSP()> CreateCallback
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language, Module *module, bool can_create)
void ForEach(std::function< bool(lldb::TypeSystemSP)> const &callback)
Interface for representing a type system.
virtual CompilerType GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type)=0
virtual PersistentExpressionState * GetPersistentExpressionState()
virtual CompilerType GetFunctionReturnType(lldb::opaque_compiler_type_t type)=0
virtual std::unique_ptr< UtilityFunction > CreateUtilityFunction(std::string text, std::string name)
virtual void Finalize()
Free up any resources associated with this TypeSystem.
virtual bool IsMeaninglessWithoutDynamicResolution(void *type)
virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type, bool expand_pack)
virtual bool IsEnumerationType(lldb::opaque_compiler_type_t type, bool &is_signed)
virtual bool GetPtrAuthAddressDiversity(lldb::opaque_compiler_type_t type)=0
virtual PDBASTParser * GetPDBParser()
virtual CompilerType GetBuiltinTypeByName(ConstString name)
virtual bool GetCompleteType(lldb::opaque_compiler_type_t type)=0
virtual bool IsBeingDefined(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack)
virtual CompilerType GetTypeForFormatters(void *type)
virtual unsigned GetPtrAuthDiscriminator(lldb::opaque_compiler_type_t type)=0
virtual bool IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size)=0
virtual CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type)
virtual CompilerType GetAtomicType(lldb::opaque_compiler_type_t type)
virtual lldb::Format GetFormat(lldb::opaque_compiler_type_t type)=0
virtual ConstString GetMangledTypeName(lldb::opaque_compiler_type_t type)
Defaults to GetTypeName(type).
virtual CompilerType GetLValueReferenceType(lldb::opaque_compiler_type_t type)
virtual std::vector< CompilerDecl > DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_imported_decls)
virtual void ForEachEnumerator(lldb::opaque_compiler_type_t type, std::function< bool(const CompilerType &integer_type, ConstString name, const llvm::APSInt &value)> const &callback)
virtual unsigned GetPtrAuthKey(lldb::opaque_compiler_type_t type)=0
virtual uint32_t GetPointerByteSize()=0
virtual ConstString DeclGetName(void *opaque_decl)=0
virtual bool IsAggregateType(lldb::opaque_compiler_type_t type)=0
virtual bool IsDefined(lldb::opaque_compiler_type_t type)=0
virtual std::optional< size_t > GetTypeBitAlign(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)=0
virtual ConstString GetTypeName(lldb::opaque_compiler_type_t type, bool BaseOnly)=0
virtual uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes)=0
virtual bool DeclContextIsClassMethod(void *opaque_decl_ctx)=0
virtual std::optional< llvm::json::Value > ReportStatistics()
virtual CompilerType CreateTypedef(lldb::opaque_compiler_type_t type, const char *name, const CompilerDeclContext &decl_ctx, uint32_t opaque_payload)
virtual void DumpTypeDescription(lldb::opaque_compiler_type_t type, Stream &s, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)=0
Print a description of the type to a stream.
virtual bool IsCompleteType(lldb::opaque_compiler_type_t type)=0
virtual Scalar DeclGetConstantValue(void *opaque_decl)
virtual bool IsFunctionType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index)=0
virtual const llvm::fltSemantics & GetFloatTypeSemantics(size_t byte_size)=0
virtual CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type)=0
virtual FunctionCaller * GetFunctionCaller(const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name)
virtual std::optional< uint64_t > GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)=0
virtual LazyBool ShouldPrintAsOneLiner(void *type, ValueObject *valobj)
virtual size_t GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes)=0
virtual bool IsTypedefType(lldb::opaque_compiler_type_t type)=0
virtual bool IsBlockPointerType(lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr)=0
virtual bool IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed)=0
virtual lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type)=0
virtual SymbolFile * GetSymbolFile() const
virtual CompilerType AddConstModifier(lldb::opaque_compiler_type_t type)
bool m_has_forcefully_completed_types
Used for reporting statistics.
virtual npdb::PdbAstBuilder * GetNativePDBParser()
virtual CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type)=0
virtual uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type)=0
virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type)=0
virtual CompilerType AddPtrAuthModifier(lldb::opaque_compiler_type_t type, uint32_t payload)
virtual uint32_t GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type)=0
virtual CompilerDecl GetStaticFieldWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name)
virtual CompilerType DeclGetFunctionReturnType(void *opaque_decl)
virtual lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type, uint64_t &count)=0
virtual bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex)=0
virtual CompilerType GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name)
virtual lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type)=0
virtual bool DeclContextIsContainedInLookup(void *opaque_decl_ctx, void *other_opaque_decl_ctx)=0
virtual LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const =0
Convenience LLVM-style dump method for use in the debugger only.
virtual bool IsFunctionPointerType(lldb::opaque_compiler_type_t type)=0
virtual bool IsCharType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetTypeForDecl(void *opaque_decl)=0
virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl, size_t arg_idx)
virtual void SetSymbolFile(SymbolFile *sym_file)
virtual bool IsMemberFunctionPointerType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetRValueReferenceType(lldb::opaque_compiler_type_t type)
virtual std::vector< lldb_private::CompilerContext > DeclGetCompilerContext(void *opaque_decl)
virtual bool IsReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool *is_rvalue)=0
virtual UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj)
virtual std::vector< lldb_private::CompilerContext > DeclContextGetCompilerContext(void *opaque_decl_ctx)
virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx)=0
virtual bool IsScopedEnumerationType(lldb::opaque_compiler_type_t type)=0
bool GetHasForcefullyCompletedTypes() const
virtual bool IsAnonymousType(lldb::opaque_compiler_type_t type)
virtual bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type)=0
virtual ConstString DeclContextGetName(void *opaque_decl_ctx)=0
virtual ConstString DeclGetMangledName(void *opaque_decl)
virtual bool IsVoidType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetArrayType(lldb::opaque_compiler_type_t type, uint64_t size)
virtual bool IsConst(lldb::opaque_compiler_type_t type)=0
virtual llvm::Expected< CompilerType > GetChildCompilerTypeAtIndex(lldb::opaque_compiler_type_t type, 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)=0
virtual void DumpTypeDescription(lldb::opaque_compiler_type_t type, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)=0
Dump the type to stdout.
static bool SupportsLanguageStatic(lldb::LanguageType language)
virtual CompilerDeclContext GetCompilerDeclContextForType(const CompilerType &type)
Returns the direct parent context of specified type.
virtual ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx)=0
virtual CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx, std::string &name, uint64_t *bit_offset_ptr, uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr)=0
virtual CompilerType CreateGenericFunctionPrototype()
virtual CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr)=0
virtual void Dump(llvm::raw_ostream &output)=0
Dump a textual representation of the internal TypeSystem state to the given stream.
virtual bool CanPassInRegisters(const CompilerType &type)=0
virtual CompilerType GetPointeeType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr)=0
virtual size_t GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type)=0
virtual bool SupportsLanguage(lldb::LanguageType language)=0
virtual CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)=0
virtual bool IsPolymorphicClass(lldb::opaque_compiler_type_t type)=0
virtual uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr)=0
virtual std::optional< CompilerType::IntegralTemplateArgument > GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack)
virtual bool Verify(lldb::opaque_compiler_type_t type)=0
Verify the integrity of the type to catch CompilerTypes that mix and match invalid TypeSystem/Opaque ...
virtual unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type)=0
virtual llvm::Expected< uint32_t > GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes, const ExecutionContext *exe_ctx)=0
virtual lldb::BasicType GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type)=0
virtual plugin::dwarf::DWARFASTParser * GetDWARFParser()
virtual CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type)=0
virtual ConstString GetDisplayTypeName(lldb::opaque_compiler_type_t type)=0
virtual int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type)=0
virtual lldb::TemplateArgumentKind GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack)
virtual bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type)=0
This is used by swift.
virtual CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size)=0
virtual bool ShouldTreatScalarValueAsAddress(lldb::opaque_compiler_type_t type)
virtual bool DumpTypeValue(lldb::opaque_compiler_type_t type, 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)=0
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language, Module *module)
virtual uint32_t GetNumFields(lldb::opaque_compiler_type_t type)=0
virtual bool IsTemplateType(lldb::opaque_compiler_type_t type)
virtual bool isA(const void *ClassID) const =0
virtual size_t DeclGetFunctionNumArguments(void *opaque_decl)
virtual bool IsForcefullyCompleted(lldb::opaque_compiler_type_t type)
virtual CompilerType GetPointerType(lldb::opaque_compiler_type_t type)=0
virtual bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type, CompilerType *target_type, bool check_cplusplus, bool check_objc)=0
virtual CompilerDeclContext DeclGetDeclContext(void *opaque_decl)
virtual size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type)=0
virtual uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type)=0
virtual CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type)
virtual bool IsScalarType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type)=0
virtual bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete)=0
virtual TypeMemberFunctionImpl GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx)=0
virtual CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, size_t idx)=0
Encapsulates a one-time expression for use in lldb.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
void * opaque_compiler_type_t
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Format
Display format definitions.
LanguageType
Programming language type.
Encoding
Register encoding definitions.
A type-erased pair of llvm::dwarf::SourceLanguageName and version.