Coverage Report

Created: 2022-01-22 13:19

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- CPlusPlusLanguage.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 "CPlusPlusLanguage.h"
10
11
#include <cctype>
12
#include <cstring>
13
14
#include <functional>
15
#include <memory>
16
#include <mutex>
17
#include <set>
18
19
#include "llvm/ADT/StringRef.h"
20
#include "llvm/Demangle/ItaniumDemangle.h"
21
22
#include "lldb/Core/Mangled.h"
23
#include "lldb/Core/Module.h"
24
#include "lldb/Core/PluginManager.h"
25
#include "lldb/Core/UniqueCStringMap.h"
26
#include "lldb/DataFormatters/CXXFunctionPointer.h"
27
#include "lldb/DataFormatters/DataVisualization.h"
28
#include "lldb/DataFormatters/FormattersHelpers.h"
29
#include "lldb/DataFormatters/VectorType.h"
30
#include "lldb/Symbol/SymbolFile.h"
31
#include "lldb/Utility/ConstString.h"
32
#include "lldb/Utility/Log.h"
33
#include "lldb/Utility/RegularExpression.h"
34
35
#include "BlockPointer.h"
36
#include "CPlusPlusNameParser.h"
37
#include "CxxStringTypes.h"
38
#include "Generic.h"
39
#include "LibCxx.h"
40
#include "LibCxxAtomic.h"
41
#include "LibCxxVariant.h"
42
#include "LibStdcpp.h"
43
#include "MSVCUndecoratedNameParser.h"
44
45
using namespace lldb;
46
using namespace lldb_private;
47
using namespace lldb_private::formatters;
48
49
LLDB_PLUGIN_DEFINE(CPlusPlusLanguage)
50
51
3.47k
void CPlusPlusLanguage::Initialize() {
52
3.47k
  PluginManager::RegisterPlugin(GetPluginNameStatic(), "C++ Language",
53
3.47k
                                CreateInstance);
54
3.47k
}
55
56
3.46k
void CPlusPlusLanguage::Terminate() {
57
3.46k
  PluginManager::UnregisterPlugin(CreateInstance);
58
3.46k
}
59
60
513k
bool CPlusPlusLanguage::SymbolNameFitsToLanguage(Mangled mangled) const {
61
513k
  const char *mangled_name = mangled.GetMangledName().GetCString();
62
513k
  return mangled_name && 
CPlusPlusLanguage::IsCPPMangledName(mangled_name)193k
;
63
513k
}
64
65
ConstString CPlusPlusLanguage::GetDemangledFunctionNameWithoutArguments(
66
364
    Mangled mangled) const {
67
364
  const char *mangled_name_cstr = mangled.GetMangledName().GetCString();
68
364
  ConstString demangled_name = mangled.GetDemangledName();
69
364
  if (demangled_name && 
mangled_name_cstr363
&&
mangled_name_cstr[0]312
) {
70
312
    if (mangled_name_cstr[0] == '_' && mangled_name_cstr[1] == 'Z' &&
71
312
        (mangled_name_cstr[2] != 'T' && // avoid virtual table, VTT structure,
72
                                        // typeinfo structure, and typeinfo
73
                                        // mangled_name
74
312
         mangled_name_cstr[2] != 'G' && // avoid guard variables
75
312
         mangled_name_cstr[2] != 'Z'))  // named local entities (if we
76
                                        // eventually handle eSymbolTypeData,
77
                                        // we will want this back)
78
308
    {
79
308
      CPlusPlusLanguage::MethodName cxx_method(demangled_name);
80
308
      if (!cxx_method.GetBasename().empty()) {
81
308
        std::string shortname;
82
308
        if (!cxx_method.GetContext().empty())
83
171
          shortname = cxx_method.GetContext().str() + "::";
84
308
        shortname += cxx_method.GetBasename().str();
85
308
        return ConstString(shortname);
86
308
      }
87
308
    }
88
312
  }
89
56
  if (demangled_name)
90
55
    return demangled_name;
91
1
  return mangled.GetMangledName();
92
56
}
93
94
// Static Functions
95
96
177k
Language *CPlusPlusLanguage::CreateInstance(lldb::LanguageType language) {
97
  // Use plugin for C++ but not for Objective-C++ (which has its own plugin).
98
177k
  if (Language::LanguageIsCPlusPlus(language) &&
99
177k
      
language != eLanguageTypeObjC_plus_plus5.02k
)
100
4.02k
    return new CPlusPlusLanguage();
101
173k
  return nullptr;
102
177k
}
103
104
0
void CPlusPlusLanguage::MethodName::Clear() {
105
0
  m_full.Clear();
106
0
  m_basename = llvm::StringRef();
107
0
  m_context = llvm::StringRef();
108
0
  m_arguments = llvm::StringRef();
109
0
  m_qualifiers = llvm::StringRef();
110
0
  m_parsed = false;
111
0
  m_parse_error = false;
112
0
}
113
114
static bool ReverseFindMatchingChars(const llvm::StringRef &s,
115
                                     const llvm::StringRef &left_right_chars,
116
                                     size_t &left_pos, size_t &right_pos,
117
16.5k
                                     size_t pos = llvm::StringRef::npos) {
118
16.5k
  assert(left_right_chars.size() == 2);
119
0
  left_pos = llvm::StringRef::npos;
120
16.5k
  const char left_char = left_right_chars[0];
121
16.5k
  const char right_char = left_right_chars[1];
122
16.5k
  pos = s.find_last_of(left_right_chars, pos);
123
16.5k
  if (pos == llvm::StringRef::npos || 
s[pos] == left_char591
)
124
15.9k
    return false;
125
591
  right_pos = pos;
126
591
  uint32_t depth = 1;
127
701
  while (pos > 0 && depth > 0) {
128
701
    pos = s.find_last_of(left_right_chars, pos);
129
701
    if (pos == llvm::StringRef::npos)
130
0
      return false;
131
701
    if (s[pos] == left_char) {
132
646
      if (--depth == 0) {
133
591
        left_pos = pos;
134
591
        return left_pos < right_pos;
135
591
      }
136
646
    } else 
if (55
s[pos] == right_char55
) {
137
55
      ++depth;
138
55
    }
139
701
  }
140
0
  return false;
141
591
}
142
143
591
static bool IsTrivialBasename(const llvm::StringRef &basename) {
144
  // Check that the basename matches with the following regular expression
145
  // "^~?([A-Za-z_][A-Za-z_0-9]*)$" We are using a hand written implementation
146
  // because it is significantly more efficient then using the general purpose
147
  // regular expression library.
148
591
  size_t idx = 0;
149
591
  if (basename.size() > 0 && basename[0] == '~')
150
10
    idx = 1;
151
152
591
  if (basename.size() <= idx)
153
0
    return false; // Empty string or "~"
154
155
591
  if (!std::isalpha(basename[idx]) && 
basename[idx] != '_'156
)
156
18
    return false; // First character (after removing the possible '~'') isn't in
157
                  // [A-Za-z_]
158
159
  // Read all characters matching [A-Za-z_0-9]
160
573
  ++idx;
161
4.30k
  while (idx < basename.size()) {
162
3.99k
    if (!std::isalnum(basename[idx]) && 
basename[idx] != '_'618
)
163
271
      break;
164
3.72k
    ++idx;
165
3.72k
  }
166
167
  // We processed all characters. It is a vaild basename.
168
573
  return idx == basename.size();
169
591
}
170
171
16.5k
bool CPlusPlusLanguage::MethodName::TrySimplifiedParse() {
172
  // This method tries to parse simple method definitions which are presumably
173
  // most comman in user programs. Definitions that can be parsed by this
174
  // function don't have return types and templates in the name.
175
  // A::B::C::fun(std::vector<T> &) const
176
16.5k
  size_t arg_start, arg_end;
177
16.5k
  llvm::StringRef full(m_full.GetCString());
178
16.5k
  llvm::StringRef parens("()", 2);
179
16.5k
  if (ReverseFindMatchingChars(full, parens, arg_start, arg_end)) {
180
591
    m_arguments = full.substr(arg_start, arg_end - arg_start + 1);
181
591
    if (arg_end + 1 < full.size())
182
235
      m_qualifiers = full.substr(arg_end + 1).ltrim();
183
184
591
    if (arg_start == 0)
185
0
      return false;
186
591
    size_t basename_end = arg_start;
187
591
    size_t context_start = 0;
188
591
    size_t context_end = full.rfind(':', basename_end);
189
591
    if (context_end == llvm::StringRef::npos)
190
342
      m_basename = full.substr(0, basename_end);
191
249
    else {
192
249
      if (context_start < context_end)
193
249
        m_context = full.substr(context_start, context_end - 1 - context_start);
194
249
      const size_t basename_begin = context_end + 1;
195
249
      m_basename = full.substr(basename_begin, basename_end - basename_begin);
196
249
    }
197
198
591
    if (IsTrivialBasename(m_basename)) {
199
302
      return true;
200
302
    } else {
201
      // The C++ basename doesn't match our regular expressions so this can't
202
      // be a valid C++ method, clear everything out and indicate an error
203
289
      m_context = llvm::StringRef();
204
289
      m_basename = llvm::StringRef();
205
289
      m_arguments = llvm::StringRef();
206
289
      m_qualifiers = llvm::StringRef();
207
289
      return false;
208
289
    }
209
591
  }
210
15.9k
  return false;
211
16.5k
}
212
213
16.5k
void CPlusPlusLanguage::MethodName::Parse() {
214
16.5k
  if (!m_parsed && 
m_full16.5k
) {
215
16.5k
    if (TrySimplifiedParse()) {
216
302
      m_parse_error = false;
217
16.2k
    } else {
218
16.2k
      CPlusPlusNameParser parser(m_full.GetStringRef());
219
16.2k
      if (auto function = parser.ParseAsFunctionDefinition()) {
220
135
        m_basename = function.getValue().name.basename;
221
135
        m_context = function.getValue().name.context;
222
135
        m_arguments = function.getValue().arguments;
223
135
        m_qualifiers = function.getValue().qualifiers;
224
135
        m_parse_error = false;
225
16.1k
      } else {
226
16.1k
        m_parse_error = true;
227
16.1k
      }
228
16.2k
    }
229
16.5k
    m_parsed = true;
230
16.5k
  }
231
16.5k
}
232
233
11.7k
llvm::StringRef CPlusPlusLanguage::MethodName::GetBasename() {
234
11.7k
  if (!m_parsed)
235
11.4k
    Parse();
236
11.7k
  return m_basename;
237
11.7k
}
238
239
518
llvm::StringRef CPlusPlusLanguage::MethodName::GetContext() {
240
518
  if (!m_parsed)
241
1
    Parse();
242
518
  return m_context;
243
518
}
244
245
79
llvm::StringRef CPlusPlusLanguage::MethodName::GetArguments() {
246
79
  if (!m_parsed)
247
27
    Parse();
248
79
  return m_arguments;
249
79
}
250
251
61
llvm::StringRef CPlusPlusLanguage::MethodName::GetQualifiers() {
252
61
  if (!m_parsed)
253
0
    Parse();
254
61
  return m_qualifiers;
255
61
}
256
257
73
std::string CPlusPlusLanguage::MethodName::GetScopeQualifiedName() {
258
73
  if (!m_parsed)
259
48
    Parse();
260
73
  if (m_context.empty())
261
32
    return std::string(m_basename);
262
263
41
  std::string res;
264
41
  res += m_context;
265
41
  res += "::";
266
41
  res += m_basename;
267
41
  return res;
268
73
}
269
270
218k
bool CPlusPlusLanguage::IsCPPMangledName(llvm::StringRef name) {
271
  // FIXME!! we should really run through all the known C++ Language plugins
272
  // and ask each one if this is a C++ mangled name
273
274
218k
  Mangled::ManglingScheme scheme = Mangled::GetManglingScheme(name);
275
276
218k
  if (scheme == Mangled::eManglingSchemeNone)
277
207k
    return false;
278
279
11.2k
  return true;
280
218k
}
281
282
bool CPlusPlusLanguage::ExtractContextAndIdentifier(
283
34.6k
    const char *name, llvm::StringRef &context, llvm::StringRef &identifier) {
284
34.6k
  if (MSVCUndecoratedNameParser::IsMSVCUndecoratedName(name))
285
3
    return MSVCUndecoratedNameParser::ExtractContextAndIdentifier(name, context,
286
3
                                                                  identifier);
287
288
34.6k
  CPlusPlusNameParser parser(name);
289
34.6k
  if (auto full_name = parser.ParseAsFullName()) {
290
33.1k
    identifier = full_name.getValue().basename;
291
33.1k
    context = full_name.getValue().context;
292
33.1k
    return true;
293
33.1k
  }
294
1.43k
  return false;
295
34.6k
}
296
297
namespace {
298
class NodeAllocator {
299
  llvm::BumpPtrAllocator Alloc;
300
301
public:
302
428
  void reset() { Alloc.Reset(); }
303
304
3.01k
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
3.01k
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
3.01k
        T(std::forward<Args>(args)...);
307
3.01k
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [31], llvm::itanium_demangle::Node*&>(char const (&) [31], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [12], llvm::itanium_demangle::Node*&>(char const (&) [12], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [9], llvm::itanium_demangle::Node*&>(char const (&) [9], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [14], llvm::itanium_demangle::Node*&>(char const (&) [14], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [19], llvm::itanium_demangle::Node*&>(char const (&) [19], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [27], llvm::itanium_demangle::Node*&>(char const (&) [27], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::CtorVtableSpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::CtorVtableSpecialName, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [41], llvm::itanium_demangle::Node*&>(char const (&) [41], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [18], llvm::itanium_demangle::Node*&>(char const (&) [18], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [22], llvm::itanium_demangle::Node*&>(char const (&) [22], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [20], llvm::itanium_demangle::Node*&>(char const (&) [20], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [25], llvm::itanium_demangle::Node*&>(char const (&) [25], llvm::itanium_demangle::Node*&)
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [4]>(char const (&) [4])
Line
Count
Source
304
204
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
204
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
204
        T(std::forward<Args>(args)...);
307
204
  }
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NestedName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NestedName, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Line
Count
Source
304
364
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
364
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
364
        T(std::forward<Args>(args)...);
307
364
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ForwardTemplateReference* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ForwardTemplateReference, unsigned long&>(unsigned long&)
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [5]>(char const (&) [5])
Line
Count
Source
304
144
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
144
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
144
        T(std::forward<Args>(args)...);
307
144
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::IntegerLiteral* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::IntegerLiteral, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::StringView&, llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::BoolExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::BoolExpr, int>(int&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::FloatLiteralImpl<float>* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::FloatLiteralImpl<float>, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::FloatLiteralImpl<double>* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::FloatLiteralImpl<double>, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::FloatLiteralImpl<long double>* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::FloatLiteralImpl<long double>, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::StringLiteral* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::StringLiteral, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [8]>(char const (&) [8])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::UnnamedTypeName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::UnnamedTypeName, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SyntheticTemplateParamName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SyntheticTemplateParamName, llvm::itanium_demangle::TemplateParamKind&, unsigned int&>(llvm::itanium_demangle::TemplateParamKind&, unsigned int&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::TypeTemplateParamDecl* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::TypeTemplateParamDecl, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NoexceptSpec* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NoexceptSpec, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::DynamicExceptionSpec* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::DynamicExceptionSpec, llvm::itanium_demangle::NodeArray>(llvm::itanium_demangle::NodeArray&&)
CPlusPlusLanguage.cpp:llvm::itanium_demangle::FunctionType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::FunctionType, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::Qualifiers&, llvm::itanium_demangle::FunctionRefQual&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::Qualifiers&, llvm::itanium_demangle::FunctionRefQual&, llvm::itanium_demangle::Node*&)
Line
Count
Source
304
48
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
48
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
48
        T(std::forward<Args>(args)...);
307
48
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ObjCProtoName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ObjCProtoName, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::VendorExtQualType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::VendorExtQualType, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&)
CPlusPlusLanguage.cpp:llvm::itanium_demangle::QualType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::QualType, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Qualifiers&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Qualifiers&)
Line
Count
Source
304
128
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
128
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
128
        T(std::forward<Args>(args)...);
307
128
  }
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [12]>(char const (&) [12])
Line
Count
Source
304
8
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
8
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
8
        T(std::forward<Args>(args)...);
307
8
  }
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [14]>(char const (&) [14])
Line
Count
Source
304
176
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
176
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
176
        T(std::forward<Args>(args)...);
307
176
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [15]>(char const (&) [15])
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [13]>(char const (&) [13])
Line
Count
Source
304
144
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
144
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
144
        T(std::forward<Args>(args)...);
307
144
  }
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [10]>(char const (&) [10])
Line
Count
Source
304
44
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
44
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
44
        T(std::forward<Args>(args)...);
307
44
  }
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [19]>(char const (&) [19])
Line
Count
Source
304
4
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
4
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
4
        T(std::forward<Args>(args)...);
307
4
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [9]>(char const (&) [9])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [18]>(char const (&) [18])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [7]>(char const (&) [7])
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [11]>(char const (&) [11])
Line
Count
Source
304
24
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
24
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
24
        T(std::forward<Args>(args)...);
307
24
  }
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::StringView&)
Line
Count
Source
304
608
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
608
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
608
        T(std::forward<Args>(args)...);
307
608
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, llvm::itanium_demangle::StringView>(llvm::itanium_demangle::StringView&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::BinaryFPType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::BinaryFPType, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::PixelVectorType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::PixelVectorType, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::VectorType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::VectorType, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::VectorType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::VectorType, llvm::itanium_demangle::Node*&, std::nullptr_t>(llvm::itanium_demangle::Node*&, std::nullptr_t&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ArrayType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ArrayType, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::PointerToMemberType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::PointerToMemberType, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ElaboratedTypeSpefType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ElaboratedTypeSpefType, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&)
CPlusPlusLanguage.cpp:llvm::itanium_demangle::PointerType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::PointerType, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Line
Count
Source
304
448
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
448
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
448
        T(std::forward<Args>(args)...);
307
448
  }
CPlusPlusLanguage.cpp:llvm::itanium_demangle::ReferenceType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ReferenceType, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::ReferenceKind>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::ReferenceKind&&)
Line
Count
Source
304
64
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
64
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
64
        T(std::forward<Args>(args)...);
307
64
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::PostfixQualifiedType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::PostfixQualifiedType, llvm::itanium_demangle::Node*&, char const (&) [9]>(llvm::itanium_demangle::Node*&, char const (&) [9])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::PostfixQualifiedType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::PostfixQualifiedType, llvm::itanium_demangle::Node*&, char const (&) [11]>(llvm::itanium_demangle::Node*&, char const (&) [11])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NonTypeTemplateParamDecl* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NonTypeTemplateParamDecl, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::TemplateTemplateParamDecl* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::TemplateTemplateParamDecl, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::TemplateParamPackDecl* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::TemplateParamPackDecl, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ClosureTypeName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ClosureTypeName, llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [16]>(char const (&) [16])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::LambdaExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::LambdaExpr, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::EnumLiteral* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::EnumLiteral, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::FunctionParam* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::FunctionParam, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::FoldExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::FoldExpr, bool&, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(bool&, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::BinaryExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::BinaryExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::PrefixExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::PrefixExpr, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::StringView&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::CastExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::CastExpr, char const (&) [11], llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(char const (&) [11], llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::CallExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::CallExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ConversionExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ConversionExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ConversionExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ConversionExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::DeleteExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::DeleteExpr, llvm::itanium_demangle::Node*&, bool&, bool>(llvm::itanium_demangle::Node*&, bool&, bool&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::CastExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::CastExpr, char const (&) [13], llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(char const (&) [13], llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::QualifiedName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::QualifiedName, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::DtorName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::DtorName, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ConversionOperatorType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ConversionOperatorType, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::LiteralOperator* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::LiteralOperator, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::GlobalQualifiedName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::GlobalQualifiedName, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::MemberExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::MemberExpr, llvm::itanium_demangle::Node*&, char const (&) [3], llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, char const (&) [3], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::MemberExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::MemberExpr, llvm::itanium_demangle::Node*&, char const (&) [2], llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, char const (&) [2], llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ArraySubscriptExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ArraySubscriptExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::BracedExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::BracedExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, bool>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, bool&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::BracedRangeExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::BracedRangeExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::InitListExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::InitListExpr, std::nullptr_t, llvm::itanium_demangle::NodeArray>(std::nullptr_t&&, llvm::itanium_demangle::NodeArray&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::PointerToMemberConversionExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::PointerToMemberConversionExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::PostfixExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::PostfixExpr, llvm::itanium_demangle::Node*&, char const (&) [3]>(llvm::itanium_demangle::Node*&, char const (&) [3])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NewExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NewExpr, llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&, bool&, bool&>(llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&, bool&, bool&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NewExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NewExpr, llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray, bool&, bool&>(llvm::itanium_demangle::NodeArray&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&&, bool&, bool&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::EnclosingExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::EnclosingExpr, char const (&) [11], llvm::itanium_demangle::Node*&, char const (&) [2]>(char const (&) [11], llvm::itanium_demangle::Node*&, char const (&) [2])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ConditionalExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ConditionalExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::CastExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::CastExpr, char const (&) [17], llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(char const (&) [17], llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::CastExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::CastExpr, char const (&) [12], llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(char const (&) [12], llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SubobjectExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SubobjectExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::NodeArray, bool&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&, llvm::itanium_demangle::NodeArray&&, bool&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ParameterPackExpansion* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ParameterPackExpansion, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::EnclosingExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::EnclosingExpr, char const (&) [9], llvm::itanium_demangle::Node*&, char const (&) [2]>(char const (&) [9], llvm::itanium_demangle::Node*&, char const (&) [2])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SizeofParamPackExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SizeofParamPackExpr, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::EnclosingExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::EnclosingExpr, char const (&) [12], llvm::itanium_demangle::Node*&, char const (&) [2]>(char const (&) [12], llvm::itanium_demangle::Node*&, char const (&) [2])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NodeArrayNode* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NodeArrayNode, llvm::itanium_demangle::NodeArray>(llvm::itanium_demangle::NodeArray&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::InitListExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::InitListExpr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [6]>(char const (&) [6])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ThrowExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ThrowExpr, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameType* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameType, char const (&) [22]>(char const (&) [22])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::EnclosingExpr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::EnclosingExpr, char const (&) [10], llvm::itanium_demangle::Node*&, char const (&) [2]>(char const (&) [10], llvm::itanium_demangle::Node*&, char const (&) [2])
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ExpandedSpecialSubstitution* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ExpandedSpecialSubstitution, llvm::itanium_demangle::SpecialSubKind&>(llvm::itanium_demangle::SpecialSubKind&)
CPlusPlusLanguage.cpp:llvm::itanium_demangle::CtorDtorName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::CtorDtorName, llvm::itanium_demangle::Node*&, bool, int&>(llvm::itanium_demangle::Node*&, bool&&, int&)
Line
Count
Source
304
80
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
80
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
80
        T(std::forward<Args>(args)...);
307
80
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::AbiTagAttr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::AbiTagAttr, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::StructuredBindingName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::StructuredBindingName, llvm::itanium_demangle::NodeArray>(llvm::itanium_demangle::NodeArray&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::LocalName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::LocalName, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialSubstitution* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialSubstitution, llvm::itanium_demangle::SpecialSubKind>(llvm::itanium_demangle::SpecialSubKind&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::ParameterPack* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::ParameterPack, llvm::itanium_demangle::NodeArray>(llvm::itanium_demangle::NodeArray&&)
CPlusPlusLanguage.cpp:llvm::itanium_demangle::TemplateArgs* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::TemplateArgs, llvm::itanium_demangle::NodeArray>(llvm::itanium_demangle::NodeArray&&)
Line
Count
Source
304
56
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
56
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
56
        T(std::forward<Args>(args)...);
307
56
  }
CPlusPlusLanguage.cpp:llvm::itanium_demangle::NameWithTemplateArgs* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::NameWithTemplateArgs, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&)
Line
Count
Source
304
56
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
56
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
56
        T(std::forward<Args>(args)...);
307
56
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::StdQualifiedName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::StdQualifiedName, llvm::itanium_demangle::Node*&>(llvm::itanium_demangle::Node*&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::TemplateArgumentPack* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::TemplateArgumentPack, llvm::itanium_demangle::NodeArray&>(llvm::itanium_demangle::NodeArray&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::EnableIfAttr* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::EnableIfAttr, llvm::itanium_demangle::NodeArray>(llvm::itanium_demangle::NodeArray&&)
CPlusPlusLanguage.cpp:llvm::itanium_demangle::FunctionEncoding* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::FunctionEncoding, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Qualifiers&, llvm::itanium_demangle::FunctionRefQual&>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::NodeArray&&, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::Qualifiers&, llvm::itanium_demangle::FunctionRefQual&)
Line
Count
Source
304
412
  template <typename T, typename... Args> T *makeNode(Args &&... args) {
305
412
    return new (Alloc.Allocate(sizeof(T), alignof(T)))
306
412
        T(std::forward<Args>(args)...);
307
412
  }
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::DotSuffix* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::DotSuffix, llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView>(llvm::itanium_demangle::Node*&, llvm::itanium_demangle::StringView&&)
Unexecuted instantiation: CPlusPlusLanguage.cpp:llvm::itanium_demangle::SpecialName* (anonymous namespace)::NodeAllocator::makeNode<llvm::itanium_demangle::SpecialName, char const (&) [34], llvm::itanium_demangle::Node*&>(char const (&) [34], llvm::itanium_demangle::Node*&)
308
309
376
  void *allocateNodeArray(size_t sz) {
310
376
    return Alloc.Allocate(sizeof(llvm::itanium_demangle::Node *) * sz,
311
376
                          alignof(llvm::itanium_demangle::Node *));
312
376
  }
313
};
314
315
template <typename Derived>
316
class ManglingSubstitutor
317
    : public llvm::itanium_demangle::AbstractManglingParser<Derived,
318
                                                            NodeAllocator> {
319
  using Base =
320
      llvm::itanium_demangle::AbstractManglingParser<Derived, NodeAllocator>;
321
322
public:
323
214
  ManglingSubstitutor() : Base(nullptr, nullptr) {}
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::TypeSubstitutor>::ManglingSubstitutor()
Line
Count
Source
323
107
  ManglingSubstitutor() : Base(nullptr, nullptr) {}
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::CtorDtorSubstitutor>::ManglingSubstitutor()
Line
Count
Source
323
107
  ManglingSubstitutor() : Base(nullptr, nullptr) {}
324
325
  template <typename... Ts>
326
428
  ConstString substitute(llvm::StringRef Mangled, Ts &&... Vals) {
327
428
    this->getDerived().reset(Mangled, std::forward<Ts>(Vals)...);
328
428
    return substituteImpl(Mangled);
329
428
  }
CPlusPlusLanguage.cpp:lldb_private::ConstString (anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::TypeSubstitutor>::substitute<char const (&) [2], char const (&) [2]>(llvm::StringRef, char const (&) [2], char const (&) [2])
Line
Count
Source
326
321
  ConstString substitute(llvm::StringRef Mangled, Ts &&... Vals) {
327
321
    this->getDerived().reset(Mangled, std::forward<Ts>(Vals)...);
328
321
    return substituteImpl(Mangled);
329
321
  }
CPlusPlusLanguage.cpp:lldb_private::ConstString (anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::CtorDtorSubstitutor>::substitute<>(llvm::StringRef)
Line
Count
Source
326
107
  ConstString substitute(llvm::StringRef Mangled, Ts &&... Vals) {
327
107
    this->getDerived().reset(Mangled, std::forward<Ts>(Vals)...);
328
107
    return substituteImpl(Mangled);
329
107
  }
330
331
protected:
332
428
  void reset(llvm::StringRef Mangled) {
333
428
    Base::reset(Mangled.begin(), Mangled.end());
334
428
    Written = Mangled.begin();
335
428
    Result.clear();
336
428
    Substituted = false;
337
428
  }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::TypeSubstitutor>::reset(llvm::StringRef)
Line
Count
Source
332
321
  void reset(llvm::StringRef Mangled) {
333
321
    Base::reset(Mangled.begin(), Mangled.end());
334
321
    Written = Mangled.begin();
335
321
    Result.clear();
336
321
    Substituted = false;
337
321
  }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::CtorDtorSubstitutor>::reset(llvm::StringRef)
Line
Count
Source
332
107
  void reset(llvm::StringRef Mangled) {
333
107
    Base::reset(Mangled.begin(), Mangled.end());
334
107
    Written = Mangled.begin();
335
107
    Result.clear();
336
107
    Substituted = false;
337
107
  }
338
339
428
  ConstString substituteImpl(llvm::StringRef Mangled) {
340
428
    Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
341
428
    if (this->parse() == nullptr) {
342
16
      LLDB_LOG(log, "Failed to substitute mangling in {0}", Mangled);
343
16
      return ConstString();
344
16
    }
345
412
    if (!Substituted)
346
388
      return ConstString();
347
348
    // Append any trailing unmodified input.
349
24
    appendUnchangedInput();
350
24
    LLDB_LOG(log, "Substituted mangling {0} -> {1}", Mangled, Result);
351
24
    return ConstString(Result);
352
412
  }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::TypeSubstitutor>::substituteImpl(llvm::StringRef)
Line
Count
Source
339
321
  ConstString substituteImpl(llvm::StringRef Mangled) {
340
321
    Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
341
321
    if (this->parse() == nullptr) {
342
12
      LLDB_LOG(log, "Failed to substitute mangling in {0}", Mangled);
343
12
      return ConstString();
344
12
    }
345
309
    if (!Substituted)
346
305
      return ConstString();
347
348
    // Append any trailing unmodified input.
349
4
    appendUnchangedInput();
350
4
    LLDB_LOG(log, "Substituted mangling {0} -> {1}", Mangled, Result);
351
4
    return ConstString(Result);
352
309
  }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::CtorDtorSubstitutor>::substituteImpl(llvm::StringRef)
Line
Count
Source
339
107
  ConstString substituteImpl(llvm::StringRef Mangled) {
340
107
    Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
341
107
    if (this->parse() == nullptr) {
342
4
      LLDB_LOG(log, "Failed to substitute mangling in {0}", Mangled);
343
4
      return ConstString();
344
4
    }
345
103
    if (!Substituted)
346
83
      return ConstString();
347
348
    // Append any trailing unmodified input.
349
20
    appendUnchangedInput();
350
20
    LLDB_LOG(log, "Substituted mangling {0} -> {1}", Mangled, Result);
351
20
    return ConstString(Result);
352
103
  }
353
354
1.18k
  void trySubstitute(llvm::StringRef From, llvm::StringRef To) {
355
1.18k
    if (!llvm::StringRef(currentParserPos(), this->numLeft()).startswith(From))
356
1.16k
      return;
357
358
    // We found a match. Append unmodified input up to this point.
359
24
    appendUnchangedInput();
360
361
    // And then perform the replacement.
362
24
    Result += To;
363
24
    Written += From.size();
364
24
    Substituted = true;
365
24
  }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::TypeSubstitutor>::trySubstitute(llvm::StringRef, llvm::StringRef)
Line
Count
Source
354
1.14k
  void trySubstitute(llvm::StringRef From, llvm::StringRef To) {
355
1.14k
    if (!llvm::StringRef(currentParserPos(), this->numLeft()).startswith(From))
356
1.14k
      return;
357
358
    // We found a match. Append unmodified input up to this point.
359
4
    appendUnchangedInput();
360
361
    // And then perform the replacement.
362
4
    Result += To;
363
4
    Written += From.size();
364
4
    Substituted = true;
365
4
  }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::CtorDtorSubstitutor>::trySubstitute(llvm::StringRef, llvm::StringRef)
Line
Count
Source
354
40
  void trySubstitute(llvm::StringRef From, llvm::StringRef To) {
355
40
    if (!llvm::StringRef(currentParserPos(), this->numLeft()).startswith(From))
356
20
      return;
357
358
    // We found a match. Append unmodified input up to this point.
359
20
    appendUnchangedInput();
360
361
    // And then perform the replacement.
362
20
    Result += To;
363
20
    Written += From.size();
364
20
    Substituted = true;
365
20
  }
366
367
private:
368
  /// Input character until which we have constructed the respective output
369
  /// already.
370
  const char *Written;
371
372
  llvm::SmallString<128> Result;
373
374
  /// Whether we have performed any substitutions.
375
  bool Substituted;
376
377
1.28k
  const char *currentParserPos() const { return this->First; }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::TypeSubstitutor>::currentParserPos() const
Line
Count
Source
377
1.16k
  const char *currentParserPos() const { return this->First; }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::CtorDtorSubstitutor>::currentParserPos() const
Line
Count
Source
377
120
  const char *currentParserPos() const { return this->First; }
378
379
48
  void appendUnchangedInput() {
380
48
    Result +=
381
48
        llvm::StringRef(Written, std::distance(Written, currentParserPos()));
382
48
    Written = currentParserPos();
383
48
  }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::TypeSubstitutor>::appendUnchangedInput()
Line
Count
Source
379
8
  void appendUnchangedInput() {
380
8
    Result +=
381
8
        llvm::StringRef(Written, std::distance(Written, currentParserPos()));
382
8
    Written = currentParserPos();
383
8
  }
CPlusPlusLanguage.cpp:(anonymous namespace)::ManglingSubstitutor<(anonymous namespace)::CtorDtorSubstitutor>::appendUnchangedInput()
Line
Count
Source
379
40
  void appendUnchangedInput() {
380
40
    Result +=
381
40
        llvm::StringRef(Written, std::distance(Written, currentParserPos()));
382
40
    Written = currentParserPos();
383
40
  }
384
};
385
386
/// Given a mangled function `Mangled`, replace all the primitive function type
387
/// arguments of `Search` with type `Replace`.
388
class TypeSubstitutor : public ManglingSubstitutor<TypeSubstitutor> {
389
  llvm::StringRef Search;
390
  llvm::StringRef Replace;
391
392
public:
393
  void reset(llvm::StringRef Mangled, llvm::StringRef Search,
394
321
             llvm::StringRef Replace) {
395
321
    ManglingSubstitutor::reset(Mangled);
396
321
    this->Search = Search;
397
321
    this->Replace = Replace;
398
321
  }
399
400
1.14k
  llvm::itanium_demangle::Node *parseType() {
401
1.14k
    trySubstitute(Search, Replace);
402
1.14k
    return ManglingSubstitutor::parseType();
403
1.14k
  }
404
};
405
406
class CtorDtorSubstitutor : public ManglingSubstitutor<CtorDtorSubstitutor> {
407
public:
408
  llvm::itanium_demangle::Node *
409
20
  parseCtorDtorName(llvm::itanium_demangle::Node *&SoFar, NameState *State) {
410
20
    trySubstitute("C1", "C2");
411
20
    trySubstitute("D1", "D2");
412
20
    return ManglingSubstitutor::parseCtorDtorName(SoFar, State);
413
20
  }
414
};
415
} // namespace
416
417
std::vector<ConstString> CPlusPlusLanguage::GenerateAlternateFunctionManglings(
418
107
    const ConstString mangled_name) const {
419
107
  std::vector<ConstString> alternates;
420
421
  /// Get a basic set of alternative manglings for the given symbol `name`, by
422
  /// making a few basic possible substitutions on basic types, storage duration
423
  /// and `const`ness for the given symbol. The output parameter `alternates`
424
  /// is filled with a best-guess, non-exhaustive set of different manglings
425
  /// for the given name.
426
427
  // Maybe we're looking for a const symbol but the debug info told us it was
428
  // non-const...
429
107
  if (!strncmp(mangled_name.GetCString(), "_ZN", 3) &&
430
107
      
strncmp(mangled_name.GetCString(), "_ZNK", 4)29
) {
431
29
    std::string fixed_scratch("_ZNK");
432
29
    fixed_scratch.append(mangled_name.GetCString() + 3);
433
29
    alternates.push_back(ConstString(fixed_scratch));
434
29
  }
435
436
  // Maybe we're looking for a static symbol but we thought it was global...
437
107
  if (!strncmp(mangled_name.GetCString(), "_Z", 2) &&
438
107
      
strncmp(mangled_name.GetCString(), "_ZL", 3)55
) {
439
55
    std::string fixed_scratch("_ZL");
440
55
    fixed_scratch.append(mangled_name.GetCString() + 2);
441
55
    alternates.push_back(ConstString(fixed_scratch));
442
55
  }
443
444
107
  TypeSubstitutor TS;
445
  // `char` is implementation defined as either `signed` or `unsigned`.  As a
446
  // result a char parameter has 3 possible manglings: 'c'-char, 'a'-signed
447
  // char, 'h'-unsigned char.  If we're looking for symbols with a signed char
448
  // parameter, try finding matches which have the general case 'c'.
449
107
  if (ConstString char_fixup =
450
107
          TS.substitute(mangled_name.GetStringRef(), "a", "c"))
451
2
    alternates.push_back(char_fixup);
452
453
  // long long parameter mangling 'x', may actually just be a long 'l' argument
454
107
  if (ConstString long_fixup =
455
107
          TS.substitute(mangled_name.GetStringRef(), "x", "l"))
456
1
    alternates.push_back(long_fixup);
457
458
  // unsigned long long parameter mangling 'y', may actually just be unsigned
459
  // long 'm' argument
460
107
  if (ConstString ulong_fixup =
461
107
          TS.substitute(mangled_name.GetStringRef(), "y", "m"))
462
1
    alternates.push_back(ulong_fixup);
463
464
107
  if (ConstString ctor_fixup =
465
107
          CtorDtorSubstitutor().substitute(mangled_name.GetStringRef()))
466
20
    alternates.push_back(ctor_fixup);
467
468
107
  return alternates;
469
107
}
470
471
ConstString CPlusPlusLanguage::FindBestAlternateFunctionMangledName(
472
48
    const Mangled mangled, const SymbolContext &sym_ctx) const {
473
48
  ConstString demangled = mangled.GetDemangledName();
474
48
  if (!demangled)
475
0
    return ConstString();
476
477
48
  CPlusPlusLanguage::MethodName cpp_name(demangled);
478
48
  std::string scope_qualified_name = cpp_name.GetScopeQualifiedName();
479
480
48
  if (!scope_qualified_name.size())
481
0
    return ConstString();
482
483
48
  if (!sym_ctx.module_sp)
484
8
    return ConstString();
485
486
40
  lldb_private::SymbolFile *sym_file = sym_ctx.module_sp->GetSymbolFile();
487
40
  if (!sym_file)
488
0
    return ConstString();
489
490
40
  std::vector<ConstString> alternates;
491
40
  sym_file->GetMangledNamesForFunction(scope_qualified_name, alternates);
492
493
40
  std::vector<ConstString> param_and_qual_matches;
494
40
  std::vector<ConstString> param_matches;
495
67
  for (size_t i = 0; i < alternates.size(); 
i++27
) {
496
27
    ConstString alternate_mangled_name = alternates[i];
497
27
    Mangled mangled(alternate_mangled_name);
498
27
    ConstString demangled = mangled.GetDemangledName();
499
500
27
    CPlusPlusLanguage::MethodName alternate_cpp_name(demangled);
501
27
    if (!cpp_name.IsValid())
502
0
      continue;
503
504
27
    if (alternate_cpp_name.GetArguments() == cpp_name.GetArguments()) {
505
18
      if (alternate_cpp_name.GetQualifiers() == cpp_name.GetQualifiers())
506
18
        param_and_qual_matches.push_back(alternate_mangled_name);
507
0
      else
508
0
        param_matches.push_back(alternate_mangled_name);
509
18
    }
510
27
  }
511
512
40
  if (param_and_qual_matches.size())
513
17
    return param_and_qual_matches[0]; // It is assumed that there will be only
514
                                      // one!
515
23
  else if (param_matches.size())
516
0
    return param_matches[0]; // Return one of them as a best match
517
23
  else
518
23
    return ConstString();
519
40
}
520
521
627
static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
522
627
  if (!cpp_category_sp)
523
0
    return;
524
525
627
  TypeSummaryImpl::Flags stl_summary_flags;
526
627
  stl_summary_flags.SetCascades(true)
527
627
      .SetSkipPointers(false)
528
627
      .SetSkipReferences(false)
529
627
      .SetDontShowChildren(true)
530
627
      .SetDontShowValue(true)
531
627
      .SetShowMembersOneLiner(false)
532
627
      .SetHideItemNames(false);
533
534
627
  AddCXXSummary(cpp_category_sp,
535
627
                lldb_private::formatters::LibcxxStringSummaryProviderASCII,
536
627
                "std::string summary provider",
537
627
                ConstString("^std::__[[:alnum:]]+::string$"), stl_summary_flags,
538
627
                true);
539
627
  AddCXXSummary(cpp_category_sp,
540
627
                lldb_private::formatters::LibcxxStringSummaryProviderASCII,
541
627
                "std::string summary provider",
542
627
                ConstString("^std::__[[:alnum:]]+::basic_string<char, "
543
627
                            "std::__[[:alnum:]]+::char_traits<char>, "
544
627
                            "std::__[[:alnum:]]+::allocator<char> >$"),
545
627
                stl_summary_flags, true);
546
627
  AddCXXSummary(cpp_category_sp,
547
627
                lldb_private::formatters::LibcxxStringSummaryProviderASCII,
548
627
                "std::string summary provider",
549
627
                ConstString("^std::__[[:alnum:]]+::basic_string<unsigned char, "
550
627
                            "std::__[[:alnum:]]+::char_traits<unsigned char>, "
551
627
                            "std::__[[:alnum:]]+::allocator<unsigned char> >$"),
552
627
                stl_summary_flags, true);
553
554
627
  AddCXXSummary(cpp_category_sp,
555
627
                lldb_private::formatters::LibcxxStringSummaryProviderUTF16,
556
627
                "std::u16string summary provider",
557
627
                ConstString("^std::__[[:alnum:]]+::basic_string<char16_t, "
558
627
                            "std::__[[:alnum:]]+::char_traits<char16_t>, "
559
627
                            "std::__[[:alnum:]]+::allocator<char16_t> >$"),
560
627
                stl_summary_flags, true);
561
562
627
  AddCXXSummary(cpp_category_sp,
563
627
                lldb_private::formatters::LibcxxStringSummaryProviderUTF32,
564
627
                "std::u32string summary provider",
565
627
                ConstString("^std::__[[:alnum:]]+::basic_string<char32_t, "
566
627
                            "std::__[[:alnum:]]+::char_traits<char32_t>, "
567
627
                            "std::__[[:alnum:]]+::allocator<char32_t> >$"),
568
627
                stl_summary_flags, true);
569
570
627
  AddCXXSummary(
571
627
      cpp_category_sp, lldb_private::formatters::LibcxxWStringSummaryProvider,
572
627
      "std::wstring summary provider",
573
627
      ConstString("^std::__[[:alnum:]]+::wstring$"), stl_summary_flags, true);
574
627
  AddCXXSummary(cpp_category_sp,
575
627
                lldb_private::formatters::LibcxxWStringSummaryProvider,
576
627
                "std::wstring summary provider",
577
627
                ConstString("^std::__[[:alnum:]]+::basic_string<wchar_t, "
578
627
                            "std::__[[:alnum:]]+::char_traits<wchar_t>, "
579
627
                            "std::__[[:alnum:]]+::allocator<wchar_t> >$"),
580
627
                stl_summary_flags, true);
581
582
627
  AddCXXSummary(cpp_category_sp,
583
627
                lldb_private::formatters::LibcxxStringViewSummaryProviderASCII,
584
627
                "std::string_view summary provider",
585
627
                ConstString("^std::__[[:alnum:]]+::string_view$"),
586
627
                stl_summary_flags, true);
587
627
  AddCXXSummary(cpp_category_sp,
588
627
                lldb_private::formatters::LibcxxStringViewSummaryProviderASCII,
589
627
                "std::string_view summary provider",
590
627
                ConstString("^std::__[[:alnum:]]+::basic_string_view<char, "
591
627
                            "std::__[[:alnum:]]+::char_traits<char> >$"),
592
627
                stl_summary_flags, true);
593
627
  AddCXXSummary(
594
627
      cpp_category_sp,
595
627
      lldb_private::formatters::LibcxxStringViewSummaryProviderASCII,
596
627
      "std::string_view summary provider",
597
627
      ConstString("^std::__[[:alnum:]]+::basic_string_view<unsigned char, "
598
627
                  "std::__[[:alnum:]]+::char_traits<unsigned char> >$"),
599
627
      stl_summary_flags, true);
600
601
627
  AddCXXSummary(cpp_category_sp,
602
627
                lldb_private::formatters::LibcxxStringViewSummaryProviderUTF16,
603
627
                "std::u16string_view summary provider",
604
627
                ConstString("^std::__[[:alnum:]]+::basic_string_view<char16_t, "
605
627
                            "std::__[[:alnum:]]+::char_traits<char16_t> >$"),
606
627
                stl_summary_flags, true);
607
608
627
  AddCXXSummary(cpp_category_sp,
609
627
                lldb_private::formatters::LibcxxStringViewSummaryProviderUTF32,
610
627
                "std::u32string_view summary provider",
611
627
                ConstString("^std::__[[:alnum:]]+::basic_string_view<char32_t, "
612
627
                            "std::__[[:alnum:]]+::char_traits<char32_t> >$"),
613
627
                stl_summary_flags, true);
614
615
627
  AddCXXSummary(cpp_category_sp,
616
627
                lldb_private::formatters::LibcxxWStringViewSummaryProvider,
617
627
                "std::wstring_view summary provider",
618
627
                ConstString("^std::__[[:alnum:]]+::wstring_view$"),
619
627
                stl_summary_flags, true);
620
627
  AddCXXSummary(cpp_category_sp,
621
627
                lldb_private::formatters::LibcxxWStringViewSummaryProvider,
622
627
                "std::wstring_view summary provider",
623
627
                ConstString("^std::__[[:alnum:]]+::basic_string_view<wchar_t, "
624
627
                            "std::__[[:alnum:]]+::char_traits<wchar_t> >$"),
625
627
                stl_summary_flags, true);
626
627
627
  SyntheticChildren::Flags stl_synth_flags;
628
627
  stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(
629
627
      false);
630
627
  SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
631
627
  stl_deref_flags.SetFrontEndWantsDereference();
632
633
627
  AddCXXSynthetic(
634
627
      cpp_category_sp,
635
627
      lldb_private::formatters::LibcxxBitsetSyntheticFrontEndCreator,
636
627
      "libc++ std::bitset synthetic children",
637
627
      ConstString("^std::__[[:alnum:]]+::bitset<.+>(( )?&)?$"), stl_deref_flags,
638
627
      true);
639
627
  AddCXXSynthetic(
640
627
      cpp_category_sp,
641
627
      lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator,
642
627
      "libc++ std::vector synthetic children",
643
627
      ConstString("^std::__[[:alnum:]]+::vector<.+>(( )?&)?$"), stl_deref_flags,
644
627
      true);
645
627
  AddCXXSynthetic(
646
627
      cpp_category_sp,
647
627
      lldb_private::formatters::LibcxxStdForwardListSyntheticFrontEndCreator,
648
627
      "libc++ std::forward_list synthetic children",
649
627
      ConstString("^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$"),
650
627
      stl_synth_flags, true);
651
627
  AddCXXSynthetic(
652
627
      cpp_category_sp,
653
627
      lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
654
627
      "libc++ std::list synthetic children",
655
      // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( )?&)?$"
656
      // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
657
627
      ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
658
627
                  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
659
627
      stl_deref_flags, true);
660
627
  AddCXXSynthetic(
661
627
      cpp_category_sp,
662
627
      lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
663
627
      "libc++ std::map synthetic children",
664
627
      ConstString("^std::__[[:alnum:]]+::map<.+> >(( )?&)?$"), stl_synth_flags,
665
627
      true);
666
627
  AddCXXSynthetic(
667
627
      cpp_category_sp,
668
627
      lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
669
627
      "libc++ std::set synthetic children",
670
627
      ConstString("^std::__[[:alnum:]]+::set<.+> >(( )?&)?$"), stl_deref_flags,
671
627
      true);
672
627
  AddCXXSynthetic(
673
627
      cpp_category_sp,
674
627
      lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
675
627
      "libc++ std::multiset synthetic children",
676
627
      ConstString("^std::__[[:alnum:]]+::multiset<.+> >(( )?&)?$"),
677
627
      stl_deref_flags, true);
678
627
  AddCXXSynthetic(
679
627
      cpp_category_sp,
680
627
      lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
681
627
      "libc++ std::multimap synthetic children",
682
627
      ConstString("^std::__[[:alnum:]]+::multimap<.+> >(( )?&)?$"),
683
627
      stl_synth_flags, true);
684
627
  AddCXXSynthetic(
685
627
      cpp_category_sp,
686
627
      lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEndCreator,
687
627
      "libc++ std::unordered containers synthetic children",
688
627
      ConstString("^(std::__[[:alnum:]]+::)unordered_(multi)?(map|set)<.+> >$"),
689
627
      stl_synth_flags, true);
690
627
  AddCXXSynthetic(
691
627
      cpp_category_sp,
692
627
      lldb_private::formatters::LibcxxInitializerListSyntheticFrontEndCreator,
693
627
      "libc++ std::initializer_list synthetic children",
694
627
      ConstString("^std::initializer_list<.+>(( )?&)?$"), stl_synth_flags,
695
627
      true);
696
627
  AddCXXSynthetic(cpp_category_sp, LibcxxQueueFrontEndCreator,
697
627
                  "libc++ std::queue synthetic children",
698
627
                  ConstString("^std::__[[:alnum:]]+::queue<.+>(( )?&)?$"),
699
627
                  stl_synth_flags, true);
700
627
  AddCXXSynthetic(cpp_category_sp, LibcxxTupleFrontEndCreator,
701
627
                  "libc++ std::tuple synthetic children",
702
627
                  ConstString("^std::__[[:alnum:]]+::tuple<.*>(( )?&)?$"),
703
627
                  stl_synth_flags, true);
704
627
  AddCXXSynthetic(cpp_category_sp, LibcxxOptionalSyntheticFrontEndCreator,
705
627
                  "libc++ std::optional synthetic children",
706
627
                  ConstString("^std::__[[:alnum:]]+::optional<.+>(( )?&)?$"),
707
627
                  stl_synth_flags, true);
708
627
  AddCXXSynthetic(cpp_category_sp, LibcxxVariantFrontEndCreator,
709
627
                  "libc++ std::variant synthetic children",
710
627
                  ConstString("^std::__[[:alnum:]]+::variant<.+>(( )?&)?$"),
711
627
                  stl_synth_flags, true);
712
627
  AddCXXSynthetic(
713
627
      cpp_category_sp,
714
627
      lldb_private::formatters::LibcxxAtomicSyntheticFrontEndCreator,
715
627
      "libc++ std::atomic synthetic children",
716
627
      ConstString("^std::__[[:alnum:]]+::atomic<.+>$"), stl_synth_flags, true);
717
718
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
719
627
      RegularExpression("^(std::__[[:alnum:]]+::)deque<.+>(( )?&)?$"),
720
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
721
627
          stl_synth_flags,
722
627
          "lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
723
724
627
  AddCXXSynthetic(
725
627
      cpp_category_sp,
726
627
      lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator,
727
627
      "shared_ptr synthetic children",
728
627
      ConstString("^(std::__[[:alnum:]]+::)shared_ptr<.+>(( )?&)?$"),
729
627
      stl_synth_flags, true);
730
731
627
  ConstString libcxx_std_unique_ptr_regex(
732
627
      "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$");
733
627
  AddCXXSynthetic(
734
627
      cpp_category_sp,
735
627
      lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEndCreator,
736
627
      "unique_ptr synthetic children", libcxx_std_unique_ptr_regex,
737
627
      stl_synth_flags, true);
738
739
627
  AddCXXSynthetic(
740
627
      cpp_category_sp,
741
627
      lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator,
742
627
      "weak_ptr synthetic children",
743
627
      ConstString("^(std::__[[:alnum:]]+::)weak_ptr<.+>(( )?&)?$"),
744
627
      stl_synth_flags, true);
745
627
  AddCXXSummary(cpp_category_sp,
746
627
                lldb_private::formatters::LibcxxFunctionSummaryProvider,
747
627
                "libc++ std::function summary provider",
748
627
                ConstString("^std::__[[:alnum:]]+::function<.+>$"),
749
627
                stl_summary_flags, true);
750
751
627
  stl_summary_flags.SetDontShowChildren(false);
752
627
  stl_summary_flags.SetSkipPointers(false);
753
627
  AddCXXSummary(cpp_category_sp,
754
627
                lldb_private::formatters::LibcxxContainerSummaryProvider,
755
627
                "libc++ std::bitset summary provider",
756
627
                ConstString("^std::__[[:alnum:]]+::bitset<.+>(( )?&)?$"),
757
627
                stl_summary_flags, true);
758
627
  AddCXXSummary(cpp_category_sp,
759
627
                lldb_private::formatters::LibcxxContainerSummaryProvider,
760
627
                "libc++ std::vector summary provider",
761
627
                ConstString("^std::__[[:alnum:]]+::vector<.+>(( )?&)?$"),
762
627
                stl_summary_flags, true);
763
627
  AddCXXSummary(cpp_category_sp,
764
627
                lldb_private::formatters::LibcxxContainerSummaryProvider,
765
627
                "libc++ std::list summary provider",
766
627
                ConstString("^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$"),
767
627
                stl_summary_flags, true);
768
627
  AddCXXSummary(
769
627
      cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
770
627
      "libc++ std::list summary provider",
771
      // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( )?&)?$"
772
      // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
773
627
      ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
774
627
                  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
775
627
      stl_summary_flags, true);
776
627
  AddCXXSummary(cpp_category_sp,
777
627
                lldb_private::formatters::LibcxxContainerSummaryProvider,
778
627
                "libc++ std::map summary provider",
779
627
                ConstString("^std::__[[:alnum:]]+::map<.+>(( )?&)?$"),
780
627
                stl_summary_flags, true);
781
627
  AddCXXSummary(cpp_category_sp,
782
627
                lldb_private::formatters::LibcxxContainerSummaryProvider,
783
627
                "libc++ std::deque summary provider",
784
627
                ConstString("^std::__[[:alnum:]]+::deque<.+>(( )?&)?$"),
785
627
                stl_summary_flags, true);
786
627
  AddCXXSummary(cpp_category_sp,
787
627
                lldb_private::formatters::LibcxxContainerSummaryProvider,
788
627
                "libc++ std::queue summary provider",
789
627
                ConstString("^std::__[[:alnum:]]+::queue<.+>(( )?&)?$"),
790
627
                stl_summary_flags, true);
791
627
  AddCXXSummary(cpp_category_sp,
792
627
                lldb_private::formatters::LibcxxContainerSummaryProvider,
793
627
                "libc++ std::set summary provider",
794
627
                ConstString("^std::__[[:alnum:]]+::set<.+>(( )?&)?$"),
795
627
                stl_summary_flags, true);
796
627
  AddCXXSummary(cpp_category_sp,
797
627
                lldb_private::formatters::LibcxxContainerSummaryProvider,
798
627
                "libc++ std::multiset summary provider",
799
627
                ConstString("^std::__[[:alnum:]]+::multiset<.+>(( )?&)?$"),
800
627
                stl_summary_flags, true);
801
627
  AddCXXSummary(cpp_category_sp,
802
627
                lldb_private::formatters::LibcxxContainerSummaryProvider,
803
627
                "libc++ std::multimap summary provider",
804
627
                ConstString("^std::__[[:alnum:]]+::multimap<.+>(( )?&)?$"),
805
627
                stl_summary_flags, true);
806
627
  AddCXXSummary(
807
627
      cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
808
627
      "libc++ std::unordered containers summary provider",
809
627
      ConstString("^(std::__[[:alnum:]]+::)unordered_(multi)?(map|set)<.+> >$"),
810
627
      stl_summary_flags, true);
811
627
  AddCXXSummary(cpp_category_sp, LibcxxContainerSummaryProvider,
812
627
                "libc++ std::tuple summary provider",
813
627
                ConstString("^std::__[[:alnum:]]+::tuple<.*>(( )?&)?$"),
814
627
                stl_summary_flags, true);
815
627
  AddCXXSummary(cpp_category_sp,
816
627
                lldb_private::formatters::LibCxxAtomicSummaryProvider,
817
627
                "libc++ std::atomic summary provider",
818
627
                ConstString("^std::__[[:alnum:]]+::atomic<.+>$"),
819
627
                stl_summary_flags, true);
820
627
  AddCXXSummary(cpp_category_sp,
821
627
                lldb_private::formatters::GenericOptionalSummaryProvider,
822
627
                "libc++ std::optional summary provider",
823
627
                ConstString("^std::__[[:alnum:]]+::optional<.+>(( )?&)?$"),
824
627
                stl_summary_flags, true);
825
627
  AddCXXSummary(cpp_category_sp,
826
627
                lldb_private::formatters::LibcxxVariantSummaryProvider,
827
627
                "libc++ std::variant summary provider",
828
627
                ConstString("^std::__[[:alnum:]]+::variant<.+>(( )?&)?$"),
829
627
                stl_summary_flags, true);
830
831
627
  stl_summary_flags.SetSkipPointers(true);
832
833
627
  AddCXXSummary(cpp_category_sp,
834
627
                lldb_private::formatters::LibcxxSmartPointerSummaryProvider,
835
627
                "libc++ std::shared_ptr summary provider",
836
627
                ConstString("^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"),
837
627
                stl_summary_flags, true);
838
627
  AddCXXSummary(cpp_category_sp,
839
627
                lldb_private::formatters::LibcxxSmartPointerSummaryProvider,
840
627
                "libc++ std::weak_ptr summary provider",
841
627
                ConstString("^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"),
842
627
                stl_summary_flags, true);
843
627
  AddCXXSummary(cpp_category_sp,
844
627
                lldb_private::formatters::LibcxxUniquePointerSummaryProvider,
845
627
                "libc++ std::unique_ptr summary provider",
846
627
                libcxx_std_unique_ptr_regex, stl_summary_flags, true);
847
848
627
  AddCXXSynthetic(
849
627
      cpp_category_sp,
850
627
      lldb_private::formatters::LibCxxVectorIteratorSyntheticFrontEndCreator,
851
627
      "std::vector iterator synthetic children",
852
627
      ConstString("^std::__[[:alnum:]]+::__wrap_iter<.+>$"), stl_synth_flags,
853
627
      true);
854
855
627
  AddCXXSynthetic(
856
627
      cpp_category_sp,
857
627
      lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEndCreator,
858
627
      "std::map iterator synthetic children",
859
627
      ConstString("^std::__[[:alnum:]]+::__map_iterator<.+>$"), stl_synth_flags,
860
627
      true);
861
627
}
862
863
627
static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
864
627
  if (!cpp_category_sp)
865
0
    return;
866
867
627
  TypeSummaryImpl::Flags stl_summary_flags;
868
627
  stl_summary_flags.SetCascades(true)
869
627
      .SetSkipPointers(false)
870
627
      .SetSkipReferences(false)
871
627
      .SetDontShowChildren(true)
872
627
      .SetDontShowValue(true)
873
627
      .SetShowMembersOneLiner(false)
874
627
      .SetHideItemNames(false);
875
876
627
  lldb::TypeSummaryImplSP std_string_summary_sp(
877
627
      new StringSummaryFormat(stl_summary_flags, "${var._M_dataplus._M_p}"));
878
879
627
  lldb::TypeSummaryImplSP cxx11_string_summary_sp(new CXXFunctionSummaryFormat(
880
627
      stl_summary_flags, LibStdcppStringSummaryProvider,
881
627
      "libstdc++ c++11 std::string summary provider"));
882
627
  lldb::TypeSummaryImplSP cxx11_wstring_summary_sp(new CXXFunctionSummaryFormat(
883
627
      stl_summary_flags, LibStdcppWStringSummaryProvider,
884
627
      "libstdc++ c++11 std::wstring summary provider"));
885
886
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::string"),
887
627
                                                    std_string_summary_sp);
888
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
889
627
      ConstString("std::basic_string<char>"), std_string_summary_sp);
890
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
891
627
      ConstString("std::basic_string<char,std::char_traits<char>,std::"
892
627
                  "allocator<char> >"),
893
627
      std_string_summary_sp);
894
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
895
627
      ConstString("std::basic_string<char, std::char_traits<char>, "
896
627
                  "std::allocator<char> >"),
897
627
      std_string_summary_sp);
898
899
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
900
627
      ConstString("std::__cxx11::string"), cxx11_string_summary_sp);
901
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
902
627
      ConstString("std::__cxx11::basic_string<char, std::char_traits<char>, "
903
627
                  "std::allocator<char> >"),
904
627
      cxx11_string_summary_sp);
905
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
906
627
      ConstString("std::__cxx11::basic_string<unsigned char, "
907
627
                  "std::char_traits<unsigned char>, "
908
627
                  "std::allocator<unsigned char> >"),
909
627
      cxx11_string_summary_sp);
910
911
  // making sure we force-pick the summary for printing wstring (_M_p is a
912
  // wchar_t*)
913
627
  lldb::TypeSummaryImplSP std_wstring_summary_sp(
914
627
      new StringSummaryFormat(stl_summary_flags, "${var._M_dataplus._M_p%S}"));
915
916
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::wstring"),
917
627
                                                    std_wstring_summary_sp);
918
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
919
627
      ConstString("std::basic_string<wchar_t>"), std_wstring_summary_sp);
920
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
921
627
      ConstString("std::basic_string<wchar_t,std::char_traits<wchar_t>,std::"
922
627
                  "allocator<wchar_t> >"),
923
627
      std_wstring_summary_sp);
924
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
925
627
      ConstString("std::basic_string<wchar_t, std::char_traits<wchar_t>, "
926
627
                  "std::allocator<wchar_t> >"),
927
627
      std_wstring_summary_sp);
928
929
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
930
627
      ConstString("std::__cxx11::wstring"), cxx11_wstring_summary_sp);
931
627
  cpp_category_sp->GetTypeSummariesContainer()->Add(
932
627
      ConstString("std::__cxx11::basic_string<wchar_t, "
933
627
                  "std::char_traits<wchar_t>, std::allocator<wchar_t> >"),
934
627
      cxx11_wstring_summary_sp);
935
936
627
  SyntheticChildren::Flags stl_synth_flags;
937
627
  stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(
938
627
      false);
939
627
  SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
940
627
  stl_deref_flags.SetFrontEndWantsDereference();
941
942
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
943
627
      RegularExpression("^std::vector<.+>(( )?&)?$"),
944
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
945
627
          stl_synth_flags,
946
627
          "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
947
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
948
627
      RegularExpression("^std::map<.+> >(( )?&)?$"),
949
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
950
627
          stl_synth_flags,
951
627
          "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
952
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
953
627
      RegularExpression("^std::deque<.+>(( )?&)?$"),
954
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
955
627
          stl_deref_flags,
956
627
          "lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider")));
