void
ClassDescriptorV2::iVarsStorage::fill (AppleObjCRuntimeV2& runtime, ClassDescriptorV2& descriptor)
{
    if (m_filled)
        return;
    Mutex::Locker lock(m_mutex);
    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES | LIBLLDB_LOG_VERBOSE));
    if (log)
        log->Printf("[ClassDescriptorV2::iVarsStorage::fill] class_name = %s", descriptor.GetClassName().AsCString("<unknown"));
    m_filled = true;
    ObjCLanguageRuntime::EncodingToTypeSP encoding_to_type_sp(runtime.GetEncodingToType());
    Process* process(runtime.GetProcess());
    if (!encoding_to_type_sp)
        return;
    descriptor.Describe(nullptr,
                        nullptr,
                        nullptr,
                        [this,process,encoding_to_type_sp,log](const char * name, const char * type, lldb::addr_t offset_ptr, uint64_t size) -> bool {
                 const bool for_expression = false;
                 const bool stop_loop = false;
                 if (log)
                     log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64,
                                 name,type,offset_ptr,size);
                 CompilerType ivar_type = encoding_to_type_sp->RealizeType(type, for_expression);
                 if (ivar_type)
                 {
                     if (log)
                         log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64 " , type_size = %" PRIu64,
                                     name,type,offset_ptr,size,ivar_type.GetByteSize(nullptr));
                     Scalar offset_scalar;
                     Error error;
                     const int offset_ptr_size = 4;
                     const bool is_signed = false;
                     size_t read = process->ReadScalarIntegerFromMemory(offset_ptr, offset_ptr_size, is_signed, offset_scalar, error);
                     if (error.Success() && 4 == read)
                     {
                         if (log)
                             log->Printf("[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64 " --> %" PRIu32,
                                         offset_ptr, offset_scalar.SInt());
                         m_ivars.push_back({ ConstString(name), ivar_type, size, offset_scalar.SInt() });
                     }
                     else if (log)
                         log->Printf("[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64 " --> read fail, read = %zu",
                                     offset_ptr, read);
                 }
                 return stop_loop;
             });
}
void
ClassDescriptorV2::iVarsStorage::fill (AppleObjCRuntimeV2& runtime, ClassDescriptorV2& descriptor)
{
    if (m_filled)
        return;
    Mutex::Locker lock(m_mutex);
    m_filled = true;
    ObjCLanguageRuntime::EncodingToTypeSP encoding_to_type_sp(runtime.GetEncodingToType());
    Process* process(runtime.GetProcess());
    if (!encoding_to_type_sp)
        return;
    descriptor.Describe(nullptr,
                        nullptr,
                        nullptr,
                        [this,process,encoding_to_type_sp](const char * name, const char * type, lldb::addr_t offset_ptr, uint64_t size) -> bool {
                 const bool allow_unknownanytype = false;
                 const bool stop_loop = false;
                 ClangASTType ivar_type = encoding_to_type_sp->RealizeType(type, allow_unknownanytype);
                 if (ivar_type)
                 {
                     Scalar offset_scalar;
                     Error error;
                     size_t read = process->ReadScalarIntegerFromMemory(offset_ptr, 4, true, offset_scalar, error);
                     if (error.Success() && 4 == read)
                         m_ivars.push_back({ ConstString(name), ivar_type, size, offset_scalar.SInt() });
                 }
                 return stop_loop;
             });
}