Example #1
0
bool
LanguageCategory::Get (ValueObject& valobj,
                       lldb::DynamicValueType dynamic,
                       FormattersMatchVector matches,
                       lldb::SyntheticChildrenSP& format_sp)
{
    if (!m_category_sp)
        return false;
    
    if (!IsEnabled())
        return false;

    ConstString type_name = FormatManager::GetTypeForCache(valobj, dynamic);
    if (type_name)
    {
        if (m_format_cache.GetSynthetic(type_name, format_sp))
            return format_sp.get() != nullptr;
    }
    bool result = m_category_sp->Get(valobj, matches, format_sp);
    if (type_name && (!format_sp || !format_sp->NonCacheable()))
    {
        m_format_cache.SetSynthetic(type_name, format_sp);
    }
    return result;
}
Example #2
0
bool
LanguageCategory::GetHardcoded (ValueObject& valobj,
                                lldb::DynamicValueType use_dynamic,
                                FormatManager& fmt_mgr,
                                lldb::SyntheticChildrenSP& format_sp)
{
    if (!IsEnabled())
        return false;

    ConstString type_name = FormatManager::GetTypeForCache(valobj, use_dynamic);
    
    for (auto& candidate : m_hardcoded_synthetics)
    {
        if ((format_sp = candidate(valobj, use_dynamic, fmt_mgr)))
            break;
    }
    if (type_name && (!format_sp || !format_sp->NonCacheable()))
    {
        m_format_cache.SetSynthetic(type_name, format_sp);
    }
    return format_sp.get() != nullptr;
}