LLDB  mainline
DataVisualization.cpp
Go to the documentation of this file.
1 //===-- DataVisualization.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 
11 
12 
13 using namespace lldb;
14 using namespace lldb_private;
15 
17  static FormatManager g_format_manager;
18  return g_format_manager;
19 }
20 
21 void DataVisualization::ForceUpdate() { GetFormatManager().Changed(); }
22 
23 uint32_t DataVisualization::GetCurrentRevision() {
25 }
26 
27 bool DataVisualization::ShouldPrintAsOneLiner(ValueObject &valobj) {
28  return GetFormatManager().ShouldPrintAsOneLiner(valobj);
29 }
30 
31 lldb::TypeFormatImplSP
32 DataVisualization::GetFormat(ValueObject &valobj,
33  lldb::DynamicValueType use_dynamic) {
34  return GetFormatManager().GetFormat(valobj, use_dynamic);
35 }
36 
37 lldb::TypeFormatImplSP
38 DataVisualization::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) {
39  return GetFormatManager().GetFormatForType(type_sp);
40 }
41 
42 lldb::TypeSummaryImplSP
43 DataVisualization::GetSummaryFormat(ValueObject &valobj,
44  lldb::DynamicValueType use_dynamic) {
45  return GetFormatManager().GetSummaryFormat(valobj, use_dynamic);
46 }
47 
48 lldb::TypeSummaryImplSP
49 DataVisualization::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) {
50  return GetFormatManager().GetSummaryForType(type_sp);
51 }
52 
53 lldb::SyntheticChildrenSP
54 DataVisualization::GetSyntheticChildren(ValueObject &valobj,
55  lldb::DynamicValueType use_dynamic) {
56  return GetFormatManager().GetSyntheticChildren(valobj, use_dynamic);
57 }
58 
59 lldb::TypeFilterImplSP
60 DataVisualization::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
61  return GetFormatManager().GetFilterForType(type_sp);
62 }
63 
64 lldb::ScriptedSyntheticChildrenSP
65 DataVisualization::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
66  return GetFormatManager().GetSyntheticForType(type_sp);
67 }
68 
69 lldb::TypeValidatorImplSP
70 DataVisualization::GetValidator(ValueObject &valobj,
71  lldb::DynamicValueType use_dynamic) {
72  return GetFormatManager().GetValidator(valobj, use_dynamic);
73 }
74 
75 lldb::TypeValidatorImplSP
76 DataVisualization::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
77  return GetFormatManager().GetValidatorForType(type_sp);
78 }
79 
80 bool DataVisualization::AnyMatches(
82  bool only_enabled, const char **matching_category,
84  return GetFormatManager().AnyMatches(type_name, items, only_enabled,
85  matching_category, matching_type);
86 }
87 
88 bool DataVisualization::Categories::GetCategory(ConstString category,
89  lldb::TypeCategoryImplSP &entry,
90  bool allow_create) {
91  entry = GetFormatManager().GetCategory(category, allow_create);
92  return (entry.get() != NULL);
93 }
94 
95 bool DataVisualization::Categories::GetCategory(
96  lldb::LanguageType language, lldb::TypeCategoryImplSP &entry) {
97  if (LanguageCategory *lang_category =
98  GetFormatManager().GetCategoryForLanguage(language))
99  entry = lang_category->GetCategory();
100  return (entry.get() != nullptr);
101 }
102 
103 void DataVisualization::Categories::Add(ConstString category) {
104  GetFormatManager().GetCategory(category);
105 }
106 
107 bool DataVisualization::Categories::Delete(ConstString category) {
108  GetFormatManager().DisableCategory(category);
109  return GetFormatManager().DeleteCategory(category);
110 }
111 
112 void DataVisualization::Categories::Clear() {
114 }
115 
116 void DataVisualization::Categories::Clear(ConstString category) {
117  GetFormatManager().GetCategory(category)->Clear(
119 }
120 
121 void DataVisualization::Categories::Enable(ConstString category,
123  if (GetFormatManager().GetCategory(category)->IsEnabled())
124  GetFormatManager().DisableCategory(category);
126  category, pos, std::initializer_list<lldb::LanguageType>());
127 }
128 
129 void DataVisualization::Categories::Enable(lldb::LanguageType lang_type) {
130  if (LanguageCategory *lang_category =
131  GetFormatManager().GetCategoryForLanguage(lang_type))
132  lang_category->Enable();
133 }
134 
135 void DataVisualization::Categories::Disable(ConstString category) {
136  if (GetFormatManager().GetCategory(category)->IsEnabled())
137  GetFormatManager().DisableCategory(category);
138 }
139 
140 void DataVisualization::Categories::Disable(lldb::LanguageType lang_type) {
141  if (LanguageCategory *lang_category =
142  GetFormatManager().GetCategoryForLanguage(lang_type))
143  lang_category->Disable();
144 }
145 
146 void DataVisualization::Categories::Enable(
147  const lldb::TypeCategoryImplSP &category, TypeCategoryMap::Position pos) {
148  if (category.get()) {
149  if (category->IsEnabled())
150  GetFormatManager().DisableCategory(category);
151  GetFormatManager().EnableCategory(category, pos);
152  }
153 }
154 
155 void DataVisualization::Categories::Disable(
156  const lldb::TypeCategoryImplSP &category) {
157  if (category.get() && category->IsEnabled())
158  GetFormatManager().DisableCategory(category);
159 }
160 
161 void DataVisualization::Categories::EnableStar() {
163 }
164 
165 void DataVisualization::Categories::DisableStar() {
167 }
168 
169 void DataVisualization::Categories::ForEach(
171  GetFormatManager().ForEachCategory(callback);
172 }
173 
174 uint32_t DataVisualization::Categories::GetCount() {
176 }
177 
178 lldb::TypeCategoryImplSP
179 DataVisualization::Categories::GetCategoryAtIndex(size_t index) {
180  return GetFormatManager().GetCategoryAtIndex(index);
181 }
182 
183 bool DataVisualization::NamedSummaryFormats::GetSummaryFormat(
184  ConstString type, lldb::TypeSummaryImplSP &entry) {
185  return GetFormatManager().GetNamedSummaryContainer().Get(type, entry);
186 }
187 
188 void DataVisualization::NamedSummaryFormats::Add(
189  ConstString type, const lldb::TypeSummaryImplSP &entry) {
191  FormatManager::GetValidTypeName(type), entry);
192 }
193 
194 bool DataVisualization::NamedSummaryFormats::Delete(ConstString type) {
196 }
197 
198 void DataVisualization::NamedSummaryFormats::Clear() {
200 }
201 
202 void DataVisualization::NamedSummaryFormats::ForEach(
203  std::function<bool(ConstString, const lldb::TypeSummaryImplSP &)>
204  callback) {
206 }
207 
208 uint32_t DataVisualization::NamedSummaryFormats::GetCount() {
210 }
lldb::TypeSummaryImplSP GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
lldb::ScriptedSyntheticChildrenSP GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp)
lldb::TypeSummaryImplSP GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp)
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
lldb::TypeFormatImplSP GetFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
bool DeleteCategory(ConstString category_name)
Definition: FormatManager.h:94
lldb::TypeValidatorImplSP GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp)
void ForEachCategory(TypeCategoryMap::ForEachCallback callback)
void DisableCategory(ConstString category_name)
Definition: FormatManager.h:76
void ForEach(ForEachCallback callback)
lldb::TypeFilterImplSP GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp)
LanguageType
Programming language type.
lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t index)
static FormatManager & GetFormatManager()
uint32_t GetCurrentRevision() override
std::function< bool(const ValueSP &)> ForEachCallback
lldb::TypeFormatImplSP GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp)
void Add(KeyType name, const ValueSP &entry)
bool Delete(KeyType name)
bool ShouldPrintAsOneLiner(ValueObject &valobj)
A uniqued constant string class.
Definition: ConstString.h:38
bool AnyMatches(ConstString type_name, TypeCategoryImpl::FormatCategoryItems items=TypeCategoryImpl::ALL_ITEM_TYPES, bool only_enabled=true, const char **matching_category=nullptr, TypeCategoryImpl::FormatCategoryItems *matching_type=nullptr)
Definition: SBAddress.h:15
lldb::TypeCategoryImplSP GetCategory(const char *category_name=nullptr, bool can_create=true)
lldb::SyntheticChildrenSP GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
NamedSummariesMap & GetNamedSummaryContainer()
Definition: FormatManager.h:48
lldb::TypeValidatorImplSP GetValidator(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
void EnableCategory(ConstString category_name, TypeCategoryMap::Position pos=TypeCategoryMap::Default)
Definition: FormatManager.h:53
bool Get(KeyType name, ValueSP &entry)