LLDB mainline
lldb_private::ScratchTypeSystemClang Class Reference

The TypeSystemClang instance used for the scratch ASTContext in a lldb::Target. More...

#include <TypeSystemClang.h>

Inheritance diagram for lldb_private::ScratchTypeSystemClang:
[legend]

Public Types

enum  IsolatedASTKind { CppModules }
 The different kinds of isolated ASTs within the scratch TypeSystem. More...
Public Types inherited from lldb_private::TypeSystemClang
typedef void(* CompleteTagDeclCallback) (void *baton, clang::TagDecl *)
typedef void(* CompleteObjCInterfaceDeclCallback) (void *baton, clang::ObjCInterfaceDecl *)

Public Member Functions

 ScratchTypeSystemClang (Target &target, llvm::Triple triple)
 ~ScratchTypeSystemClang () override=default
void Finalize () override
 Free up any resources associated with this TypeSystem.
void Dump (llvm::raw_ostream &output, llvm::StringRef filter, bool show_color) override
UserExpressionGetUserExpression (llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj) override
FunctionCallerGetFunctionCaller (const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name) override
std::unique_ptr< UtilityFunctionCreateUtilityFunction (std::string text, std::string name) override
PersistentExpressionStateGetPersistentExpressionState () override
void ForgetSource (clang::ASTContext *src_ctx, ClangASTImporter &importer)
 Unregisters the given ASTContext as a source from the scratch AST (and all sub-ASTs).
bool isA (const void *ClassID) const override
Public Member Functions inherited from lldb_private::TypeSystemClang
bool isA (const void *ClassID) const override
 TypeSystemClang (llvm::StringRef name, llvm::Triple triple)
 Constructs a TypeSystemClang with an ASTContext using the given triple.
 TypeSystemClang (llvm::StringRef name, clang::ASTContext &existing_ctxt)
 Constructs a TypeSystemClang that uses an existing ASTContext internally.
 ~TypeSystemClang () override
void Finalize () override
 Free up any resources associated with this TypeSystem.
llvm::StringRef GetPluginName () override
llvm::StringRef getDisplayName () const
 Returns the display name of this TypeSystemClang that indicates what purpose it serves in LLDB.
clang::ASTContext & getASTContext () const
 Returns the clang::ASTContext instance managed by this TypeSystemClang.
clang::MangleContext * getMangleContext ()
std::shared_ptr< clang::TargetOptions > & getTargetOptions ()
clang::TargetInfo * getTargetInfo ()
void setSema (clang::Sema *s)
clang::Sema * getSema ()
const char * GetTargetTriple ()
void SetExternalSource (llvm::IntrusiveRefCntPtr< clang::ExternalASTSource > ast_source_sp)
bool GetCompleteDecl (clang::Decl *decl)
void SetMetadataAsUserID (const clang::Decl *decl, lldb::user_id_t user_id)
void SetMetadataAsUserID (const clang::Type *type, lldb::user_id_t user_id)
void SetMetadata (const clang::Decl *object, ClangASTMetadata meta_data)
void SetMetadata (const clang::Type *object, ClangASTMetadata meta_data)
std::optional< ClangASTMetadataGetMetadata (const clang::Decl *object)
std::optional< ClangASTMetadataGetMetadata (const clang::Type *object)
void SetCXXRecordDeclAccess (const clang::CXXRecordDecl *object, clang::AccessSpecifier access)
clang::AccessSpecifier GetCXXRecordDeclAccess (const clang::CXXRecordDecl *object)
CompilerType GetBuiltinTypeForEncodingAndBitSize (lldb::Encoding encoding, size_t bit_size) override
CompilerType GetBasicType (lldb::BasicType type)
CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize (llvm::StringRef type_name, uint32_t dw_ate, uint32_t bit_size)
CompilerType GetCStringType (bool is_const)
CompilerDeclContext GetCompilerDeclContextForType (const CompilerType &type) override
 Returns the direct parent context of specified type.
uint32_t GetPointerByteSize () override
clang::TranslationUnitDecl * GetTranslationUnitDecl ()
CompilerType GetType (clang::QualType qt)
 Creates a CompilerType from the given QualType with the current TypeSystemClang instance as the CompilerType's typesystem.
CompilerType GetTypeForDecl (clang::NamedDecl *decl)
CompilerType GetTypeForDecl (clang::TagDecl *decl)
CompilerType GetTypeForDecl (clang::ObjCInterfaceDecl *objc_decl)
CompilerType GetTypeForDecl (clang::ValueDecl *value_decl)
template<typename RecordDeclType>
CompilerType GetTypeForIdentifier (const clang::ASTContext &Ctx, llvm::StringRef type_name, clang::DeclContext *decl_context=nullptr)
CompilerType CreateStructForIdentifier (llvm::StringRef type_name, const std::initializer_list< std::pair< const char *, CompilerType > > &type_fields, bool packed=false)
CompilerType GetOrCreateStructForIdentifier (llvm::StringRef type_name, const std::initializer_list< std::pair< const char *, CompilerType > > &type_fields, bool packed=false)
uint32_t GetNumBaseClasses (const clang::CXXRecordDecl *cxx_record_decl, bool omit_empty_base_classes)
uint32_t GetIndexForRecordChild (const clang::RecordDecl *record_decl, clang::NamedDecl *canonical_decl, bool omit_empty_base_classes)
uint32_t GetIndexForRecordBase (const clang::RecordDecl *record_decl, const clang::CXXBaseSpecifier *base_spec, bool omit_empty_base_classes)
OptionalClangModuleID GetOrCreateClangModule (llvm::StringRef name, OptionalClangModuleID parent, bool is_framework=false, bool is_explicit=false)
 Synthesize a clang::Module and return its ID or a default-constructed ID.
