1 | //===-- FormatClasses.cpp -------------------------------------------------===// |
---|---|
2 | // |
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 |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "lldb/DataFormatters/FormatClasses.h" |
10 | |
11 | #include "lldb/DataFormatters/FormatManager.h" |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | using namespace lldb; |
18 | using namespace lldb_private; |
19 | |
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(lang_type: valobj.GetObjectRuntimeLanguage()); |
28 | } |
29 | |
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(valobj&: m_valobj, use_dynamic: m_dynamic_value_type); |
35 | } |
36 | return m_formatters_match_vector.first; |
37 | } |
38 | |
39 | ConstString FormattersMatchData::GetTypeForCache() { return m_type_for_cache; } |
40 | |
41 | CandidateLanguagesVector FormattersMatchData::GetCandidateLanguages() { |
42 | return m_candidate_languages; |
43 | } |
44 | |
45 | ValueObject &FormattersMatchData::GetValueObject() { return m_valobj; } |
46 | |
47 | lldb::DynamicValueType FormattersMatchData::GetDynamicValueType() { |
48 | return m_dynamic_value_type; |
49 | } |
50 |