957
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
958
627
      RegularExpression("^std::set<.+> >(( )?&)?$"),
959
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
960
627
          stl_deref_flags,
961
627
          "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
962
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
963
627
      RegularExpression("^std::multimap<.+> >(( )?&)?$"),
964
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
965
627
          stl_deref_flags,
966
627
          "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
967
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
968
627
      RegularExpression("^std::multiset<.+> >(( )?&)?$"),
969
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
970
627
          stl_deref_flags,
971
627
          "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
972
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
973
627
      RegularExpression("^std::unordered_(multi)?(map|set)<.+> >$"),
974
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
975
627
          stl_deref_flags,
976
627
          "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
977
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
978
627
      RegularExpression("^std::(__cxx11::)?list<.+>(( )?&)?$"),
979
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
980
627
          stl_deref_flags,
981
627
          "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
982
627
  cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
983
627
      RegularExpression("^std::(__cxx11::)?forward_list<.+>(( )?&)?$"),
984
627
      SyntheticChildrenSP(new ScriptedSyntheticChildren(
985
627
          stl_synth_flags,
986
627
          "lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider")));
987
988
627
  stl_summary_flags.SetDontShowChildren(false);
989
627
  stl_summary_flags.SetSkipPointers(false);
990
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
991
627
      RegularExpression("^std::bitset<.+>(( )?&)?$"),