CompilerType CreateRecordType (clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef name, int kind, lldb::LanguageType language, std::optional< ClangASTMetadata > metadata=std::nullopt, bool exports_symbols=false)
clang::FunctionTemplateDecl * CreateFunctionTemplateDecl (clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::FunctionDecl *func_decl, const TemplateParameterInfos &infos)
void CreateFunctionTemplateSpecializationInfo (clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template, const TemplateParameterInfos &infos)
clang::ClassTemplateDecl * CreateClassTemplateDecl (clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef class_name, int kind, const TemplateParameterInfos &infos)
clang::TemplateTemplateParmDecl * CreateTemplateTemplateParmDecl (const char *template_name)
clang::ClassTemplateSpecializationDecl * CreateClassTemplateSpecializationDecl (clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::ClassTemplateDecl *class_template_decl, int kind, const TemplateParameterInfos &infos)
CompilerType CreateClassTemplateSpecializationType (clang::ClassTemplateSpecializationDecl *class_template_specialization_decl)
bool FieldIsBitfield (clang::FieldDecl *field, uint32_t &bitfield_bit_size)
bool RecordHasFields (const clang::RecordDecl *record_decl)
bool BaseSpecifierIsEmpty (const clang::CXXBaseSpecifier *b)
CompilerType CreateObjCClass (llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool isInternal, std::optional< ClangASTMetadata > metadata=std::nullopt)
clang::NamespaceDecl * GetUniqueNamespaceDeclaration (const char *name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool is_inline=false)
clang::FunctionDecl * CreateFunctionDeclaration (clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, llvm::StringRef name, const CompilerType &function_Type, clang::StorageClass storage, bool is_inline, llvm::StringRef asm_label)
CompilerType CreateFunctionType (const CompilerType &result_type, llvm::ArrayRef< CompilerType > args, bool is_variadic, unsigned type_quals, clang::CallingConv cc=clang::CC_C, clang::RefQualifierKind ref_qual=clang::RQ_None)
clang::ParmVarDecl * CreateParameterDeclaration (clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const char *name, const CompilerType &param_type, int storage, bool add_decl=false)
CompilerType CreateBlockPointerType (const CompilerType &function_type)
CompilerType CreateArrayType (const CompilerType &element_type, std::optional< size_t > element_count, bool is_vector)
CompilerType CreateEnumerationType (llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const Declaration &decl, const CompilerType &integer_qual_type, bool is_scoped, std::optional< clang::EnumExtensibilityAttr::Kind > enum_kind=std::nullopt)
CompilerType GetIntTypeFromBitSize (size_t bit_size, bool is_signed)
CompilerType GetPointerSizedIntType (bool is_signed)
plugin::dwarf::DWARFASTParserGetDWARFParser () override
PDBASTParserGetPDBParser () override
npdb::PdbAstBuilderGetNativePDBParser () override
void CompleteTagDecl (clang::TagDecl *)
void CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *)
bool LayoutRecordType (const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, llvm::DenseMap< const clang::FieldDecl *, uint64_t > &field_offsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &base_offsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &vbase_offsets)
CompilerDecl GetCompilerDecl (clang::Decl *decl)
 Creates a CompilerDecl from the given Decl with the current TypeSystemClang instance as its typesystem.
ConstString DeclGetName (void *opaque_decl) override
ConstString DeclGetMangledName (void *opaque_decl) override
CompilerDeclContext DeclGetDeclContext (void *opaque_decl) override
CompilerType DeclGetFunctionReturnType (void *opaque_decl) override
size_t DeclGetFunctionNumArguments (void *opaque_decl) override
CompilerType DeclGetFunctionArgumentType (void *opaque_decl, size_t arg_idx) override
std::vector< lldb_private::CompilerContextDeclGetCompilerContext (void *opaque_decl) override
Scalar DeclGetConstantValue (void *opaque_decl) override
CompilerType GetTypeForDecl (void *opaque_decl) override
CompilerDeclContext CreateDeclContext (clang::DeclContext *ctx)
 Creates a CompilerDeclContext from the given DeclContext with the current TypeSystemClang instance as its typesystem.
std::vector< CompilerDeclDeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name, const bool ignore_using_decls) override
ConstString DeclContextGetName (void *opaque_decl_ctx) override
ConstString DeclContextGetScopeQualifiedName (void *opaque_decl_ctx) override
bool DeclContextIsClassMethod (void *opaque_decl_ctx) override
bool DeclContextIsContainedInLookup (void *opaque_decl_ctx, void *other_opaque_decl_ctx) override
lldb::LanguageType DeclContextGetLanguage (void *opaque_decl_ctx) override
std::vector< lldb_private::CompilerContextDeclContextGetCompilerContext (void *opaque_decl_ctx) override
bool Verify (lldb::opaque_compiler_type_t type) override
 Verify the integrity of the type to catch CompilerTypes that mix and match invalid TypeSystem/Opaque type pairs.
