BlockPointerSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) : SyntheticChildrenFrontEnd(*valobj_sp), m_block_struct_type() { CompilerType block_pointer_type(m_backend.GetCompilerType()); CompilerType function_pointer_type; block_pointer_type.IsBlockPointerType(&function_pointer_type); TargetSP target_sp(m_backend.GetTargetSP()); if (!target_sp) { return; } Error err; TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage(&err, lldb::eLanguageTypeC_plus_plus); if (!err.Success() || !type_system) { return; } ClangASTContext *clang_ast_context = llvm::dyn_cast<ClangASTContext>(type_system); if (!clang_ast_context) { return; } ClangASTImporterSP clang_ast_importer = target_sp->GetClangASTImporter(); if (!clang_ast_importer) { return; } const char *const isa_name("__isa"); const CompilerType isa_type = clang_ast_context->GetBasicType(lldb::eBasicTypeObjCClass); const char *const flags_name("__flags"); const CompilerType flags_type = clang_ast_context->GetBasicType(lldb::eBasicTypeInt); const char *const reserved_name("__reserved"); const CompilerType reserved_type = clang_ast_context->GetBasicType(lldb::eBasicTypeInt); const char *const FuncPtr_name("__FuncPtr"); const CompilerType FuncPtr_type = clang_ast_importer->CopyType(*clang_ast_context, function_pointer_type); m_block_struct_type = clang_ast_context->CreateStructForIdentifier(ConstString(), { {isa_name, isa_type}, {flags_name, flags_type}, {reserved_name, reserved_type}, {FuncPtr_name, FuncPtr_type} }); }
virtual bool Update() { m_parent_format = m_backend.GetFormat(); CompilerType parent_type(m_backend.GetCompilerType()); CompilerType element_type; parent_type.IsVectorType(&element_type, nullptr); TargetSP target_sp(m_backend.GetTargetSP()); m_child_type = ::GetCompilerTypeForFormat(m_parent_format, element_type, target_sp ? target_sp->GetScratchTypeSystemForLanguage(nullptr, lldb::eLanguageTypeC) : nullptr); m_num_children = ::CalculateNumChildren(parent_type, m_child_type); m_item_format = GetItemFormatForFormat(m_parent_format, m_child_type); return false; }