1 //===-- FormatClasses.cpp ----------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "lldb/DataFormatters/FormatClasses.h"
11 
12 #include "lldb/DataFormatters/FormatManager.h"
13 
14 
15 
16 
17 
18 using namespace lldb;
19 using namespace lldb_private;
20 
21 FormattersMatchData::FormattersMatchData(ValueObject &valobj,
22                                          lldb::DynamicValueType use_dynamic)
23     : m_valobj(valobj), m_dynamic_value_type(use_dynamic),
24       m_formatters_match_vector({}, false), m_type_for_cache(),
25       m_candidate_languages() {
26   m_type_for_cache = FormatManager::GetTypeForCache(valobj, use_dynamic);
27   m_candidate_languages = FormatManager::GetCandidateLanguages(valobj);
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(m_valobj, 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