bool IsArrayType (lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override
bool IsVectorType (lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size) override
bool IsAggregateType (lldb::opaque_compiler_type_t type) override
bool IsAnonymousType (lldb::opaque_compiler_type_t type) override
bool IsBeingDefined (lldb::opaque_compiler_type_t type) override
bool IsCharType (lldb::opaque_compiler_type_t type) override
bool IsCompleteType (lldb::opaque_compiler_type_t type) override
bool IsConst (lldb::opaque_compiler_type_t type) override
bool IsCStringType (lldb::opaque_compiler_type_t type, uint32_t &length)
bool IsDefined (lldb::opaque_compiler_type_t type) override
bool IsFloatingPointType (lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override
unsigned GetPtrAuthKey (lldb::opaque_compiler_type_t type) override
unsigned GetPtrAuthDiscriminator (lldb::opaque_compiler_type_t type) override
bool GetPtrAuthAddressDiversity (lldb::opaque_compiler_type_t type) override
bool IsFunctionType (lldb::opaque_compiler_type_t type) override
uint32_t IsHomogeneousAggregate (lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) override
size_t GetNumberOfFunctionArguments (lldb::opaque_compiler_type_t type) override
CompilerType GetFunctionArgumentAtIndex (lldb::opaque_compiler_type_t type, const size_t index) override
bool IsFunctionPointerType (lldb::opaque_compiler_type_t type) override
bool IsMemberFunctionPointerType (lldb::opaque_compiler_type_t type) override
bool IsBlockPointerType (lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr) override
bool IsIntegerType (lldb::opaque_compiler_type_t type, bool &is_signed) override
bool IsEnumerationType (lldb::opaque_compiler_type_t type, bool &is_signed) override
bool IsScopedEnumerationType (lldb::opaque_compiler_type_t type) override
bool IsPolymorphicClass (lldb::opaque_compiler_type_t type) override
bool IsPossibleDynamicType (lldb::opaque_compiler_type_t type, CompilerType *target_type, bool check_cplusplus, bool check_objc) override
bool IsRuntimeGeneratedType (lldb::opaque_compiler_type_t type) override
 This is used by swift.
bool IsPointerType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override
bool IsPointerOrReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override
bool IsReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool *is_rvalue) override
bool IsScalarType (lldb::opaque_compiler_type_t type) override
bool IsTypedefType (lldb::opaque_compiler_type_t type) override
bool IsVoidType (lldb::opaque_compiler_type_t type) override
bool CanPassInRegisters (const CompilerType &type) override
bool SupportsLanguage (lldb::LanguageType language) override
bool GetCompleteType (lldb::opaque_compiler_type_t type) override
bool IsForcefullyCompleted (lldb::opaque_compiler_type_t type) override
ConstString GetTypeName (lldb::opaque_compiler_type_t type, bool base_only) override
ConstString GetDisplayTypeName (lldb::opaque_compiler_type_t type) override
uint32_t GetTypeInfo (lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type) override
lldb::LanguageType GetMinimumLanguage (lldb::opaque_compiler_type_t type) override
lldb::TypeClass GetTypeClass (lldb::opaque_compiler_type_t type) override
unsigned GetTypeQualifiers (lldb::opaque_compiler_type_t type) override
CompilerType GetArrayElementType (lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
CompilerType GetArrayType (lldb::opaque_compiler_type_t type, uint64_t size) override
CompilerType GetCanonicalType (lldb::opaque_compiler_type_t type) override
CompilerType GetFullyUnqualifiedType (lldb::opaque_compiler_type_t type) override
CompilerType GetEnumerationIntegerType (lldb::opaque_compiler_type_t type) override
int GetFunctionArgumentCount (lldb::opaque_compiler_type_t type) override
CompilerType GetFunctionArgumentTypeAtIndex (lldb::opaque_compiler_type_t type, size_t idx) override
CompilerType GetFunctionReturnType (lldb::opaque_compiler_type_t type) override
size_t GetNumMemberFunctions (lldb::opaque_compiler_type_t type) override
TypeMemberFunctionImpl GetMemberFunctionAtIndex (lldb::opaque_compiler_type_t type, size_t idx) override
CompilerType GetNonReferenceType (lldb::opaque_compiler_type_t type) override
CompilerType GetPointeeType (lldb::opaque_compiler_type_t type) override
CompilerType GetPointerType (lldb::opaque_compiler_type_t type) override
CompilerType GetLValueReferenceType (lldb::opaque_compiler_type_t type) override
CompilerType GetRValueReferenceType (lldb::opaque_compiler_type_t type) override
CompilerType GetAtomicType (lldb::opaque_compiler_type_t type) override
CompilerType AddConstModifier (lldb::opaque_compiler_type_t type) override
CompilerType AddPtrAuthModifier (lldb::opaque_compiler_type_t type, uint32_t payload) override
CompilerType AddVolatileModifier (lldb::opaque_compiler_type_t type) override
CompilerType AddRestrictModifier (lldb::opaque_compiler_type_t type) override
CompilerType CreateTypedef (lldb::opaque_compiler_type_t type, const char *name, const CompilerDeclContext &decl_ctx, uint32_t opaque_payload) override
 Using the current type, create a new typedef to that type using "typedef_name" as the name and "decl_ctx" as the decl context.
CompilerType GetTypedefedType (lldb::opaque_compiler_type_t type) override
CompilerType GetBasicTypeFromAST (lldb::BasicType basic_type) override
CompilerType CreateGenericFunctionPrototype () override
const llvm::fltSemantics & GetFloatTypeSemantics (size_t byte_size, lldb::Format format) override
llvm::Expected< uint64_t > GetByteSize (lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)
llvm::Expected< uint64_t > GetBitSize (lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
lldb::Encoding GetEncoding (lldb::opaque_compiler_type_t type, uint64_t &count) override
lldb::Format GetFormat (lldb::opaque_compiler_type_t type) override
std::optional< size_t > GetTypeBitAlign (lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
llvm::Expected< uint32_t > GetNumChildren (lldb::opaque_compiler_type_t type, bool omit_empty_base_classes, const ExecutionContext *exe_ctx) override
CompilerType GetBuiltinTypeByName (ConstString name) override
lldb::BasicType GetBasicTypeEnumeration (lldb::opaque_compiler_type_t type) override
void ForEachEnumerator (lldb::opaque_compiler_type_t type, std::function< bool(const CompilerType &integer_type, ConstString name, const llvm::APSInt &value)> const &callback) override
uint32_t GetNumFields (lldb::opaque_compiler_type_t type) override
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) override
uint32_t GetNumDirectBaseClasses (lldb::opaque_compiler_type_t type) override
uint32_t GetNumVirtualBaseClasses (lldb::opaque_compiler_type_t type) override
CompilerType GetDirectBaseClassAtIndex (lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
CompilerType GetVirtualBaseClassAtIndex (lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
CompilerDecl GetStaticFieldWithName (lldb::opaque_compiler_type_t type, llvm::StringRef name) override
llvm::Expected< CompilerTypeGetDereferencedType (lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, std::string &deref_name, uint32_t &deref_byte_size, int32_t &deref_byte_offset, ValueObject *valobj, uint64_t &language_flags) override
llvm::Expected< CompilerTypeGetChildCompilerTypeAtIndex (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) override
llvm::Expected< uint32_t > GetIndexOfChildWithName (lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes) override
size_t GetIndexOfChildMemberWithName (lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes) override
CompilerType GetDirectNestedTypeWithName (lldb::opaque_compiler_type_t type, llvm::StringRef name) override
bool IsTemplateType (lldb::opaque_compiler_type_t type) override
size_t GetNumTemplateArguments (lldb::opaque_compiler_type_t type, bool expand_pack) override
lldb::TemplateArgumentKind GetTemplateArgumentKind (lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack) override
CompilerType GetTypeTemplateArgument (lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack) override
std::optional< CompilerType::IntegralTemplateArgumentGetIntegralTemplateArgument (lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack) override
CompilerType GetTypeForFormatters (void *type) override
uint32_t CountDeclLevels (clang::DeclContext *frame_decl_ctx, clang::DeclContext *child_decl_ctx, ConstString *child_name=nullptr, CompilerType *child_type=nullptr)
llvm::SmallVector< clang::ParmVarDecl * > CreateParameterDeclarations (clang::FunctionDecl *context, const clang::FunctionProtoType &prototype, const llvm::SmallVector< llvm::StringRef > &param_names)
 For each parameter type of prototype, creates a clang::ParmVarDecl whose clang::DeclContext is context.
clang::CXXMethodDecl * AddMethodToCXXRecordType (lldb::opaque_compiler_type_t type, llvm::StringRef name, llvm::StringRef asm_label, const CompilerType &method_type, lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, bool is_explicit, bool is_attr_used, bool is_artificial)
void AddMethodOverridesForCXXRecordType (lldb::opaque_compiler_type_t type)
std::unique_ptr< clang::CXXBaseSpecifier > CreateBaseClassSpecifier (lldb::opaque_compiler_type_t type, lldb::AccessType access, bool is_virtual, bool base_of_class)
bool TransferBaseClasses (lldb::opaque_compiler_type_t type, std::vector< std::unique_ptr< clang::CXXBaseSpecifier > > bases)
clang::EnumConstantDecl * AddEnumerationValueToEnumerationType (const CompilerType &enum_type, const Declaration &decl, const char *name, uint64_t enum_value, uint32_t enum_value_bit_size)
clang::EnumConstantDecl * AddEnumerationValueToEnumerationType (const CompilerType &enum_type, const Declaration &decl, const char *name, const llvm::APSInt &value)
CompilerType GetEnumerationIntegerType (CompilerType type)
 Returns the underlying integer type for an enum type.
LLVM_DUMP_METHOD void dump (lldb::opaque_compiler_type_t type) const override
 Convenience LLVM-style dump method for use in the debugger only.
void Dump (llvm::raw_ostream &output, llvm::StringRef filter, bool show_color) override
void DumpFromSymbolFile (Stream &s, llvm::StringRef symbol_name)
 Dump clang AST types from the symbol file.
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) override
void DumpTypeDescription (lldb::opaque_compiler_type_t type, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) override
 Dump the type to stdout.
void DumpTypeDescription (lldb::opaque_compiler_type_t type, Stream &s, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) override
 Print a description of the type to a stream.
clang::ClassTemplateDecl * ParseClassTemplateDecl (clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, const char *parent_name, int tag_decl_kind, const TypeSystemClang::TemplateParameterInfos &template_param_infos)
clang::BlockDecl * CreateBlockDeclaration (clang::DeclContext *ctx, OptionalClangModuleID owning_module)
clang::UsingDirectiveDecl * CreateUsingDirectiveDeclaration (clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::NamespaceDecl *ns_decl)
clang::UsingDecl * CreateUsingDeclaration (clang::DeclContext *current_decl_ctx, OptionalClangModuleID owning_module, clang::NamedDecl *target)
clang::VarDecl * CreateVariableDeclaration (clang::DeclContext *decl_context, OptionalClangModuleID owning_module, const char *name, clang::QualType type)
clang::DeclarationName GetDeclarationName (llvm::StringRef name, const CompilerType &function_clang_type)
clang::LangOptions * GetLangOpts () const
clang::SourceManager * GetSourceMgr () const
bool SetDeclIsForcefullyCompleted (const clang::TagDecl *td)
Public Member Functions inherited from lldb_private::TypeSystem
 TypeSystem ()
 ~TypeSystem () override
virtual SymbolFileGetSymbolFile () const
virtual void SetSymbolFile (SymbolFile *sym_file)
virtual ConstString GetMangledTypeName (lldb::opaque_compiler_type_t type)
 Defaults to GetTypeName(type).
virtual bool ShouldTreatScalarValueAsAddress (lldb::opaque_compiler_type_t type)
virtual LazyBool ShouldPrintAsOneLiner (void *type, ValueObject *valobj)
virtual bool IsMeaninglessWithoutDynamicResolution (void *type)
virtual std::optional< llvm::json::Value > ReportStatistics ()
bool GetHasForcefullyCompletedTypes () const
Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
virtual ~PluginInterface ()=default
 PluginInterface (const PluginInterface &)=delete
PluginInterfaceoperator= (const PluginInterface &)=delete

Static Public Member Functions

static std::optional< IsolatedASTKindInferIsolatedASTKindFromLangOpts (const clang::LangOptions &l)
 Infers the appropriate sub-AST from Clang's LangOptions.
static lldb::TypeSystemClangSP GetForTarget (Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
 Returns the scratch TypeSystemClang for the given target.
static lldb::TypeSystemClangSP GetForTarget (Target &target, const clang::LangOptions &lang_opts)
 Returns the scratch TypeSystemClang for the given target.
static bool classof (const TypeSystem *ts)
Static Public Member Functions inherited from lldb_private::TypeSystemClang
static bool classof (const TypeSystem *ts)
static llvm::StringRef GetPluginNameStatic ()
static lldb::TypeSystemSP CreateInstance (lldb::LanguageType language, Module *module, Target *target)
static LanguageSet GetSupportedLanguagesForTypes ()
static LanguageSet GetSupportedLanguagesForExpressions ()
static void Initialize ()
static void Terminate ()
static TypeSystemClangGetASTContext (clang::ASTContext *ast_ctx)
static void DumpDeclHiearchy (clang::Decl *decl)
static void DumpDeclContextHiearchy (clang::DeclContext *decl_ctx)
static bool GetCompleteDecl (clang::ASTContext *ast, clang::Decl *decl)
static lldb::BasicType GetBasicTypeEnumeration (llvm::StringRef name)
static clang::DeclContext * GetDeclContextForType (clang::QualType type)
static clang::DeclContext * GetDeclContextForType (const CompilerType &type)
static bool AreTypesSame (CompilerType type1, CompilerType type2, bool ignore_qualifiers=false)
static bool IsOperator (llvm::StringRef name, clang::OverloadedOperatorKind &op_kind)
static clang::AccessSpecifier ConvertAccessTypeToAccessSpecifier (lldb::AccessType access)
static clang::AccessSpecifier UnifyAccessSpecifiers (clang::AccessSpecifier lhs, clang::AccessSpecifier rhs)
static clang::DeclContext * GetAsDeclContext (clang::FunctionDecl *function_decl)
static bool CheckOverloadedOperatorKindParameterCount (bool is_method, clang::OverloadedOperatorKind op_kind, uint32_t num_params)
static CompilerType GetFloatTypeFromBitSize (clang::ASTContext *ast, size_t bit_size)
static void SetOwningModule (clang::Decl *decl, OptionalClangModuleID owning_module)
 Set the owning module for decl.
static clang::DeclContext * DeclContextGetAsDeclContext (const CompilerDeclContext &dc)
static clang::ObjCMethodDecl * DeclContextGetAsObjCMethodDecl (const CompilerDeclContext &dc)
static clang::CXXMethodDecl * DeclContextGetAsCXXMethodDecl (const CompilerDeclContext &dc)
static clang::FunctionDecl * DeclContextGetAsFunctionDecl (const CompilerDeclContext &dc)
static clang::NamespaceDecl * DeclContextGetAsNamespaceDecl (const CompilerDeclContext &dc)
static std::optional< ClangASTMetadataDeclContextGetMetaData (const CompilerDeclContext &dc, const clang::Decl *object)
static clang::ASTContext * DeclContextGetTypeSystemClang (const CompilerDeclContext &dc)
static bool IsCXXClassType (const CompilerType &type)
static bool IsObjCClassType (const CompilerType &type)
static bool IsObjCObjectOrInterfaceType (const CompilerType &type)
static bool IsObjCObjectPointerType (const CompilerType &type, CompilerType *target_type=nullptr)
static bool IsClassType (lldb::opaque_compiler_type_t type)
static bool IsEnumType (lldb::opaque_compiler_type_t type)
static std::optional< std::string > GetCXXClassName (const CompilerType &type)
static uint32_t GetNumPointeeChildren (clang::QualType type)
static clang::FieldDecl * AddFieldToRecordType (const CompilerType &type, llvm::StringRef name, const CompilerType &field_type, lldb::AccessType access, uint32_t bitfield_bit_size)
static void BuildIndirectFields (const CompilerType &type)
static void SetIsPacked (const CompilerType &type)
static clang::VarDecl * AddVariableToRecordType (const CompilerType &type, llvm::StringRef name, const CompilerType &var_type, lldb::AccessType access)
static void SetIntegerInitializerForVariable (clang::VarDecl *var, const llvm::APInt &init_value)
 Initializes a variable with an integer value.
static void SetFloatingInitializerForVariable (clang::VarDecl *var, const llvm::APFloat &init_value)
 Initializes a variable with a floating point value.
static bool SetObjCSuperClass (const CompilerType &type, const CompilerType &superclass_compiler_type)
static bool AddObjCClassProperty (const CompilerType &type, const char *property_name, const CompilerType &property_compiler_type, clang::ObjCIvarDecl *ivar_decl, const char *property_setter_name, const char *property_getter_name, uint32_t property_attributes, ClangASTMetadata metadata)
static clang::ObjCMethodDecl * AddMethodToObjCObjectType (const CompilerType &type, const char *name, const CompilerType &method_compiler_type, bool is_artificial, bool is_variadic, bool is_objc_direct_call)
static bool SetHasExternalStorage (lldb::opaque_compiler_type_t type, bool has_extern)
static bool StartTagDeclarationDefinition (const CompilerType &type)
static bool CompleteTagDeclarationDefinition (const CompilerType &type)
static CompilerType CreateMemberPointerType (const CompilerType &type, const CompilerType &pointee_type)
static void DumpTypeName (const CompilerType &type)
static clang::EnumDecl * GetAsEnumDecl (const CompilerType &type)
static clang::RecordDecl * GetAsRecordDecl (const CompilerType &type)
static clang::TagDecl * GetAsTagDecl (const CompilerType &type)
static clang::TypedefNameDecl * GetAsTypedefDecl (const CompilerType &type)
static clang::CXXRecordDecl * GetAsCXXRecordDecl (lldb::opaque_compiler_type_t type)
static clang::ObjCInterfaceDecl * GetAsObjCInterfaceDecl (const CompilerType &type)
static lldb::opaque_compiler_type_t GetOpaqueCompilerType (clang::ASTContext *ast, lldb::BasicType basic_type)
static clang::QualType GetQualType (lldb::opaque_compiler_type_t type)
static clang::QualType GetCanonicalQualType (lldb::opaque_compiler_type_t type)
static void RequireCompleteType (CompilerType type)
 Complete a type from debug info, or mark it as forcefully completed if there is no definition of the type in the current Module.
Static Public Member Functions inherited from lldb_private::TypeSystem
static lldb::TypeSystemSP CreateInstance (lldb::LanguageType language, Module *module)
static lldb::TypeSystemSP CreateInstance (lldb::LanguageType language, Target *target)
static bool SupportsLanguageStatic (lldb::LanguageType language)

Static Public Attributes

static const std::nullopt_t DefaultAST = std::nullopt
 Alias for requesting the default scratch TypeSystemClang in GetForTarget.

Private Types

typedef int IsolatedASTKey

Private Member Functions

std::unique_ptr< ClangASTSourceCreateASTSource ()
TypeSystemClangGetIsolatedAST (IsolatedASTKind feature)
 Returns the requested sub-AST.

Private Attributes

llvm::Triple m_triple
 The target triple.
lldb::TargetWP m_target_wp
std::unique_ptr< ClangPersistentVariablesm_persistent_variables
 The persistent variables associated with this process for the expression parser.
std::unique_ptr< ClangASTSourcem_scratch_ast_source_up
 The ExternalASTSource that performs lookups and completes minimally imported types.
llvm::DenseMap< IsolatedASTKey, std::shared_ptr< TypeSystemClang > > m_isolated_asts
 Map from IsolatedASTKind to their actual TypeSystemClang instance.

Static Private Attributes

static char ID
 LLVM RTTI support.

Additional Inherited Members

Protected Attributes inherited from lldb_private::TypeSystem
SymbolFilem_sym_file = nullptr
bool m_has_forcefully_completed_types = false
 Used for reporting statistics.

Detailed Description

The TypeSystemClang instance used for the scratch ASTContext in a lldb::Target.

Definition at line 1256 of file TypeSystemClang.h.

Member Typedef Documentation

◆ IsolatedASTKey

Definition at line 1372 of file TypeSystemClang.h.

Member Enumeration Documentation

◆ IsolatedASTKind

The different kinds of isolated ASTs within the scratch TypeSystem.

These ASTs are isolated from the main scratch AST and are each dedicated to a special language option/feature that makes the contained AST nodes incompatible with other AST nodes.

Enumerator
CppModules 

The isolated AST for declarations/types from expressions that imported type information from a C++ module.

The templates from a C++ module often conflict with the templates we generate from debug information, so we put these types in their own AST.

Definition at line 1272 of file TypeSystemClang.h.

Constructor & Destructor Documentation

◆ ScratchTypeSystemClang()

ScratchTypeSystemClang::ScratchTypeSystemClang ( Target & target,
llvm::Triple triple )

◆ ~ScratchTypeSystemClang()

lldb_private::ScratchTypeSystemClang::~ScratchTypeSystemClang ( )
overridedefault

Member Function Documentation

◆ classof()

bool lldb_private::ScratchTypeSystemClang::classof ( const TypeSystem * ts)
inlinestatic

Definition at line 1351 of file TypeSystemClang.h.

References ID, and lldb_private::TypeSystem::isA().

◆ CreateASTSource()

std::unique_ptr< ClangASTSource > ScratchTypeSystemClang::CreateASTSource ( )
private

Definition at line 9780 of file TypeSystemClang.cpp.

References m_persistent_variables, and m_target_wp.

Referenced by GetIsolatedAST(), and ScratchTypeSystemClang().

◆ CreateUtilityFunction()

std::unique_ptr< UtilityFunction > ScratchTypeSystemClang::CreateUtilityFunction ( std::string text,
std::string name )
overridevirtual

Reimplemented from lldb_private::TypeSystem.

Definition at line 9755 of file TypeSystemClang.cpp.

References m_target_wp.

◆ Dump()

void ScratchTypeSystemClang::Dump ( llvm::raw_ostream & output,
llvm::StringRef filter,
bool show_color )
overridevirtual

◆ Finalize()

void ScratchTypeSystemClang::Finalize ( )
overridevirtual

Free up any resources associated with this TypeSystem.

Done before removing all the TypeSystems from the TypeSystemMap.

Reimplemented from lldb_private::TypeSystem.

Definition at line 9665 of file TypeSystemClang.cpp.

References lldb_private::TypeSystemClang::Finalize(), and m_scratch_ast_source_up.

◆ ForgetSource()

void ScratchTypeSystemClang::ForgetSource ( clang::ASTContext * src_ctx,
ClangASTImporter & importer )

Unregisters the given ASTContext as a source from the scratch AST (and all sub-ASTs).

See also
ClangASTImporter::ForgetSource

Definition at line 9771 of file TypeSystemClang.cpp.

References lldb_private::ClangASTImporter::ForgetSource(), lldb_private::TypeSystemClang::getASTContext(), and m_isolated_asts.

Referenced by lldb_private::ClangASTSource::~ClangASTSource().

◆ GetForTarget() [1/2]

lldb::TypeSystemClangSP lldb_private::ScratchTypeSystemClang::GetForTarget ( Target & target,
const clang::LangOptions & lang_opts )
inlinestatic

Returns the scratch TypeSystemClang for the given target.

The returned TypeSystemClang will be the scratch AST or a sub-AST, depending on which fits best to the passed LangOptions.

Parameters
targetThe Target which scratch TypeSystemClang should be returned.
lang_optsThe LangOptions of a clang ASTContext that the caller wants to export type information from. This is used to find the best matching sub-AST that will be returned.

Definition at line 1317 of file TypeSystemClang.h.

References GetForTarget(), and InferIsolatedASTKindFromLangOpts().

◆ GetForTarget() [2/2]

TypeSystemClangSP ScratchTypeSystemClang::GetForTarget ( Target & target,
std::optional< IsolatedASTKind > ast_kind = DefaultAST,
bool create_on_demand = true )
static

Returns the scratch TypeSystemClang for the given target.

Parameters
targetThe Target which scratch TypeSystemClang should be returned.
ast_kindAllows requesting a specific sub-AST instead of the default scratch AST. See also IsolatedASTKind.
create_on_demandIf the scratch TypeSystemClang instance can be created by this call if it doesn't exist yet. If it doesn't exist yet and this parameter is false, this function returns a nullptr.
Returns
The scratch type system of the target or a nullptr in case an error occurred.

Definition at line 9671 of file TypeSystemClang.cpp.

References DefaultAST, lldb::eLanguageTypeC, GetIsolatedAST(), lldb_private::GetLog(), lldb_private::Target::GetScratchTypeSystemForLanguage(), LLDB_LOG_ERROR, ScratchTypeSystemClang(), and lldb_private::Target.

Referenced by lldb_private::ASTResultSynthesizer::CommitPersistentDecls(), lldb_private::PlatformWindows::DoLoadImage(), ExtractFields(), lldb_private::formatters::GenericNSArrayISyntheticFrontEnd< D32, D64, Inline >::GenericNSArrayISyntheticFrontEnd(), lldb_private::AppleObjCRuntime::GetBacktraceThreadFromException(), lldb_private::formatters::NSArray1SyntheticFrontEnd::GetChildAtIndex(), lldb_private::AppleGetQueuesHandler::GetCurrentQueues(), lldb_private::ItaniumABILanguageRuntime::GetExceptionObjectForThread(), GetForTarget(), lldb_private::AppleGetItemInfoHandler::GetItemInfo(), GetLLDBNSPairType(), lldb_private::AppleObjCRuntime::GetObjectDescription(), lldb_private::AppleGetPendingItemsHandler::GetPendingItems(), lldb_private::ClangExpressionDeclMap::GetPersistentDecl(), lldb_private::RegisterTypeBuilderClang::GetRegisterType(), lldb_private::ClangExpressionDeclMap::GetScratchContext(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), lldb_private::AppleGetThreadItemInfoHandler::GetThreadItemInfo(), lldb_private::DynamicLoaderDarwin::GetThreadLocalData(), DynamicLoaderMacOS::NotifyBreakpointHit(), DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(), lldb_private::formatters::NSArrayMSyntheticFrontEndBase::NSArrayMSyntheticFrontEndBase(), lldb_private::formatters::NSError_SummaryProvider(), SystemRuntimeMacOSX::ReadLibdispatchTSDIndexes(), lldb_private::AbortWithPayloadFrameRecognizer::RecognizeFrame(), lldb_private::AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(), lldb_private::AppleObjCTrampolineHandler::SetupDispatchFunction(), lldb_private::AppleGetPendingItemsHandler::SetupGetPendingItemsFunction(), lldb_private::AppleGetQueuesHandler::SetupGetQueuesFunction(), lldb_private::AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction(), NSErrorSyntheticFrontEnd::Update(), NSIndexPathSyntheticFrontEnd::Update(), lldb_private::ClangExpressionDeclMap::WillParse(), and lldb_private::ClangASTSource::~ClangASTSource().

◆ GetFunctionCaller()

FunctionCaller * ScratchTypeSystemClang::GetFunctionCaller ( const CompilerType & return_type,
const Address & function_address,
const ValueList & arg_value_list,
const char * name )
overridevirtual

Reimplemented from lldb_private::TypeSystem.

Definition at line 9739 of file TypeSystemClang.cpp.

References m_target_wp.

◆ GetIsolatedAST()

TypeSystemClang & ScratchTypeSystemClang::GetIsolatedAST ( ScratchTypeSystemClang::IsolatedASTKind feature)
private

Returns the requested sub-AST.

Will lazily create the sub-AST if it hasn't been created before.

Definition at line 9795 of file TypeSystemClang.cpp.

References CreateASTSource(), GetSpecializedASTName(), m_isolated_asts, m_triple, and lldb_private::TypeSystemClang::TypeSystemClang().

Referenced by GetForTarget().

◆ GetPersistentExpressionState()

PersistentExpressionState * ScratchTypeSystemClang::GetPersistentExpressionState ( )
overridevirtual

Reimplemented from lldb_private::TypeSystem.

Definition at line 9767 of file TypeSystemClang.cpp.

References m_persistent_variables.

◆ GetUserExpression()

UserExpression * ScratchTypeSystemClang::GetUserExpression ( llvm::StringRef expr,
llvm::StringRef prefix,
SourceLanguage language,
Expression::ResultType desired_type,
const EvaluateExpressionOptions & options,
ValueObject * ctx_obj )
overridevirtual

Reimplemented from lldb_private::TypeSystem.

Definition at line 9727 of file TypeSystemClang.cpp.

References m_target_wp.

◆ InferIsolatedASTKindFromLangOpts()

std::optional< IsolatedASTKind > lldb_private::ScratchTypeSystemClang::InferIsolatedASTKindFromLangOpts ( const clang::LangOptions & l)
inlinestatic

Infers the appropriate sub-AST from Clang's LangOptions.

Definition at line 1287 of file TypeSystemClang.h.

References CppModules, DefaultAST, and l.

Referenced by GetForTarget().

◆ isA()

bool lldb_private::ScratchTypeSystemClang::isA ( const void * ClassID) const
inlineoverridevirtual

Implements lldb_private::TypeSystem.

Definition at line 1348 of file TypeSystemClang.h.

References ID, and lldb_private::TypeSystemClang::isA().

Member Data Documentation

◆ DefaultAST

const std::nullopt_t ScratchTypeSystemClang::DefaultAST = std::nullopt
static

Alias for requesting the default scratch TypeSystemClang in GetForTarget.

Definition at line 1283 of file TypeSystemClang.h.

Referenced by GetForTarget(), InferIsolatedASTKindFromLangOpts(), and lldb_private::ClangASTSource::~ClangASTSource().

◆ ID

char ScratchTypeSystemClang::ID
staticprivate

LLVM RTTI support.

Definition at line 1258 of file TypeSystemClang.h.

Referenced by classof(), and isA().

◆ m_isolated_asts

llvm::DenseMap<IsolatedASTKey, std::shared_ptr<TypeSystemClang> > lldb_private::ScratchTypeSystemClang::m_isolated_asts
private

Map from IsolatedASTKind to their actual TypeSystemClang instance.

This map is lazily filled with sub-ASTs and should be accessed via GetSubAST (which lazily fills this map).

Definition at line 1378 of file TypeSystemClang.h.

Referenced by Dump(), ForgetSource(), and GetIsolatedAST().

◆ m_persistent_variables

std::unique_ptr<ClangPersistentVariables> lldb_private::ScratchTypeSystemClang::m_persistent_variables
private

The persistent variables associated with this process for the expression parser.

Definition at line 1366 of file TypeSystemClang.h.

Referenced by CreateASTSource(), GetPersistentExpressionState(), and ScratchTypeSystemClang().

◆ m_scratch_ast_source_up

std::unique_ptr<ClangASTSource> lldb_private::ScratchTypeSystemClang::m_scratch_ast_source_up
private

The ExternalASTSource that performs lookups and completes minimally imported types.

Definition at line 1369 of file TypeSystemClang.h.

Referenced by Finalize(), and ScratchTypeSystemClang().

◆ m_target_wp

lldb::TargetWP lldb_private::ScratchTypeSystemClang::m_target_wp
private

◆ m_triple

llvm::Triple lldb_private::ScratchTypeSystemClang::m_triple
private

The target triple.

This was potentially adjusted and might not be identical to the triple of m_target_wp.

Definition at line 1362 of file TypeSystemClang.h.

Referenced by GetIsolatedAST(), and ScratchTypeSystemClang().


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