LLDB mainline
RichManglingContext.h
Go to the documentation of this file.
1//===-- RichManglingContext.h -----------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_CORE_RICHMANGLINGCONTEXT_H
10#define LLDB_CORE_RICHMANGLINGCONTEXT_H
11
12#include "lldb/lldb-forward.h"
13#include "lldb/lldb-private.h"
14
17
18#include "llvm/ADT/Any.h"
19#include "llvm/ADT/SmallString.h"
20#include "llvm/Demangle/Demangle.h"
21
22namespace lldb_private {
23
24/// Uniform wrapper for access to rich mangling information from different
25/// providers. See Mangled::DemangleWithRichManglingInfo()
27public:
29 m_ipd_buf = static_cast<char *>(std::malloc(m_ipd_buf_size));
30 m_ipd_buf[0] = '\0';
31 }
32
34
35 /// Use the ItaniumPartialDemangler to obtain rich mangling information from
36 /// the given mangled name.
37 bool FromItaniumName(ConstString mangled);
38
39 /// Use the legacy language parser implementation to obtain rich mangling
40 /// information from the given demangled name.
41 bool FromCxxMethodName(ConstString demangled);
42
43 /// If this symbol describes a constructor or destructor.
44 bool IsCtorOrDtor() const;
45
46 /// Get the base name of a function. This doesn't include trailing template
47 /// arguments, ie "a::b<int>" gives "b".
48 llvm::StringRef ParseFunctionBaseName();
49
50 /// Get the context name for a function. For "a::b::c", this function returns
51 /// "a::b".
52 llvm::StringRef ParseFunctionDeclContextName();
53
54 /// Get the entire demangled name.
55 llvm::StringRef ParseFullName();
56
57private:
59
60 /// Selects the rich mangling info provider.
62
63 /// Members for ItaniumPartialDemangler
64 llvm::ItaniumPartialDemangler m_ipd;
65 /// Note: m_ipd_buf is a raw pointer due to being resized by realloc via
66 /// ItaniumPartialDemangler. It should be managed with malloc/free, not
67 /// new/delete.
68 char *m_ipd_buf;
69 size_t m_ipd_buf_size = 2048;
70
71 std::unique_ptr<Language::MethodName> m_cxx_method_parser;
72
73 /// Clean up memory when using PluginCxxLanguage
75
76 /// Clean up memory and set a new info provider for this instance.
77 void ResetProvider(InfoProvider new_provider);
78
79 /// Uniform handling of string buffers for ItaniumPartialDemangler.
80 llvm::StringRef processIPDStrResult(char *ipd_res, size_t res_len);
81};
82
83} // namespace lldb_private
84
85#endif
A uniqued constant string class.
Definition ConstString.h:40
llvm::StringRef ParseFunctionDeclContextName()
Get the context name for a function.
llvm::StringRef ParseFunctionBaseName()
Get the base name of a function.
void ResetProvider(InfoProvider new_provider)
Clean up memory and set a new info provider for this instance.
bool FromItaniumName(ConstString mangled)
Use the ItaniumPartialDemangler to obtain rich mangling information from the given mangled name.
char * m_ipd_buf
Note: m_ipd_buf is a raw pointer due to being resized by realloc via ItaniumPartialDemangler.
llvm::StringRef processIPDStrResult(char *ipd_res, size_t res_len)
Uniform handling of string buffers for ItaniumPartialDemangler.
std::unique_ptr< Language::MethodName > m_cxx_method_parser
bool FromCxxMethodName(ConstString demangled)
Use the legacy language parser implementation to obtain rich mangling information from the given dema...
void ResetCxxMethodParser()
Clean up memory when using PluginCxxLanguage.
InfoProvider m_provider
Selects the rich mangling info provider.
llvm::StringRef ParseFullName()
Get the entire demangled name.
llvm::ItaniumPartialDemangler m_ipd
Members for ItaniumPartialDemangler.
bool IsCtorOrDtor() const
If this symbol describes a constructor or destructor.
A class that represents a running process on the host machine.