Coverage Report

Created: 2022-01-22 13:19

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/DataFormatters/TypeCategory.h
Line
Count
Source (jump to first uncovered line)
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 <initializer_list>
13
#include <memory>
14
#include <mutex>
15
#include <string>
16
#include <vector>
17
18
#include "lldb/lldb-enumerations.h"
19
#include "lldb/lldb-public.h"
20
21
#include "lldb/DataFormatters/FormatClasses.h"
22
#include "lldb/DataFormatters/FormattersContainer.h"
23
24
namespace lldb_private {
25
26
template <typename FormatterImpl> class FormatterContainerPair {
27
public:
28
  typedef FormattersContainer<FormatterImpl> ExactMatchContainer;
29
  typedef FormattersContainer<FormatterImpl> RegexMatchContainer;
30
31
  typedef TypeMatcher ExactMatchMap;
32
  typedef TypeMatcher RegexMatchMap;
33
34
  typedef typename ExactMatchContainer::ValueSP MapValueType;
35
36
  typedef typename ExactMatchContainer::SharedPointer ExactMatchContainerSP;
37
  typedef typename RegexMatchContainer::SharedPointer RegexMatchContainerSP;
38
39
  typedef
40
      typename ExactMatchContainer::ForEachCallback ExactMatchForEachCallback;
41
  typedef
42
      typename RegexMatchContainer::ForEachCallback RegexMatchForEachCallback;
43
44
  FormatterContainerPair(IFormatChangeListener *clist)
45
      : m_exact_sp(new ExactMatchContainer(clist)),
46
13.1k
        m_regex_sp(new RegexMatchContainer(clist)) {}
lldb_private::FormatterContainerPair<lldb_private::TypeFormatImpl>::FormatterContainerPair(lldb_private::IFormatChangeListener*)
Line
Count
Source
46
3.29k
        m_regex_sp(new RegexMatchContainer(clist)) {}
lldb_private::FormatterContainerPair<lldb_private::TypeSummaryImpl>::FormatterContainerPair(lldb_private::IFormatChangeListener*)
Line
Count
Source
46
3.29k
        m_regex_sp(new RegexMatchContainer(clist)) {}
lldb_private::FormatterContainerPair<lldb_private::TypeFilterImpl>::FormatterContainerPair(lldb_private::IFormatChangeListener*)
Line
Count
Source
46
3.29k
        m_regex_sp(new RegexMatchContainer(clist)) {}
lldb_private::FormatterContainerPair<lldb_private::SyntheticChildren>::FormatterContainerPair(lldb_private::IFormatChangeListener*)
Line
Count
Source
46
3.29k
        m_regex_sp(new RegexMatchContainer(clist)) {}
47
48
13.1k
  ~FormatterContainerPair() = default;
lldb_private::FormatterContainerPair<lldb_private::SyntheticChildren>::~FormatterContainerPair()
Line
Count
Source
48
3.29k
  ~FormatterContainerPair() = default;
lldb_private::FormatterContainerPair<lldb_private::TypeFilterImpl>::~FormatterContainerPair()
Line
Count
Source
48
3.29k
  ~FormatterContainerPair() = default;
lldb_private::FormatterContainerPair<lldb_private::TypeSummaryImpl>::~FormatterContainerPair()
Line
Count
Source
48
3.29k
  ~FormatterContainerPair() = default;
lldb_private::FormatterContainerPair<lldb_private::TypeFormatImpl>::~FormatterContainerPair()
Line
Count
Source
48
3.29k
  ~FormatterContainerPair() = default;
49
50
268k
  ExactMatchContainerSP GetExactMatch() const { return m_exact_sp; }
lldb_private::FormatterContainerPair<lldb_private::TypeFormatImpl>::GetExactMatch() const
Line
Count
Source
50
38.2k
  ExactMatchContainerSP GetExactMatch() const { return m_exact_sp; }
lldb_private::FormatterContainerPair<lldb_private::TypeSummaryImpl>::GetExactMatch() const
Line
Count
Source
50
136k
  ExactMatchContainerSP GetExactMatch() const { return m_exact_sp; }
lldb_private::FormatterContainerPair<lldb_private::TypeFilterImpl>::GetExactMatch() const
Line
Count
Source
50
35.2k
  ExactMatchContainerSP GetExactMatch() const { return m_exact_sp; }
lldb_private::FormatterContainerPair<lldb_private::SyntheticChildren>::GetExactMatch() const
Line
Count
Source
50
57.9k
  ExactMatchContainerSP GetExactMatch() const { return m_exact_sp; }
51
52
196k
  RegexMatchContainerSP GetRegexMatch() const { return m_regex_sp; }
lldb_private::FormatterContainerPair<lldb_private::TypeFormatImpl>::GetRegexMatch() const
Line
Count
Source
52
37.4k
  RegexMatchContainerSP GetRegexMatch() const { return m_regex_sp; }
lldb_private::FormatterContainerPair<lldb_private::TypeSummaryImpl>::GetRegexMatch() const
Line
Count
Source
52
64.6k
  RegexMatchContainerSP GetRegexMatch() const { return m_regex_sp; }
lldb_private::FormatterContainerPair<lldb_private::TypeFilterImpl>::GetRegexMatch() const
Line
Count
Source
52
35.1k
  RegexMatchContainerSP GetRegexMatch() const { return m_regex_sp; }
lldb_private::FormatterContainerPair<lldb_private::SyntheticChildren>::GetRegexMatch() const
Line
Count
Source
52
58.7k
  RegexMatchContainerSP GetRegexMatch() const { return m_regex_sp; }
53
54
  uint32_t GetCount() {
55
    return GetExactMatch()->GetCount() + GetRegexMatch()->GetCount();
56
  }
57
58
private:
59
  ExactMatchContainerSP m_exact_sp;
60
  RegexMatchContainerSP m_regex_sp;
61
};
62
63
class TypeCategoryImpl {
64
private:
65
  typedef FormatterContainerPair<TypeFormatImpl> FormatContainer;
66
  typedef FormatterContainerPair<TypeSummaryImpl> SummaryContainer;
67
  typedef FormatterContainerPair<TypeFilterImpl> FilterContainer;
68
  typedef FormatterContainerPair<SyntheticChildren> SynthContainer;
69
70
public:
71
  typedef uint16_t FormatCategoryItems;
72
  static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
73
74
  typedef FormatContainer::ExactMatchContainerSP FormatContainerSP;
75
  typedef FormatContainer::RegexMatchContainerSP RegexFormatContainerSP;
76
77
  typedef SummaryContainer::ExactMatchContainerSP SummaryContainerSP;
78
  typedef SummaryContainer::RegexMatchContainerSP RegexSummaryContainerSP;
79
80
  typedef FilterContainer::ExactMatchContainerSP FilterContainerSP;
81
  typedef FilterContainer::RegexMatchContainerSP RegexFilterContainerSP;
82
83
  typedef SynthContainer::ExactMatchContainerSP SynthContainerSP;
84
  typedef SynthContainer::RegexMatchContainerSP RegexSynthContainerSP;
85
86
  template <typename T> class ForEachCallbacks {
87
  public:
88
280
    ForEachCallbacks() = default;
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::ForEachCallbacks()
Line
Count
Source
88
30
    ForEachCallbacks() = default;
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::ForEachCallbacks()
Line
Count
Source
88
33
    ForEachCallbacks() = default;
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::ForEachCallbacks()
Line
Count
Source
88
172
    ForEachCallbacks() = default;
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::ForEachCallbacks()
Line
Count
Source
88
45
    ForEachCallbacks() = default;
89
280
    ~ForEachCallbacks() = default;
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::~ForEachCallbacks()
Line
Count
Source
89
30
    ~ForEachCallbacks() = default;
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::~ForEachCallbacks()
Line
Count
Source
89
33
    ~ForEachCallbacks() = default;
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::~ForEachCallbacks()
Line
Count
Source
89
172
    ~ForEachCallbacks() = default;
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::~ForEachCallbacks()
Line
Count
Source
89
45
    ~ForEachCallbacks() = default;
90
91
    template <typename U = TypeFormatImpl>
92
    typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
93
33
    SetExact(FormatContainer::ExactMatchForEachCallback callback) {
94
33
      m_format_exact = std::move(callback);
95
33
      return *this;
96
33
    }
97
    template <typename U = TypeFormatImpl>
98
    typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
99
33
    SetWithRegex(FormatContainer::RegexMatchForEachCallback callback) {
100
33
      m_format_regex = std::move(callback);
101
33
      return *this;
102
33
    }
103
104
    template <typename U = TypeSummaryImpl>
105
    typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
106
172
    SetExact(SummaryContainer::ExactMatchForEachCallback callback) {
107
172
      m_summary_exact = std::move(callback);
108
172
      return *this;
109
172
    }
110
    template <typename U = TypeSummaryImpl>
111
    typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
112
172
    SetWithRegex(SummaryContainer::RegexMatchForEachCallback callback) {
113
172
      m_summary_regex = std::move(callback);
114
172
      return *this;
115
172
    }
116
117
    template <typename U = TypeFilterImpl>
118
    typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
119
30
    SetExact(FilterContainer::ExactMatchForEachCallback callback) {
120
30
      m_filter_exact = std::move(callback);
121
30
      return *this;
122
30
    }
123
    template <typename U = TypeFilterImpl>
124
    typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
125
30
    SetWithRegex(FilterContainer::RegexMatchForEachCallback callback) {
126
30
      m_filter_regex = std::move(callback);
127
30
      return *this;
128
30
    }
129
130
    template <typename U = SyntheticChildren>
131
    typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
132
45
    SetExact(SynthContainer::ExactMatchForEachCallback callback) {
133
45
      m_synth_exact = std::move(callback);
134
45
      return *this;
135
45
    }
136
    template <typename U = SyntheticChildren>
137
    typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
138
45
    SetWithRegex(SynthContainer::RegexMatchForEachCallback callback) {
139
45
      m_synth_regex = std::move(callback);
140
45
      return *this;
141
45
    }
142
143
280
    FormatContainer::ExactMatchForEachCallback GetFormatExactCallback() const {
144
280
      return m_format_exact;
145
280
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::GetFormatExactCallback() const
Line
Count
Source
143
30
    FormatContainer::ExactMatchForEachCallback GetFormatExactCallback() const {
144
30
      return m_format_exact;
145
30
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::GetFormatExactCallback() const
Line
Count
Source
143
33
    FormatContainer::ExactMatchForEachCallback GetFormatExactCallback() const {
144
33
      return m_format_exact;
145
33
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::GetFormatExactCallback() const
Line
Count
Source
143
172
    FormatContainer::ExactMatchForEachCallback GetFormatExactCallback() const {
144
172
      return m_format_exact;
145
172
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::GetFormatExactCallback() const
Line
Count
Source
143
45
    FormatContainer::ExactMatchForEachCallback GetFormatExactCallback() const {
144
45
      return m_format_exact;
145
45
    }
146
280
    FormatContainer::RegexMatchForEachCallback GetFormatRegexCallback() const {
147
280
      return m_format_regex;
148
280
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::GetFormatRegexCallback() const
Line
Count
Source
146
30
    FormatContainer::RegexMatchForEachCallback GetFormatRegexCallback() const {
147
30
      return m_format_regex;
148
30
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::GetFormatRegexCallback() const
Line
Count
Source
146
33
    FormatContainer::RegexMatchForEachCallback GetFormatRegexCallback() const {
147
33
      return m_format_regex;
148
33
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::GetFormatRegexCallback() const
Line
Count
Source
146
172
    FormatContainer::RegexMatchForEachCallback GetFormatRegexCallback() const {
147
172
      return m_format_regex;
148
172
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::GetFormatRegexCallback() const
Line
Count
Source
146
45
    FormatContainer::RegexMatchForEachCallback GetFormatRegexCallback() const {
147
45
      return m_format_regex;
148
45
    }
149
150
    SummaryContainer::ExactMatchForEachCallback
151
280
    GetSummaryExactCallback() const {
152
280
      return m_summary_exact;
153
280
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::GetSummaryExactCallback() const
Line
Count
Source
151
30
    GetSummaryExactCallback() const {
152
30
      return m_summary_exact;
153
30
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::GetSummaryExactCallback() const
Line
Count
Source
151
33
    GetSummaryExactCallback() const {
152
33
      return m_summary_exact;
153
33
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::GetSummaryExactCallback() const
Line
Count
Source
151
172
    GetSummaryExactCallback() const {
152
172
      return m_summary_exact;
153
172
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::GetSummaryExactCallback() const
Line
Count
Source
151
45
    GetSummaryExactCallback() const {
152
45
      return m_summary_exact;
153
45
    }
154
    SummaryContainer::RegexMatchForEachCallback
155
280
    GetSummaryRegexCallback() const {
156
280
      return m_summary_regex;
157
280
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::GetSummaryRegexCallback() const
Line
Count
Source
155
30
    GetSummaryRegexCallback() const {
156
30
      return m_summary_regex;
157
30
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::GetSummaryRegexCallback() const
Line
Count
Source
155
33
    GetSummaryRegexCallback() const {
156
33
      return m_summary_regex;
157
33
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::GetSummaryRegexCallback() const
Line
Count
Source
155
172
    GetSummaryRegexCallback() const {
156
172
      return m_summary_regex;
157
172
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::GetSummaryRegexCallback() const
Line
Count
Source
155
45
    GetSummaryRegexCallback() const {
156
45
      return m_summary_regex;
157
45
    }
158
159
280
    FilterContainer::ExactMatchForEachCallback GetFilterExactCallback() const {
160
280
      return m_filter_exact;
161
280
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::GetFilterExactCallback() const
Line
Count
Source
159
30
    FilterContainer::ExactMatchForEachCallback GetFilterExactCallback() const {
160
30
      return m_filter_exact;
161
30
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::GetFilterExactCallback() const
Line
Count
Source
159
33
    FilterContainer::ExactMatchForEachCallback GetFilterExactCallback() const {
160
33
      return m_filter_exact;
161
33
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::GetFilterExactCallback() const
Line
Count
Source
159
172
    FilterContainer::ExactMatchForEachCallback GetFilterExactCallback() const {
160
172
      return m_filter_exact;
161
172
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::GetFilterExactCallback() const
Line
Count
Source
159
45
    FilterContainer::ExactMatchForEachCallback GetFilterExactCallback() const {
160
45
      return m_filter_exact;
161
45
    }
162
280
    FilterContainer::RegexMatchForEachCallback GetFilterRegexCallback() const {
163
280
      return m_filter_regex;
164
280
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::GetFilterRegexCallback() const
Line
Count
Source
162
30
    FilterContainer::RegexMatchForEachCallback GetFilterRegexCallback() const {
163
30
      return m_filter_regex;
164
30
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::GetFilterRegexCallback() const
Line
Count
Source
162
33
    FilterContainer::RegexMatchForEachCallback GetFilterRegexCallback() const {
163
33
      return m_filter_regex;
164
33
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::GetFilterRegexCallback() const
Line
Count
Source
162
172
    FilterContainer::RegexMatchForEachCallback GetFilterRegexCallback() const {
163
172
      return m_filter_regex;
164
172
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::GetFilterRegexCallback() const
Line
Count
Source
162
45
    FilterContainer::RegexMatchForEachCallback GetFilterRegexCallback() const {
163
45
      return m_filter_regex;
164
45
    }
165
166
280
    SynthContainer::ExactMatchForEachCallback GetSynthExactCallback() const {
167
280
      return m_synth_exact;
168
280
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::GetSynthExactCallback() const
Line
Count
Source
166
30
    SynthContainer::ExactMatchForEachCallback GetSynthExactCallback() const {
167
30
      return m_synth_exact;
168
30
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::GetSynthExactCallback() const
Line
Count
Source
166
33
    SynthContainer::ExactMatchForEachCallback GetSynthExactCallback() const {
167
33
      return m_synth_exact;
168
33
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::GetSynthExactCallback() const
Line
Count
Source
166
172
    SynthContainer::ExactMatchForEachCallback GetSynthExactCallback() const {
167
172
      return m_synth_exact;
168
172
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::GetSynthExactCallback() const
Line
Count
Source
166
45
    SynthContainer::ExactMatchForEachCallback GetSynthExactCallback() const {
167
45
      return m_synth_exact;
168
45
    }
169
280
    SynthContainer::RegexMatchForEachCallback GetSynthRegexCallback() const {
170
280
      return m_synth_regex;
171
280
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl>::GetSynthRegexCallback() const
Line
Count
Source
169
30
    SynthContainer::RegexMatchForEachCallback GetSynthRegexCallback() const {
170
30
      return m_synth_regex;
171
30
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl>::GetSynthRegexCallback() const
Line
Count
Source
169
33
    SynthContainer::RegexMatchForEachCallback GetSynthRegexCallback() const {
170
33
      return m_synth_regex;
171
33
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl>::GetSynthRegexCallback() const
Line
Count
Source
169
172
    SynthContainer::RegexMatchForEachCallback GetSynthRegexCallback() const {
170
172
      return m_synth_regex;
171
172
    }
lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren>::GetSynthRegexCallback() const
Line
Count
Source
169
45
    SynthContainer::RegexMatchForEachCallback GetSynthRegexCallback() const {
170
45
      return m_synth_regex;
171
45
    }
172
173
  private:
174
    FormatContainer::ExactMatchForEachCallback m_format_exact;
175
    FormatContainer::RegexMatchForEachCallback m_format_regex;
176
177
    SummaryContainer::ExactMatchForEachCallback m_summary_exact;
178
    SummaryContainer::RegexMatchForEachCallback m_summary_regex;
179
180
    FilterContainer::ExactMatchForEachCallback m_filter_exact;
181
    FilterContainer::RegexMatchForEachCallback m_filter_regex;
182
183
    SynthContainer::ExactMatchForEachCallback m_synth_exact;
184
    SynthContainer::RegexMatchForEachCallback m_synth_regex;
185
  };
186
187
  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name);
188
189
280
  template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) {
190
280
    GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
191
280
    GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
192
193
280
    GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
194
280
    GetRegexTypeSummariesContainer()->ForEach(
195
280
        foreach.GetSummaryRegexCallback());
196
197
280
    GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
198
280
    GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
199
200
280
    GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
201
280
    GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
202
280
  }
void lldb_private::TypeCategoryImpl::ForEach<lldb_private::TypeFilterImpl>(lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFilterImpl> const&)
Line
Count
Source
189
30
  template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) {
190
30
    GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
191
30
    GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
192
193
30
    GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
194
30
    GetRegexTypeSummariesContainer()->ForEach(
195
30
        foreach.GetSummaryRegexCallback());
196
197
30
    GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
198
30
    GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
199
200
30
    GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
201
30
    GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
202
30
  }
void lldb_private::TypeCategoryImpl::ForEach<lldb_private::TypeFormatImpl>(lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeFormatImpl> const&)
Line
Count
Source
189
33
  template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) {
190
33
    GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
191
33
    GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
192
193
33
    GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
194
33
    GetRegexTypeSummariesContainer()->ForEach(
195
33
        foreach.GetSummaryRegexCallback());
196
197
33
    GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
198
33
    GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
199
200
33
    GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
201
33
    GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
202
33
  }
void lldb_private::TypeCategoryImpl::ForEach<lldb_private::TypeSummaryImpl>(lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::TypeSummaryImpl> const&)
Line
Count
Source
189
172
  template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) {
190
172
    GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
191
172
    GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
192
193
172
    GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
194
172
    GetRegexTypeSummariesContainer()->ForEach(
195
172
        foreach.GetSummaryRegexCallback());
196
197
172
    GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
198
172
    GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
199
200
172
    GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
201
172
    GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
202
172
  }
void lldb_private::TypeCategoryImpl::ForEach<lldb_private::SyntheticChildren>(lldb_private::TypeCategoryImpl::ForEachCallbacks<lldb_private::SyntheticChildren> const&)
Line
Count
Source
189
45
  template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) {
190
45
    GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
191
45
    GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
192
193
45
    GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
194
45
    GetRegexTypeSummariesContainer()->ForEach(
195
45
        foreach.GetSummaryRegexCallback());
196
197
45
    GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
198
45
    GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
199
200
45
    GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
201
45
    GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
202
45
  }
203
204
38.2k
  FormatContainerSP GetTypeFormatsContainer() {
205
38.2k
    return m_format_cont.GetExactMatch();
206
38.2k
  }
207
208
37.4k
  RegexFormatContainerSP GetRegexTypeFormatsContainer() {
209
37.4k
    return m_format_cont.GetRegexMatch();
210
37.4k
  }
211
212
0
  FormatContainer &GetFormatContainer() { return m_format_cont; }
213
214
136k
  SummaryContainerSP GetTypeSummariesContainer() {
215
136k
    return m_summary_cont.GetExactMatch();
216
136k
  }
217
218
64.6k
  RegexSummaryContainerSP GetRegexTypeSummariesContainer() {
219
64.6k
    return m_summary_cont.GetRegexMatch();
220
64.6k
  }
221
222
0
  SummaryContainer &GetSummaryContainer() { return m_summary_cont; }
223
224
35.2k
  FilterContainerSP GetTypeFiltersContainer() {
225
35.2k
    return m_filter_cont.GetExactMatch();
226
35.2k
  }
227
228
35.1k
  RegexFilterContainerSP GetRegexTypeFiltersContainer() {
229
35.1k
    return m_filter_cont.GetRegexMatch();
230
35.1k
  }
231
232
0
  FilterContainer &GetFilterContainer() { return m_filter_cont; }
233
234
  FormatContainer::MapValueType
235
  GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
236
237
  SummaryContainer::MapValueType
238
  GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
239
240
  FilterContainer::MapValueType
241
  GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
242
243
  SynthContainer::MapValueType
244
  GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
245
246
  lldb::TypeNameSpecifierImplSP
247
  GetTypeNameSpecifierForFormatAtIndex(size_t index);
248
249
  lldb::TypeNameSpecifierImplSP
250
  GetTypeNameSpecifierForSummaryAtIndex(size_t index);
251
252
  FormatContainer::MapValueType GetFormatAtIndex(size_t index);
253
254
  SummaryContainer::MapValueType GetSummaryAtIndex(size_t index);
255
256
  FilterContainer::MapValueType GetFilterAtIndex(size_t index);
257
258
  lldb::TypeNameSpecifierImplSP
259
  GetTypeNameSpecifierForFilterAtIndex(size_t index);
260
261
57.9k
  SynthContainerSP GetTypeSyntheticsContainer() {
262
57.9k
    return m_synth_cont.GetExactMatch();
263
57.9k
  }
264
265
58.7k
  RegexSynthContainerSP GetRegexTypeSyntheticsContainer() {
266
58.7k
    return m_synth_cont.GetRegexMatch();
267
58.7k
  }
268
269
0
  SynthContainer &GetSyntheticsContainer() { return m_synth_cont; }
270
271
  SynthContainer::MapValueType GetSyntheticAtIndex(size_t index);
272
273
  lldb::TypeNameSpecifierImplSP
274
  GetTypeNameSpecifierForSyntheticAtIndex(size_t index);
275
276
106k
  bool IsEnabled() const { return m_enabled; }
277
278
1
  uint32_t GetEnabledPosition() {
279
1
    if (!m_enabled)
280
0
      return UINT32_MAX;
281
1
    else
282
1
      return m_enabled_position;
283
1
  }
284
285
  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
286
           lldb::TypeFormatImplSP &entry);
287
288
  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
289
           lldb::TypeSummaryImplSP &entry);
290
291
  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
292
           lldb::SyntheticChildrenSP &entry);
293
294
  void Clear(FormatCategoryItems items = ALL_ITEM_TYPES);
295
296
  bool Delete(ConstString name, FormatCategoryItems items = ALL_ITEM_TYPES);
297
298
  uint32_t GetCount(FormatCategoryItems items = ALL_ITEM_TYPES);
299
300
614
  const char *GetName() { return m_name.GetCString(); }
301
302
  size_t GetNumLanguages();
303
304
  lldb::LanguageType GetLanguageAtIndex(size_t idx);
305
306
  void AddLanguage(lldb::LanguageType lang);
307
308
  std::string GetDescription();
309
310
  bool AnyMatches(ConstString type_name,
311
                  FormatCategoryItems items = ALL_ITEM_TYPES,
312
                  bool only_enabled = true,
313
                  const char **matching_category = nullptr,
314
                  FormatCategoryItems *matching_type = nullptr);
315
316
  typedef std::shared_ptr<TypeCategoryImpl> SharedPointer;
317
318
private:
319
  FormatContainer m_format_cont;
320
  SummaryContainer m_summary_cont;
321
  FilterContainer m_filter_cont;
322
  SynthContainer m_synth_cont;
323
324
  bool m_enabled;
325
326
  IFormatChangeListener *m_change_listener;
327
328
  std::recursive_mutex m_mutex;
329
330
  ConstString m_name;
331
332
  std::vector<lldb::LanguageType> m_languages;
333
334
  uint32_t m_enabled_position;
335
336
  void Enable(bool value, uint32_t position);
337
338
86
  void Disable() { Enable(false, UINT32_MAX); }
339
340
  bool IsApplicable(lldb::LanguageType lang);
341
342
30
  uint32_t GetLastEnabledPosition() { return m_enabled_position; }
343
344
18
  void SetEnabledPosition(uint32_t p) { m_enabled_position = p; }
345
346
  friend class FormatManager;
347
  friend class LanguageCategory;
348
  friend class TypeCategoryMap;
349
350
  friend class FormattersContainer<TypeFormatImpl>;
351
352
  friend class FormattersContainer<TypeSummaryImpl>;
353
354
  friend class FormattersContainer<TypeFilterImpl>;
355
356
  friend class FormattersContainer<ScriptedSyntheticChildren>;
357
};
358
359
} // namespace lldb_private
360
361
#endif // LLDB_DATAFORMATTERS_TYPECATEGORY_H