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