LLDB  mainline
TypeCategory.h
Go to the documentation of this file.
1 //===-- TypeCategory.h ------------------------------------------*- C++ -*-===//
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 #ifndef LLDB_DATAFORMATTERS_TYPECATEGORY_H
10 #define LLDB_DATAFORMATTERS_TYPECATEGORY_H
11 
12 #include <array>
13 #include <initializer_list>
14 #include <memory>
15 #include <mutex>
16 #include <string>
17 #include <vector>
18 
19 #include "lldb/lldb-enumerations.h"
20 #include "lldb/lldb-public.h"
21 
24 
25 namespace lldb_private {
26 
27 // A formatter container with sub-containers for different priority tiers, that
28 // also exposes a flat view of all formatters in it.
29 //
30 // Formatters have different priority during matching, depending on the type of
31 // matching specified at registration. Exact matchers are processed first, then
32 // regex, and finally callback matchers. However, the scripting API presents a
33 // flat view of formatters in a category, with methods like `GetNumFormats()`
34 // and `GetFormatAtIndex(i)`. So we need something that can behave like both
35 // representations.
36 template <typename FormatterImpl> class TieredFormatterContainer {
37 public:
39  using SubcontainerSP = std::shared_ptr<Subcontainer>;
42 
44  for (auto& sc : m_subcontainers)
45  sc = std::make_shared<Subcontainer>(change_listener);
46  }
47 
48  /// Returns the subcontainer containing formatters for exact matching.
49  std::shared_ptr<Subcontainer> GetExactMatch() const {
51  }
52 
53  /// Returns the subcontainer containing formatters for regex matching.
54  std::shared_ptr<Subcontainer> GetRegexMatch() const {
56  }
57 
58  /// Adds a formatter to the right subcontainer depending on the matching type
59  /// specified by `type_sp`.
60  void Add(lldb::TypeNameSpecifierImplSP type_sp,
61  std::shared_ptr<FormatterImpl> format_sp) {
62  m_subcontainers[type_sp->GetMatchType()]->Add(TypeMatcher(type_sp),
63  format_sp);
64  }
65 
66  /// Deletes the formatter specified by `type_sp`.
67  bool Delete(lldb::TypeNameSpecifierImplSP type_sp) {
68  return m_subcontainers[type_sp->GetMatchType()]->Delete(
69  TypeMatcher(type_sp));
70  }
71 
72  /// Returns the total count of elements across all subcontainers.
74  uint32_t result = 0;
75  for (auto sc : m_subcontainers)
76  result += sc->GetCount();
77  return result;
78  }
79 
80  /// Returns the formatter at `index`, simulating a flattened view of all
81  /// subcontainers in priority order.
82  MapValueType GetAtIndex(size_t index) {
83  for (auto sc : m_subcontainers) {
84  if (index < sc->GetCount())
85  return sc->GetAtIndex(index);
86  index -= sc->GetCount();
87  }
88  return MapValueType();
89  }
90 
91  /// Looks for a matching candidate across all priority tiers, in priority
92  /// order. If a match is found, returns `true` and puts the matching entry in
93  /// `entry`.
94  bool Get(const FormattersMatchVector &candidates,
95  std::shared_ptr<FormatterImpl> &entry) {
96  for (auto sc : m_subcontainers) {
97  if (sc->Get(candidates, entry))
98  return true;
99  }
100  return false;
101  }
102 
103  /// Returns a formatter that is an exact match for `type_specifier_sp`. It
104  /// looks for a formatter with the same matching type that was created from
105  /// the same string. This is useful so we can refer to a formatter using the
106  /// same string used to register it.
107  ///
108  /// For example, `type_specifier_sp` can be something like
109  /// {"std::vector<.*>", eFormatterMatchRegex}, and we'd look for a regex
110  /// matcher with that exact regex string, NOT try to match that string using
111  /// regex.
113  GetForTypeNameSpecifier(lldb::TypeNameSpecifierImplSP type_specifier_sp) {
114  MapValueType retval;
115  if (type_specifier_sp) {
116  m_subcontainers[type_specifier_sp->GetMatchType()]->GetExact(
117  ConstString(type_specifier_sp->GetName()), retval);
118  }
119  return retval;
120  }
121 
122  /// Returns the type name specifier at `index`, simulating a flattened view of
123  /// all subcontainers in priority order.
124  lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierAtIndex(size_t index) {
125  for (auto sc : m_subcontainers) {
126  if (index < sc->GetCount())
127  return sc->GetTypeNameSpecifierAtIndex(index);
128  index -= sc->GetCount();
129  }
130  return lldb::TypeNameSpecifierImplSP();
131  }
132 
133  private:
134  std::array<std::shared_ptr<Subcontainer>, lldb::eLastFormatterMatchType + 1>
136 };
137 
139 private:
144 
145 public:
147  static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
148 
149  template <typename T> class ForEachCallbacks {
150  public:
151  ForEachCallbacks() = default;
152  ~ForEachCallbacks() = default;
153 
154  template <typename U = TypeFormatImpl>
155  typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
157  m_format_exact = std::move(callback);
158  return *this;
159  }
160  template <typename U = TypeFormatImpl>
161  typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
163  m_format_regex = std::move(callback);
164  return *this;
165  }
166 
167  template <typename U = TypeSummaryImpl>
168  typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
170  m_summary_exact = std::move(callback);
171  return *this;
172  }
173  template <typename U = TypeSummaryImpl>
174  typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
176  m_summary_regex = std::move(callback);
177  return *this;
178  }
179 
180  template <typename U = TypeFilterImpl>
181  typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
183  m_filter_exact = std::move(callback);
184  return *this;
185  }
186  template <typename U = TypeFilterImpl>
187  typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
189  m_filter_regex = std::move(callback);
190  return *this;
191  }
192 
193  template <typename U = SyntheticChildren>
194  typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
196  m_synth_exact = std::move(callback);
197  return *this;
198  }
199  template <typename U = SyntheticChildren>
200  typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
202  m_synth_regex = std::move(callback);
203  return *this;
204  }
205 
207  return m_format_exact;
208  }
210  return m_format_regex;
211  }
212 
214  return m_summary_exact;
215  }
217  return m_summary_regex;
218  }
219 
221  return m_filter_exact;
222  }
224  return m_filter_regex;
225  }
226 
228  return m_synth_exact;
229  }
231  return m_synth_regex;
232  }
233 
234  private:
237 
240 
243 
246  };
247 
249 
250  template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) {
251  GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
252  GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
253 
254  GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
256  foreach.GetSummaryRegexCallback());
257 
258  GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
259  GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
260 
261  GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
262  GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
263  }
264 
266  return m_format_cont.GetExactMatch();
267  }
268 
270  return m_format_cont.GetRegexMatch();
271  }
272 
274 
276  return m_summary_cont.GetExactMatch();
277  }
278 
280  return m_summary_cont.GetRegexMatch();
281  }
282 
284 
286  return m_filter_cont.GetExactMatch();
287  }
288 
290  return m_filter_cont.GetRegexMatch();
291  }
292 
294 
296  GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
297 
299  GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
300 
302  GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
303 
305  GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
306 
307  void AddTypeFormat(lldb::TypeNameSpecifierImplSP type_sp,
308  lldb::TypeFormatImplSP format_sp) {
309  m_format_cont.Add(type_sp, format_sp);
310  }
311 
312  void AddTypeSummary(lldb::TypeNameSpecifierImplSP type_sp,
313  lldb::TypeSummaryImplSP summary_sp) {
314  m_summary_cont.Add(type_sp, summary_sp);
315  }
316 
317  void AddTypeFilter(lldb::TypeNameSpecifierImplSP type_sp,
318  lldb::TypeFilterImplSP filter_sp) {
319  m_filter_cont.Add(type_sp, filter_sp);
320  }
321 
322  void AddTypeSynthetic(lldb::TypeNameSpecifierImplSP type_sp,
323  lldb::SyntheticChildrenSP synth_sp) {
324  m_synth_cont.Add(type_sp, synth_sp);
325  }
326 
327  bool DeleteTypeFormat(lldb::TypeNameSpecifierImplSP type_sp) {
328  return m_format_cont.Delete(type_sp);
329  }
330 
331  bool DeleteTypeSummary(lldb::TypeNameSpecifierImplSP type_sp) {
332  return m_summary_cont.Delete(type_sp);
333  }
334 
335  bool DeleteTypeFilter(lldb::TypeNameSpecifierImplSP type_sp) {
336  return m_filter_cont.Delete(type_sp);
337  }
338 
339  bool DeleteTypeSynthetic(lldb::TypeNameSpecifierImplSP type_sp) {
340  return m_synth_cont.Delete(type_sp);
341  }
342 
344 
346 
348 
350 
351  lldb::TypeNameSpecifierImplSP
353 
354  lldb::TypeNameSpecifierImplSP
356 
357  lldb::TypeNameSpecifierImplSP
359 
360  lldb::TypeNameSpecifierImplSP
362 
364 
366 
368 
370 
372  return m_synth_cont.GetExactMatch();
373  }
374 
376  return m_synth_cont.GetRegexMatch();
377  }
378 
380 
381 
382  bool IsEnabled() const { return m_enabled; }
383 
385  if (!m_enabled)
386  return UINT32_MAX;
387  else
388  return m_enabled_position;
389  }
390 
391  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
392  lldb::TypeFormatImplSP &entry);
393 
394  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
395  lldb::TypeSummaryImplSP &entry);
396 
397  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
398  lldb::SyntheticChildrenSP &entry);
399 
401 
403 
405 
406  const char *GetName() { return m_name.GetCString(); }
407 
408  size_t GetNumLanguages();
409 
411 
412  void AddLanguage(lldb::LanguageType lang);
413 
415 
416  bool AnyMatches(ConstString type_name,
418  bool only_enabled = true,
419  const char **matching_category = nullptr,
420  FormatCategoryItems *matching_type = nullptr);
421 
422  typedef std::shared_ptr<TypeCategoryImpl> SharedPointer;
423 
424 private:
429 
430  bool m_enabled;
431 
433 
434  std::recursive_mutex m_mutex;
435 
437 
438  std::vector<lldb::LanguageType> m_languages;
439 
441 
442  void Enable(bool value, uint32_t position);
443 
444  void Disable() { Enable(false, UINT32_MAX); }
445 
446  bool IsApplicable(lldb::LanguageType lang);
447 
449 
451 
452  friend class FormatManager;
453  friend class LanguageCategory;
454  friend class TypeCategoryMap;
455 
457 
459 
461 
463 };
464 
465 } // namespace lldb_private
466 
467 #endif // LLDB_DATAFORMATTERS_TYPECATEGORY_H
lldb_private::TypeCategoryImpl::AddTypeFilter
void AddTypeFilter(lldb::TypeNameSpecifierImplSP type_sp, lldb::TypeFilterImplSP filter_sp)
Definition: TypeCategory.h:317
lldb_private::TypeCategoryImpl::GetFormatForType
FormatContainer::MapValueType GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp)
Definition: TypeCategory.cpp:271
lldb_private::TypeCategoryImpl::GetSummaryForType
SummaryContainer::MapValueType GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp)
Definition: TypeCategory.cpp:276
lldb_private::TypeCategoryImpl::TypeCategoryImpl
TypeCategoryImpl(IFormatChangeListener *clist, ConstString name)
Definition: TypeCategory.cpp:16
lldb_private::ScriptedSyntheticChildren
Definition: TypeSynthetic.h:387
lldb_private::TypeCategoryImpl::GetRegexTypeSummariesContainer
SummaryContainer::SubcontainerSP GetRegexTypeSummariesContainer()
Definition: TypeCategory.h:279
lldb_private::TypeCategoryImpl::ForEachCallbacks::m_synth_exact
SynthContainer::ForEachCallback m_synth_exact
Definition: TypeCategory.h:244
lldb_private::TypeCategoryImpl::AddTypeSynthetic
void AddTypeSynthetic(lldb::TypeNameSpecifierImplSP type_sp, lldb::SyntheticChildrenSP synth_sp)
Definition: TypeCategory.h:322
lldb-public.h
lldb_private::TieredFormatterContainer
Definition: TypeCategory.h:36
lldb_private::TypeCategoryImpl::GetRegexTypeFiltersContainer
FilterContainer::SubcontainerSP GetRegexTypeFiltersContainer()
Definition: TypeCategory.h:289
lldb_private::TypeCategoryImpl::DeleteTypeFilter
bool DeleteTypeFilter(lldb::TypeNameSpecifierImplSP type_sp)
Definition: TypeCategory.h:335
lldb_private::FormatManager
Definition: FormatManager.h:36
lldb_private::TypeCategoryImpl::GetTypeNameSpecifierForSyntheticAtIndex
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForSyntheticAtIndex(size_t index)
Definition: TypeCategory.cpp:326
lldb_private::TypeSummaryImpl
Definition: TypeSummary.h:45
lldb_private::TypeCategoryImpl::m_change_listener
IFormatChangeListener * m_change_listener
Definition: TypeCategory.h:432
lldb_private::TypeMatcher
Class for matching type names.
Definition: FormattersContainer.h:41
FormatClasses.h
lldb_private::TypeCategoryImpl::ForEachCallbacks::SetWithRegex
std::enable_if< std::is_same< U, T >::value, ForEachCallbacks & >::type SetWithRegex(FilterContainer::ForEachCallback callback)
Definition: TypeCategory.h:188
lldb_private::TypeCategoryImpl::GetTypeNameSpecifierForFilterAtIndex
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForFilterAtIndex(size_t index)
Definition: TypeCategory.cpp:321
lldb_private::TypeCategoryImpl::ForEachCallbacks::m_summary_exact
SummaryContainer::ForEachCallback m_summary_exact
Definition: TypeCategory.h:238
lldb_private::TypeCategoryImpl::ForEachCallbacks::m_format_exact
FormatContainer::ForEachCallback m_format_exact
Definition: TypeCategory.h:235
lldb_private::TypeCategoryImpl::DeleteTypeFormat
bool DeleteTypeFormat(lldb::TypeNameSpecifierImplSP type_sp)
Definition: TypeCategory.h:327
lldb_private::TypeCategoryImpl::AddTypeFormat
void AddTypeFormat(lldb::TypeNameSpecifierImplSP type_sp, lldb::TypeFormatImplSP format_sp)
Definition: TypeCategory.h:307
lldb_private::TypeCategoryImpl::GetTypeFormatsContainer
FormatContainer::SubcontainerSP GetTypeFormatsContainer()
Definition: TypeCategory.h:265
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::TypeFilterImpl
Definition: TypeSynthetic.h:277
lldb_private::TypeCategoryImpl::Delete
bool Delete(ConstString name, FormatCategoryItems items=ALL_ITEM_TYPES)
Definition: TypeCategory.cpp:159
lldb_private::TypeCategoryImpl::ForEachCallbacks::SetWithRegex
std::enable_if< std::is_same< U, T >::value, ForEachCallbacks & >::type SetWithRegex(FormatContainer::ForEachCallback callback)
Definition: TypeCategory.h:162
lldb_private::TypeCategoryImpl::ForEachCallbacks::m_filter_exact
FilterContainer::ForEachCallback m_filter_exact
Definition: TypeCategory.h:241
lldb_private::TypeCategoryImpl::ALL_ITEM_TYPES
static const uint16_t ALL_ITEM_TYPES
Definition: TypeCategory.h:147
lldb_private::TypeCategoryImpl::GetName
const char * GetName()
Definition: TypeCategory.h:406
lldb_private::TypeCategoryImpl::GetRegexTypeSyntheticsContainer
SynthContainer::SubcontainerSP GetRegexTypeSyntheticsContainer()
Definition: TypeCategory.h:375
lldb_private::TypeCategoryImpl::IsEnabled
bool IsEnabled() const
Definition: TypeCategory.h:382
lldb_private::TypeCategoryImpl::DeleteTypeSynthetic
bool DeleteTypeSynthetic(lldb::TypeNameSpecifierImplSP type_sp)
Definition: TypeCategory.h:339
lldb_private::TypeCategoryImpl::ForEachCallbacks::SetExact
std::enable_if< std::is_same< U, T >::value, ForEachCallbacks & >::type SetExact(FilterContainer::ForEachCallback callback)
Definition: TypeCategory.h:182
lldb_private::TypeCategoryImpl::GetEnabledPosition
uint32_t GetEnabledPosition()
Definition: TypeCategory.h:384
lldb_private::FormattersContainer
Definition: FormattersContainer.h:120
lldb_private::TypeCategoryImpl::GetSummaryAtIndex
SummaryContainer::MapValueType GetSummaryAtIndex(size_t index)
Definition: TypeCategory.cpp:296
lldb_private::TieredFormatterContainer::Delete
bool Delete(lldb::TypeNameSpecifierImplSP type_sp)
Deletes the formatter specified by type_sp.
Definition: TypeCategory.h:67
lldb_private::TypeCategoryImpl::ForEachCallbacks::m_summary_regex
SummaryContainer::ForEachCallback m_summary_regex
Definition: TypeCategory.h:239
lldb_private::TypeCategoryImpl::FormatCategoryItems
uint16_t FormatCategoryItems
Definition: TypeCategory.h:146
lldb_private::TypeCategoryImpl::ForEachCallbacks::GetFilterExactCallback
FilterContainer::ForEachCallback GetFilterExactCallback() const
Definition: TypeCategory.h:220
lldb_private::TieredFormatterContainer::TieredFormatterContainer
TieredFormatterContainer(IFormatChangeListener *change_listener)
Definition: TypeCategory.h:43
lldb_private::TypeCategoryImpl::GetSyntheticsContainer
SynthContainer & GetSyntheticsContainer()
Definition: TypeCategory.h:379
lldb_private::TypeFormatImpl
Definition: TypeFormat.h:24
lldb_private::TypeCategoryImpl::GetTypeSummariesContainer
SummaryContainer::SubcontainerSP GetTypeSummariesContainer()
Definition: TypeCategory.h:275
lldb_private::TypeCategoryImpl::ForEachCallbacks::SetWithRegex
std::enable_if< std::is_same< U, T >::value, ForEachCallbacks & >::type SetWithRegex(SummaryContainer::ForEachCallback callback)
Definition: TypeCategory.h:175
lldb_private::TypeCategoryImpl::ForEachCallbacks::GetFormatRegexCallback
FormatContainer::ForEachCallback GetFormatRegexCallback() const
Definition: TypeCategory.h:209
lldb_private::TieredFormatterContainer< TypeFilterImpl >::MapValueType
typename Subcontainer::ValueSP MapValueType
Definition: TypeCategory.h:41
lldb_private::TypeCategoryImpl::ForEachCallbacks::GetFormatExactCallback
FormatContainer::ForEachCallback GetFormatExactCallback() const
Definition: TypeCategory.h:206
lldb_private::TypeCategoryImpl::ForEachCallbacks::GetSynthExactCallback
SynthContainer::ForEachCallback GetSynthExactCallback() const
Definition: TypeCategory.h:227
lldb_private::TypeCategoryImpl::ForEachCallbacks::SetExact
std::enable_if< std::is_same< U, T >::value, ForEachCallbacks & >::type SetExact(SynthContainer::ForEachCallback callback)
Definition: TypeCategory.h:195
lldb_private::TypeCategoryMap
Definition: TypeCategoryMap.h:24
lldb_private::TypeCategoryImpl::SynthContainer
TieredFormatterContainer< SyntheticChildren > SynthContainer
Definition: TypeCategory.h:143
lldb_private::TypeCategoryImpl::ForEachCallbacks::m_format_regex
FormatContainer::ForEachCallback m_format_regex
Definition: TypeCategory.h:236
lldb_private::TypeCategoryImpl::GetFilterAtIndex
FilterContainer::MapValueType GetFilterAtIndex(size_t index)
Definition: TypeCategory.cpp:301
lldb_private::FormattersMatchVector
std::vector< FormattersMatchCandidate > FormattersMatchVector
Definition: FormatClasses.h:107
lldb_private::TypeCategoryImpl::GetNumSynthetics
uint32_t GetNumSynthetics()
Definition: TypeCategory.h:349
lldb_private::TypeCategoryImpl::GetDescription
std::string GetDescription()
Definition: TypeCategory.cpp:338
lldb_private::FormattersContainer::ValueSP
std::shared_ptr< ValueType > ValueSP
Definition: FormattersContainer.h:122
lldb_private::ConstString
Definition: ConstString.h:39
lldb_private::TypeCategoryImpl::GetTypeNameSpecifierForSummaryAtIndex
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForSummaryAtIndex(size_t index)
Definition: TypeCategory.cpp:316
lldb-enumerations.h
lldb_private::TieredFormatterContainer::GetTypeNameSpecifierAtIndex
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierAtIndex(size_t index)
Returns the type name specifier at index, simulating a flattened view of all subcontainers in priorit...
Definition: TypeCategory.h:124
lldb::eLastFormatterMatchType
@ eLastFormatterMatchType
Definition: lldb-enumerations.h:839
lldb_private::TypeCategoryImpl::SummaryContainer
TieredFormatterContainer< TypeSummaryImpl > SummaryContainer
Definition: TypeCategory.h:141
lldb_private::TypeCategoryImpl::GetNumLanguages
size_t GetNumLanguages()
Definition: TypeCategory.cpp:69
lldb_private::TypeCategoryImpl::Enable
void Enable(bool value, uint32_t position)
Definition: TypeCategory.cpp:330
lldb_private::TieredFormatterContainer< TypeFilterImpl >::SubcontainerSP
std::shared_ptr< Subcontainer > SubcontainerSP
Definition: TypeCategory.h:39
lldb_private::TieredFormatterContainer::GetForTypeNameSpecifier
MapValueType GetForTypeNameSpecifier(lldb::TypeNameSpecifierImplSP type_specifier_sp)
Returns a formatter that is an exact match for type_specifier_sp.
Definition: TypeCategory.h:113
lldb_private::TypeCategoryImpl::m_languages
std::vector< lldb::LanguageType > m_languages
Definition: TypeCategory.h:438
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb::eFormatterMatchExact
@ eFormatterMatchExact
Definition: lldb-enumerations.h:836
lldb_private::TieredFormatterContainer::GetExactMatch
std::shared_ptr< Subcontainer > GetExactMatch() const
Returns the subcontainer containing formatters for exact matching.
Definition: TypeCategory.h:49
lldb_private::TypeCategoryImpl::DeleteTypeSummary
bool DeleteTypeSummary(lldb::TypeNameSpecifierImplSP type_sp)
Definition: TypeCategory.h:331
lldb_private::TypeCategoryImpl::m_filter_cont
FilterContainer m_filter_cont
Definition: TypeCategory.h:427
lldb_private::TypeCategoryImpl::GetNumFormats
uint32_t GetNumFormats()
Definition: TypeCategory.h:343
lldb_private::TypeCategoryImpl::m_synth_cont
SynthContainer m_synth_cont
Definition: TypeCategory.h:428
lldb_private::LanguageCategory
Definition: LanguageCategory.h:21
lldb_private::TypeCategoryImpl::SharedPointer
std::shared_ptr< TypeCategoryImpl > SharedPointer
Definition: TypeCategory.h:422
lldb_private::TieredFormatterContainer::m_subcontainers
std::array< std::shared_ptr< Subcontainer >, lldb::eLastFormatterMatchType+1 > m_subcontainers
Definition: TypeCategory.h:135
lldb_private::TypeCategoryImpl::IsApplicable
bool IsApplicable(lldb::LanguageType lang)
Definition: TypeCategory.cpp:60
lldb_private::TypeCategoryImpl::Disable
void Disable()
Definition: TypeCategory.h:444
lldb_private::TypeCategoryImpl::FilterContainer
TieredFormatterContainer< TypeFilterImpl > FilterContainer
Definition: TypeCategory.h:142
lldb_private::TypeCategoryImpl::ForEach
void ForEach(const ForEachCallbacks< T > &foreach)
Definition: TypeCategory.h:250
lldb_private::TieredFormatterContainer::GetRegexMatch
std::shared_ptr< Subcontainer > GetRegexMatch() const
Returns the subcontainer containing formatters for regex matching.
Definition: TypeCategory.h:54
lldb_private::TypeCategoryImpl::ForEachCallbacks::SetExact
std::enable_if< std::is_same< U, T >::value, ForEachCallbacks & >::type SetExact(SummaryContainer::ForEachCallback callback)
Definition: TypeCategory.h:169
lldb_private::TypeCategoryImpl::ForEachCallbacks::GetSummaryExactCallback
SummaryContainer::ForEachCallback GetSummaryExactCallback() const
Definition: TypeCategory.h:213
uint32_t
lldb_private::TypeCategoryImpl::GetFormatContainer
FormatContainer & GetFormatContainer()
Definition: TypeCategory.h:273
lldb_private::TypeCategoryImpl::GetLanguageAtIndex
lldb::LanguageType GetLanguageAtIndex(size_t idx)
Definition: TypeCategory.cpp:75
lldb_private::TypeCategoryImpl::ForEachCallbacks::SetExact
std::enable_if< std::is_same< U, T >::value, ForEachCallbacks & >::type SetExact(FormatContainer::ForEachCallback callback)
Definition: TypeCategory.h:156
lldb_private::TypeCategoryImpl::GetSyntheticAtIndex
SynthContainer::MapValueType GetSyntheticAtIndex(size_t index)
Definition: TypeCategory.cpp:306
lldb_private::TypeCategoryImpl::AddLanguage
void AddLanguage(lldb::LanguageType lang)
Definition: TypeCategory.cpp:81
lldb_private::TypeCategoryImpl::m_mutex
std::recursive_mutex m_mutex
Definition: TypeCategory.h:434
lldb_private::TypeCategoryImpl::m_enabled
bool m_enabled
Definition: TypeCategory.h:430
lldb_private::TypeCategoryImpl::ForEachCallbacks::GetSummaryRegexCallback
SummaryContainer::ForEachCallback GetSummaryRegexCallback() const
Definition: TypeCategory.h:216
lldb_private::FormattersContainer::ForEachCallback
std::function< bool(const TypeMatcher &, const ValueSP &)> ForEachCallback
Definition: FormattersContainer.h:125
lldb_private::TypeCategoryImpl::GetCount
uint32_t GetCount(FormatCategoryItems items=ALL_ITEM_TYPES)
Definition: TypeCategory.cpp:185
lldb_private::TypeCategoryImpl::ForEachCallbacks::ForEachCallbacks
ForEachCallbacks()=default
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::TypeCategoryImpl::GetFormatAtIndex
FormatContainer::MapValueType GetFormatAtIndex(size_t index)
Definition: TypeCategory.cpp:291
lldb_private::TypeCategoryImpl::GetRegexTypeFormatsContainer
FormatContainer::SubcontainerSP GetRegexTypeFormatsContainer()
Definition: TypeCategory.h:269
lldb_private::TypeCategoryImpl::ForEachCallbacks::m_synth_regex
SynthContainer::ForEachCallback m_synth_regex
Definition: TypeCategory.h:245
lldb_private::TypeCategoryImpl::ForEachCallbacks::GetSynthRegexCallback
SynthContainer::ForEachCallback GetSynthRegexCallback() const
Definition: TypeCategory.h:230
lldb_private::TypeCategoryImpl::m_enabled_position
uint32_t m_enabled_position
Definition: TypeCategory.h:440
uint16_t
lldb_private::TypeCategoryImpl::ForEachCallbacks::m_filter_regex
FilterContainer::ForEachCallback m_filter_regex
Definition: TypeCategory.h:242
lldb_private::TypeCategoryImpl::Get
bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates, lldb::TypeFormatImplSP &entry)
Definition: TypeCategory.cpp:85
lldb_private::TieredFormatterContainer::Get
bool Get(const FormattersMatchVector &candidates, std::shared_ptr< FormatterImpl > &entry)
Looks for a matching candidate across all priority tiers, in priority order.
Definition: TypeCategory.h:94
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:215
lldb_private::TypeCategoryImpl::ForEachCallbacks::SetWithRegex
std::enable_if< std::is_same< U, T >::value, ForEachCallbacks & >::type SetWithRegex(SynthContainer::ForEachCallback callback)
Definition: TypeCategory.h:201
lldb_private::TieredFormatterContainer::GetCount
uint32_t GetCount()
Returns the total count of elements across all subcontainers.
Definition: TypeCategory.h:73
lldb_private::TieredFormatterContainer< TypeFilterImpl >::ForEachCallback
typename Subcontainer::ForEachCallback ForEachCallback
Definition: TypeCategory.h:40
lldb_private::TypeCategoryImpl::GetLastEnabledPosition
uint32_t GetLastEnabledPosition()
Definition: TypeCategory.h:448
lldb_private::TypeCategoryImpl::Clear
void Clear(FormatCategoryItems items=ALL_ITEM_TYPES)
Definition: TypeCategory.cpp:137
lldb_private::TypeCategoryImpl::m_summary_cont
SummaryContainer m_summary_cont
Definition: TypeCategory.h:426
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::TypeCategoryImpl::AnyMatches
bool AnyMatches(ConstString type_name, FormatCategoryItems items=ALL_ITEM_TYPES, bool only_enabled=true, const char **matching_category=nullptr, FormatCategoryItems *matching_type=nullptr)
Definition: TypeCategory.cpp:211
lldb_private::TypeCategoryImpl::m_name
ConstString m_name
Definition: TypeCategory.h:436
lldb_private::TypeCategoryImpl::ForEachCallbacks::GetFilterRegexCallback
FilterContainer::ForEachCallback GetFilterRegexCallback() const
Definition: TypeCategory.h:223
lldb_private::TypeCategoryImpl::ForEachCallbacks
Definition: TypeCategory.h:149
lldb_private::TypeCategoryImpl::GetSummaryContainer
SummaryContainer & GetSummaryContainer()
Definition: TypeCategory.h:283
lldb_private::TypeCategoryImpl::GetNumFilters
uint32_t GetNumFilters()
Definition: TypeCategory.h:347
lldb_private::TypeCategoryImpl::GetTypeFiltersContainer
FilterContainer::SubcontainerSP GetTypeFiltersContainer()
Definition: TypeCategory.h:285
lldb_private::TieredFormatterContainer::Add
void Add(lldb::TypeNameSpecifierImplSP type_sp, std::shared_ptr< FormatterImpl > format_sp)
Adds a formatter to the right subcontainer depending on the matching type specified by type_sp.
Definition: TypeCategory.h:60
lldb_private::TypeCategoryImpl::GetTypeNameSpecifierForFormatAtIndex
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForFormatAtIndex(size_t index)
Definition: TypeCategory.cpp:311
lldb_private::TieredFormatterContainer::GetAtIndex
MapValueType GetAtIndex(size_t index)
Returns the formatter at index, simulating a flattened view of all subcontainers in priority order.
Definition: TypeCategory.h:82
lldb_private::TypeCategoryImpl
Definition: TypeCategory.h:138
lldb_private::TypeCategoryImpl::GetNumSummaries
uint32_t GetNumSummaries()
Definition: TypeCategory.h:345
lldb_private::TypeCategoryImpl::FormatContainer
TieredFormatterContainer< TypeFormatImpl > FormatContainer
Definition: TypeCategory.h:140
lldb_private::TypeCategoryImpl::SetEnabledPosition
void SetEnabledPosition(uint32_t p)
Definition: TypeCategory.h:450
FormattersContainer.h
lldb_private::TypeCategoryImpl::m_format_cont
FormatContainer m_format_cont
Definition: TypeCategory.h:425
lldb_private::TypeCategoryImpl::GetFilterForType
FilterContainer::MapValueType GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp)
Definition: TypeCategory.cpp:281
lldb_private::IFormatChangeListener
Definition: FormattersContainer.h:31
lldb_private::TypeCategoryImpl::ForEachCallbacks::~ForEachCallbacks
~ForEachCallbacks()=default
lldb_private::TypeCategoryImpl::GetSyntheticForType
SynthContainer::MapValueType GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp)
Definition: TypeCategory.cpp:286
lldb::eFormatterMatchRegex
@ eFormatterMatchRegex
Definition: lldb-enumerations.h:837
lldb_private::TypeCategoryImpl::GetFilterContainer
FilterContainer & GetFilterContainer()
Definition: TypeCategory.h:293
lldb_private::TypeCategoryImpl::AddTypeSummary
void AddTypeSummary(lldb::TypeNameSpecifierImplSP type_sp, lldb::TypeSummaryImplSP summary_sp)
Definition: TypeCategory.h:312
lldb_private::TypeCategoryImpl::GetTypeSyntheticsContainer
SynthContainer::SubcontainerSP GetTypeSyntheticsContainer()
Definition: TypeCategory.h:371