1*0b57cec5SDimitry Andric //===-- FormatClasses.cpp -------------------------------------------------===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric
9*0b57cec5SDimitry Andric #include "lldb/DataFormatters/FormatClasses.h"
10*0b57cec5SDimitry Andric
11*0b57cec5SDimitry Andric #include "lldb/DataFormatters/FormatManager.h"
12*0b57cec5SDimitry Andric
13*0b57cec5SDimitry Andric
14*0b57cec5SDimitry Andric
15*0b57cec5SDimitry Andric
16*0b57cec5SDimitry Andric
17*0b57cec5SDimitry Andric using namespace lldb;
18*0b57cec5SDimitry Andric using namespace lldb_private;
19*0b57cec5SDimitry Andric
FormattersMatchData(ValueObject & valobj,lldb::DynamicValueType use_dynamic)20*0b57cec5SDimitry Andric FormattersMatchData::FormattersMatchData(ValueObject &valobj,
21*0b57cec5SDimitry Andric lldb::DynamicValueType use_dynamic)
22*0b57cec5SDimitry Andric : m_valobj(valobj), m_dynamic_value_type(use_dynamic),
23*0b57cec5SDimitry Andric m_formatters_match_vector({}, false), m_type_for_cache(),
24*0b57cec5SDimitry Andric m_candidate_languages() {
25*0b57cec5SDimitry Andric m_type_for_cache = FormatManager::GetTypeForCache(valobj, use_dynamic);
26*0b57cec5SDimitry Andric m_candidate_languages =
27*0b57cec5SDimitry Andric FormatManager::GetCandidateLanguages(valobj.GetObjectRuntimeLanguage());
28*0b57cec5SDimitry Andric }
29*0b57cec5SDimitry Andric
GetMatchesVector()30*0b57cec5SDimitry Andric FormattersMatchVector FormattersMatchData::GetMatchesVector() {
31*0b57cec5SDimitry Andric if (!m_formatters_match_vector.second) {
32*0b57cec5SDimitry Andric m_formatters_match_vector.second = true;
33*0b57cec5SDimitry Andric m_formatters_match_vector.first =
34*0b57cec5SDimitry Andric FormatManager::GetPossibleMatches(m_valobj, m_dynamic_value_type);
35*0b57cec5SDimitry Andric }
36*0b57cec5SDimitry Andric return m_formatters_match_vector.first;
37*0b57cec5SDimitry Andric }
38*0b57cec5SDimitry Andric
GetTypeForCache()39*0b57cec5SDimitry Andric ConstString FormattersMatchData::GetTypeForCache() { return m_type_for_cache; }
40*0b57cec5SDimitry Andric
GetCandidateLanguages()41*0b57cec5SDimitry Andric CandidateLanguagesVector FormattersMatchData::GetCandidateLanguages() {
42*0b57cec5SDimitry Andric return m_candidate_languages;
43*0b57cec5SDimitry Andric }
44*0b57cec5SDimitry Andric
GetValueObject()45*0b57cec5SDimitry Andric ValueObject &FormattersMatchData::GetValueObject() { return m_valobj; }
46*0b57cec5SDimitry Andric
GetDynamicValueType()47*0b57cec5SDimitry Andric lldb::DynamicValueType FormattersMatchData::GetDynamicValueType() {
48*0b57cec5SDimitry Andric return m_dynamic_value_type;
49*0b57cec5SDimitry Andric }
50