992
627
      TypeSummaryImplSP(
993
627
          new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
994
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
995
627
      RegularExpression("^std::vector<.+>(( )?&)?$"),
996
627
      TypeSummaryImplSP(
997
627
          new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
998
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
999
627
      RegularExpression("^std::map<.+> >(( )?&)?$"),
1000
627
      TypeSummaryImplSP(
1001
627
          new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
1002
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
1003
627
      RegularExpression("^std::set<.+> >(( )?&)?$"),
1004
627
      TypeSummaryImplSP(
1005
627
          new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
1006
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
1007
627
      RegularExpression("^std::deque<.+>(( )?&)?$"),
1008
627
      TypeSummaryImplSP(
1009
627
          new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
1010
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
1011
627
      RegularExpression("^std::multimap<.+> >(( )?&)?$"),
1012
627
      TypeSummaryImplSP(
1013
627
          new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
1014
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
1015
627
      RegularExpression("^std::multiset<.+> >(( )?&)?$"),
1016
627
      TypeSummaryImplSP(
1017
627
          new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
1018
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
1019
627
      RegularExpression("^std::unordered_(multi)?(map|set)<.+> >$"),
1020
627
      TypeSummaryImplSP(
1021
627
          new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
1022
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
1023
627
      RegularExpression("^std::(__cxx11::)?list<.+>(( )?&)?$"),
1024
627
      TypeSummaryImplSP(
1025
627
          new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
1026
627
  cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
1027
627
      RegularExpression("^std::(__cxx11::)?forward_list<.+>(( )?&)?$"),
1028
627
      TypeSummaryImplSP(
1029
627
          new ScriptSummaryFormat(stl_summary_flags, "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider")));
1030
1031
627
  AddCXXSynthetic(
1032
627
      cpp_category_sp,
1033
627
      lldb_private::formatters::LibStdcppVectorIteratorSyntheticFrontEndCreator,
1034
627
      "std::vector iterator synthetic children",
1035
627
      ConstString("^__gnu_cxx::__normal_iterator<.+>$"), stl_synth_flags, true);
1036
1037
627
  AddCXXSynthetic(
1038
627
      cpp_category_sp,
1039
627
      lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEndCreator,
1040
627
      "std::map iterator synthetic children",
1041
627
      ConstString("^std::_Rb_tree_iterator<.+>$"), stl_synth_flags, true);
1042
1043
627
  AddCXXSynthetic(
1044
627
      cpp_category_sp,
1045
627
      lldb_private::formatters::LibStdcppUniquePtrSyntheticFrontEndCreator,
1046
627
      "std::unique_ptr synthetic children",
1047
627
      ConstString("^std::unique_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
1048
627
  AddCXXSynthetic(
1049
627
      cpp_category_sp,
1050
627
      lldb_private::formatters::LibStdcppSharedPtrSyntheticFrontEndCreator,
1051
627
      "std::shared_ptr synthetic children",
1052
627
      ConstString("^std::shared_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
1053
627
  AddCXXSynthetic(
1054
627
      cpp_category_sp,
1055
627
      lldb_private::formatters::LibStdcppSharedPtrSyntheticFrontEndCreator,
1056
627
      "std::weak_ptr synthetic children",
1057
627
      ConstString("^std::weak_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
1058
627
  AddCXXSynthetic(
1059
627
      cpp_category_sp,
1060
627
      lldb_private::formatters::LibStdcppTupleSyntheticFrontEndCreator,
1061
627
      "std::tuple synthetic children", ConstString("^std::tuple<.+>(( )?&)?$"),
1062
627
      stl_synth_flags, true);
1063
1064
627
  AddCXXSynthetic(
1065
627
      cpp_category_sp,
1066
627
      lldb_private::formatters::LibStdcppBitsetSyntheticFrontEndCreator,
1067
627
      "std::bitset synthetic child", ConstString("^std::bitset<.+>(( )?&)?$"),
1068
627
      stl_deref_flags, true);
1069
1070
627
  AddCXXSynthetic(
1071
627
      cpp_category_sp,
1072
627
      lldb_private::formatters::LibStdcppOptionalSyntheticFrontEndCreator,
1073
627
      "std::optional synthetic child",
1074
627
      ConstString("^std::optional<.+>(( )?&)?$"), stl_deref_flags, true);
1075
1076
627
  AddCXXSummary(cpp_category_sp,
1077
627
                lldb_private::formatters::LibStdcppUniquePointerSummaryProvider,
1078
627
                "libstdc++ std::unique_ptr summary provider",
1079
627
                ConstString("^std::unique_ptr<.+>(( )?&)?$"), stl_summary_flags,
1080
627
                true);
1081
627
  AddCXXSummary(cpp_category_sp,
1082
627
                lldb_private::formatters::LibStdcppSmartPointerSummaryProvider,
1083
627
                "libstdc++ std::shared_ptr summary provider",
1084
627
                ConstString("^std::shared_ptr<.+>(( )?&)?$"), stl_summary_flags,
1085
627
                true);
1086
627
  AddCXXSummary(cpp_category_sp,
1087
627
                lldb_private::formatters::LibStdcppSmartPointerSummaryProvider,
1088
627
                "libstdc++ std::weak_ptr summary provider",
1089
627
                ConstString("^std::weak_ptr<.+>(( )?&)?$"), stl_summary_flags,
1090
627
                true);
1091
627
  AddCXXSummary(
1092
627
      cpp_category_sp, lldb_private::formatters::GenericOptionalSummaryProvider,
1093
627
      "libstd++ std::optional summary provider",
1094
627
      ConstString("^std::optional<.+>(( )?&)?$"), stl_summary_flags, true);
1095
627
}
1096
1097
627
static void LoadSystemFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
1098
627
  if (!cpp_category_sp)
1099
0
    return;
1100
1101
627
  TypeSummaryImpl::Flags string_flags;
1102
627
  string_flags.SetCascades(true)
1103
627
      .SetSkipPointers(true)
1104
627
      .SetSkipReferences(false)
1105
627
      .SetDontShowChildren(true)
1106
627
      .SetDontShowValue(false)
1107
627
      .SetShowMembersOneLiner(false)
1108
627
      .SetHideItemNames(false);
1109
1110
627
  TypeSummaryImpl::Flags string_array_flags;
1111
627
  string_array_flags.SetCascades(true)
1112
627
      .SetSkipPointers(true)
1113
627
      .SetSkipReferences(false)
1114
627
      .SetDontShowChildren(true)
1115
627
      .SetDontShowValue(true)
1116
627
      .SetShowMembersOneLiner(false)
1117
627
      .SetHideItemNames(false);
1118
1119
627
  AddCXXSummary(
1120
627
      cpp_category_sp, lldb_private::formatters::Char8StringSummaryProvider,
1121
627
      "char8_t * summary provider", ConstString("char8_t *"), string_flags);
1122
627
  AddCXXSummary(cpp_category_sp,
1123
627
                lldb_private::formatters::Char8StringSummaryProvider,
1124
627
                "char8_t [] summary provider",
1125
627
                ConstString("char8_t ?\\[[0-9]+\\]"), string_array_flags, true);
1126
1127
627
  AddCXXSummary(
1128
627
      cpp_category_sp, lldb_private::formatters::Char16StringSummaryProvider,
1129
627
      "char16_t * summary provider", ConstString("char16_t *"), string_flags);
1130
627
  AddCXXSummary(cpp_category_sp,
1131
627
                lldb_private::formatters::Char16StringSummaryProvider,
1132
627
                "char16_t [] summary provider",
1133
627
                ConstString("char16_t ?\\[[0-9]+\\]"), string_array_flags, true);
1134
1135
627
  AddCXXSummary(
1136
627
      cpp_category_sp, lldb_private::formatters::Char32StringSummaryProvider,
1137
627
      "char32_t * summary provider", ConstString("char32_t *"), string_flags);
1138
627
  AddCXXSummary(cpp_category_sp,
1139
627
                lldb_private::formatters::Char32StringSummaryProvider,
1140
627
                "char32_t [] summary provider",
1141
627
                ConstString("char32_t ?\\[[0-9]+\\]"), string_array_flags, true);
1142
1143
627
  AddCXXSummary(
1144
627
      cpp_category_sp, lldb_private::formatters::WCharStringSummaryProvider,
1145
627
      "wchar_t * summary provider", ConstString("wchar_t *"), string_flags);
1146
627
  AddCXXSummary(cpp_category_sp,
1147
627
                lldb_private::formatters::WCharStringSummaryProvider,
1148
627
                "wchar_t * summary provider",
1149
627
                ConstString("wchar_t ?\\[[0-9]+\\]"), string_array_flags, true);
1150
1151
627
  AddCXXSummary(
1152
627
      cpp_category_sp, lldb_private::formatters::Char16StringSummaryProvider,
1153
627
      "unichar * summary provider", ConstString("unichar *"), string_flags);
1154
1155
627
  TypeSummaryImpl::Flags widechar_flags;
1156
627
  widechar_flags.SetDontShowValue(true)
1157
627
      .SetSkipPointers(true)
1158
627
      .SetSkipReferences(false)
1159
627
      .SetCascades(true)
1160
627
      .SetDontShowChildren(true)
1161
627
      .SetHideItemNames(true)
1162
627
      .SetShowMembersOneLiner(false);
1163
1164
627
  AddCXXSummary(cpp_category_sp, lldb_private::formatters::Char8SummaryProvider,
1165
627
                "char8_t summary provider", ConstString("char8_t"),
1166
627
                widechar_flags);
1167
627
  AddCXXSummary(
1168
627
      cpp_category_sp, lldb_private::formatters::Char16SummaryProvider,
1169
627
      "char16_t summary provider", ConstString("char16_t"), widechar_flags);
1170
627
  AddCXXSummary(
1171
627
      cpp_category_sp, lldb_private::formatters::Char32SummaryProvider,
1172
627
      "char32_t summary provider", ConstString("char32_t"), widechar_flags);
1173
627
  AddCXXSummary(cpp_category_sp, lldb_private::formatters::WCharSummaryProvider,
1174
627
                "wchar_t summary provider", ConstString("wchar_t"),
1175
627
                widechar_flags);
1176
1177
627
  AddCXXSummary(
1178
627
      cpp_category_sp, lldb_private::formatters::Char16SummaryProvider,
1179
627
      "unichar summary provider", ConstString("unichar"), widechar_flags);
1180
627
}
1181
1182
94
std::unique_ptr<Language::TypeScavenger> CPlusPlusLanguage::GetTypeScavenger() {
1183
94
  class CPlusPlusTypeScavenger : public Language::ImageListTypeScavenger {
1184
94
  public:
1185
94
    CompilerType AdjustForInclusion(CompilerType &candidate) override {
1186
34
      LanguageType lang_type(candidate.GetMinimumLanguage());
1187
34
      if (!Language::LanguageIsC(lang_type) &&
1188
34
          
!Language::LanguageIsCPlusPlus(lang_type)33
)
1189
24
        return CompilerType();
1190
10
      if (candidate.IsTypedefType())
1191
3
        return candidate.GetTypedefedType();
1192
7
      return candidate;
1193
10
    }
1194
94
  };
1195
1196
94
  return std::unique_ptr<TypeScavenger>(new CPlusPlusTypeScavenger());
1197
94
}
1198
1199
627
lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() {
1200
627
  static llvm::once_flag g_initialize;
1201
627
  static TypeCategoryImplSP g_category;
1202
1203
627
  llvm::call_once(g_initialize, [this]() -> void {
1204
627
    DataVisualization::Categories::GetCategory(ConstString(GetPluginName()),
1205
627
                                               g_category);
1206
627
    if (g_category) {
1207
627
      LoadLibStdcppFormatters(g_category);
1208
627
      LoadLibCxxFormatters(g_category);
1209
627
      LoadSystemFormatters(g_category);
1210
627
    }
1211
627
  });
1212
627
  return g_category;
1213
627
}
1214
1215
HardcodedFormatters::HardcodedSummaryFinder
1216
627
CPlusPlusLanguage::GetHardcodedSummaries() {
1217
627
  static llvm::once_flag g_initialize;
1218
627
  static ConstString g_vectortypes("VectorTypes");
1219
627
  static HardcodedFormatters::HardcodedSummaryFinder g_formatters;
1220
1221
627
  llvm::call_once(g_initialize, []() -> void {
1222
627
    g_formatters.push_back(
1223
627
        [](lldb_private::ValueObject &valobj, lldb::DynamicValueType,
1224
78.9k
           FormatManager &) -> TypeSummaryImpl::SharedPointer {
1225
78.9k
          static CXXFunctionSummaryFormat::SharedPointer formatter_sp(
1226
78.9k
              new CXXFunctionSummaryFormat(
1227
78.9k
                  TypeSummaryImpl::Flags(),
1228
78.9k
                  lldb_private::formatters::CXXFunctionPointerSummaryProvider,
1229
78.9k
                  "Function pointer summary provider"));
1230
78.9k
          if (valobj.GetCompilerType().IsFunctionPointerType()) {
1231
135
            return formatter_sp;
1232
135
          }
1233
78.7k
          return nullptr;
1234
78.9k
        });
1235
627
    g_formatters.push_back(
1236
627
        [](lldb_private::ValueObject &valobj, lldb::DynamicValueType,
1237
78.7k
           FormatManager &fmt_mgr) -> TypeSummaryImpl::SharedPointer {
1238
78.7k
          static CXXFunctionSummaryFormat::SharedPointer formatter_sp(
1239
78.7k
              new CXXFunctionSummaryFormat(
1240
78.7k
                  TypeSummaryImpl::Flags()
1241
78.7k
                      .SetCascades(true)
1242
78.7k
                      .SetDontShowChildren(true)
1243
78.7k
                      .SetHideItemNames(true)
1244
78.7k
                      .SetShowMembersOneLiner(true)
1245
78.7k
                      .SetSkipPointers(true)
1246
78.7k
                      .SetSkipReferences(false),
1247
78.7k
                  lldb_private::formatters::VectorTypeSummaryProvider,
1248
78.7k
                  "vector_type pointer summary provider"));
1249
78.7k
          if (valobj.GetCompilerType().IsVectorType()) {
1250
836
            if (fmt_mgr.GetCategory(g_vectortypes)->IsEnabled())
1251
836
              return formatter_sp;
1252
836
          }
1253
77.9k
          return nullptr;
1254
78.7k
        });
1255
627
    g_formatters.push_back(
1256
627
        [](lldb_private::ValueObject &valobj, lldb::DynamicValueType,
1257
77.9k
           FormatManager &fmt_mgr) -> TypeSummaryImpl::SharedPointer {
1258
77.9k
          static CXXFunctionSummaryFormat::SharedPointer formatter_sp(
1259
77.9k
              new CXXFunctionSummaryFormat(
1260
77.9k
                  TypeSummaryImpl::Flags()
1261
77.9k
                      .SetCascades(true)
1262
77.9k
                      .SetDontShowChildren(true)
1263
77.9k
                      .SetHideItemNames(true)
1264
77.9k
                      .SetShowMembersOneLiner(true)
1265
77.9k
                      .SetSkipPointers(true)
1266
77.9k
                      .SetSkipReferences(false),
1267
77.9k
                  lldb_private::formatters::BlockPointerSummaryProvider,
1268
77.9k
                  "block pointer summary provider"));
1269
77.9k
          if (valobj.GetCompilerType().IsBlockPointerType()) {
1270
12
            return formatter_sp;
1271
12
          }
1272
77.9k
          return nullptr;
1273
77.9k
        });
1274
627
  });
1275
1276
627
  return g_formatters;
1277
627
}
1278
1279
HardcodedFormatters::HardcodedSyntheticFinder
1280
627
CPlusPlusLanguage::GetHardcodedSynthetics() {
1281
627
  static llvm::once_flag g_initialize;
1282
627
  static ConstString g_vectortypes("VectorTypes");
1283
627
  static HardcodedFormatters::HardcodedSyntheticFinder g_formatters;
1284
1285
627
  llvm::call_once(g_initialize, []() -> void {
1286
627
    g_formatters.push_back([](lldb_private::ValueObject &valobj,
1287
627
                              lldb::DynamicValueType, FormatManager &fmt_mgr)
1288
83.0k
                               -> SyntheticChildren::SharedPointer {
1289
83.0k
      static CXXSyntheticChildren::SharedPointer formatter_sp(
1290
83.0k
          new CXXSyntheticChildren(
1291
83.0k
              SyntheticChildren::Flags()
1292
83.0k
                  .SetCascades(true)
1293
83.0k
                  .SetSkipPointers(true)
1294
83.0k
                  .SetSkipReferences(true)
1295
83.0k
                  .SetNonCacheable(true),
1296
83.0k
              "vector_type synthetic children",
1297
83.0k
              lldb_private::formatters::VectorTypeSyntheticFrontEndCreator));
1298
83.0k
      if (valobj.GetCompilerType().IsVectorType()) {
1299
891
        if (fmt_mgr.GetCategory(g_vectortypes)->IsEnabled())
1300
891
          return formatter_sp;
1301
891
      }
1302
82.1k
      return nullptr;
1303
83.0k
    });
1304
627
    g_formatters.push_back([](lldb_private::ValueObject &valobj,
1305
627
                              lldb::DynamicValueType, FormatManager &fmt_mgr)
1306
82.1k
                               -> SyntheticChildren::SharedPointer {
1307
82.1k
      static CXXSyntheticChildren::SharedPointer formatter_sp(
1308
82.1k
          new CXXSyntheticChildren(
1309
82.1k
              SyntheticChildren::Flags()
1310
82.1k
                  .SetCascades(true)
1311
82.1k
                  .SetSkipPointers(true)
1312
82.1k
                  .SetSkipReferences(true)
1313
82.1k
                  .SetNonCacheable(true),
1314
82.1k
              "block pointer synthetic children",
1315
82.1k
              lldb_private::formatters::BlockPointerSyntheticFrontEndCreator));
1316
82.1k
      if (valobj.GetCompilerType().IsBlockPointerType()) {
1317
12
        return formatter_sp;
1318
12
      }
1319
82.1k
      return nullptr;
1320
82.1k
    });
1321
627
  });
1322
1323
627
  return g_formatters;
1324
627
}
1325
1326
10.2k
bool CPlusPlusLanguage::IsNilReference(ValueObject &valobj) {
1327
10.2k
  if (!Language::LanguageIsCPlusPlus(valobj.GetObjectRuntimeLanguage()) ||
1328
10.2k
      !valobj.IsPointerType())
1329
9.44k
    return false;
1330
834
  bool canReadValue = true;
1331
834
  bool isZero = valobj.GetValueAsUnsigned(0, &canReadValue) == 0;
1332
834
  return canReadValue && isZero;
1333
10.2k
}
1334
1335
13.1k
bool CPlusPlusLanguage::IsSourceFile(llvm::StringRef file_path) const {
1336
13.1k
  const auto suffixes = {".cpp", ".cxx", ".c++", ".cc",  ".c",
1337
13.1k
                         ".h",   ".hh",  ".hpp", ".hxx", ".h++"};
1338
37.4k
  for (auto suffix : suffixes) {
1339
37.4k
    if (file_path.endswith_insensitive(suffix))
1340
11.8k
      return true;
1341
37.4k
  }
1342
1343
  // Check if we're in a STL path (where the files usually have no extension
1344
  // that we could check for.
1345
1.28k
  return file_path.contains("/usr/include/c++/");
1346
13.1k
}