LLDB mainline
|
Uniform wrapper for access to rich mangling information from different providers. More...
#include <RichManglingContext.h>
Public Member Functions | |
RichManglingContext () | |
~RichManglingContext () | |
bool | FromItaniumName (ConstString mangled) |
Use the ItaniumPartialDemangler to obtain rich mangling information from the given mangled name. | |
bool | FromCxxMethodName (ConstString demangled) |
Use the legacy language parser implementation to obtain rich mangling information from the given demangled name. | |
bool | IsCtorOrDtor () const |
If this symbol describes a constructor or destructor. | |
llvm::StringRef | ParseFunctionBaseName () |
Get the base name of a function. | |
llvm::StringRef | ParseFunctionDeclContextName () |
Get the context name for a function. | |
llvm::StringRef | ParseFullName () |
Get the entire demangled name. | |
Private Types | |
enum | InfoProvider { None , ItaniumPartialDemangler , PluginCxxLanguage } |
Private Member Functions | |
void | ResetCxxMethodParser () |
Clean up memory when using PluginCxxLanguage. | |
void | ResetProvider (InfoProvider new_provider) |
Clean up memory and set a new info provider for this instance. | |
llvm::StringRef | processIPDStrResult (char *ipd_res, size_t res_len) |
Uniform handling of string buffers for ItaniumPartialDemangler. | |
Static Private Member Functions | |
template<class ParserT > | |
static ParserT * | get (llvm::Any parser) |
Cast the given parser to the given type. | |
Private Attributes | |
InfoProvider | m_provider = None |
Selects the rich mangling info provider. | |
llvm::ItaniumPartialDemangler | m_ipd |
Members for ItaniumPartialDemangler. | |
char * | m_ipd_buf |
Note: m_ipd_buf is a raw pointer due to being resized by realloc via ItaniumPartialDemangler. | |
size_t | m_ipd_buf_size = 2048 |
llvm::Any | m_cxx_method_parser |
Members for PluginCxxLanguage Cannot forward declare inner class CPlusPlusLanguage::MethodName. | |
Uniform wrapper for access to rich mangling information from different providers.
See Mangled::DemangleWithRichManglingInfo()
Definition at line 25 of file RichManglingContext.h.
|
private |
Enumerator | |
---|---|
None | |
ItaniumPartialDemangler | |
PluginCxxLanguage |
Definition at line 57 of file RichManglingContext.h.
|
inline |
Definition at line 27 of file RichManglingContext.h.
References m_ipd_buf, and m_ipd_buf_size.
RichManglingContext::~RichManglingContext | ( | ) |
Definition at line 19 of file RichManglingContext.cpp.
References m_ipd_buf, and ResetCxxMethodParser().
bool RichManglingContext::FromCxxMethodName | ( | ConstString | demangled | ) |
Use the legacy language parser implementation to obtain rich mangling information from the given demangled name.
Definition at line 60 of file RichManglingContext.cpp.
References m_cxx_method_parser, PluginCxxLanguage, and ResetProvider().
Referenced by lldb_private::Mangled::GetRichManglingInfo().
bool RichManglingContext::FromItaniumName | ( | ConstString | mangled | ) |
Use the ItaniumPartialDemangler to obtain rich mangling information from the given mangled name.
Definition at line 41 of file RichManglingContext.cpp.
References lldb_private::Demangle, lldb_private::ConstString::GetCString(), lldb_private::GetLog(), ItaniumPartialDemangler, LLDB_LOG, m_ipd, m_ipd_buf, ParseFullName(), and ResetProvider().
Referenced by lldb_private::Mangled::GetRichManglingInfo().
|
inlinestaticprivate |
Cast the given parser to the given type.
Ideally we would have a type trait to deduce ParserT from a given InfoProvider, but unfortunately we can't access CPlusPlusLanguage::MethodName from within the header.
Definition at line 88 of file RichManglingContext.h.
bool RichManglingContext::IsCtorOrDtor | ( | ) | const |
If this symbol describes a constructor or destructor.
Definition at line 66 of file RichManglingContext.cpp.
References ItaniumPartialDemangler, m_cxx_method_parser, m_ipd, m_provider, None, and PluginCxxLanguage.
Referenced by lldb_private::Symtab::RegisterMangledNameEntry().
llvm::StringRef RichManglingContext::ParseFullName | ( | ) |
Get the entire demangled name.
Definition at line 146 of file RichManglingContext.cpp.
References ItaniumPartialDemangler, m_cxx_method_parser, m_ipd, m_ipd_buf, m_ipd_buf_size, m_provider, None, PluginCxxLanguage, and processIPDStrResult().
Referenced by FromItaniumName().
llvm::StringRef RichManglingContext::ParseFunctionBaseName | ( | ) |
Get the base name of a function.
This doesn't include trailing template arguments, ie "a::b<int>" gives "b".
Definition at line 112 of file RichManglingContext.cpp.
References ItaniumPartialDemangler, m_cxx_method_parser, m_ipd, m_ipd_buf, m_ipd_buf_size, m_provider, None, PluginCxxLanguage, and processIPDStrResult().
Referenced by lldb_private::Symtab::RegisterMangledNameEntry().
llvm::StringRef RichManglingContext::ParseFunctionDeclContextName | ( | ) |
Get the context name for a function.
For "a::b::c", this function returns "a::b".
Definition at line 129 of file RichManglingContext.cpp.
References ItaniumPartialDemangler, m_cxx_method_parser, m_ipd, m_ipd_buf, m_ipd_buf_size, m_provider, None, PluginCxxLanguage, and processIPDStrResult().
Referenced by lldb_private::Symtab::RegisterMangledNameEntry().
|
private |
Uniform handling of string buffers for ItaniumPartialDemangler.
Definition at line 83 of file RichManglingContext.cpp.
References lldb_private::Demangle, lldb_private::GetLog(), LLDB_LOG, m_ipd_buf, and m_ipd_buf_size.
Referenced by ParseFullName(), ParseFunctionBaseName(), and ParseFunctionDeclContextName().
|
private |
Clean up memory when using PluginCxxLanguage.
Definition at line 24 of file RichManglingContext.cpp.
References m_cxx_method_parser, m_provider, and PluginCxxLanguage.
Referenced by ResetProvider(), and ~RichManglingContext().
|
private |
Clean up memory and set a new info provider for this instance.
Definition at line 34 of file RichManglingContext.cpp.
References m_provider, None, and ResetCxxMethodParser().
Referenced by FromCxxMethodName(), and FromItaniumName().
|
private |
Members for PluginCxxLanguage Cannot forward declare inner class CPlusPlusLanguage::MethodName.
The respective header is in Plugins and including it from here causes cyclic dependency. Instead keep a llvm::Any and cast it on-access in the cpp.
Definition at line 74 of file RichManglingContext.h.
Referenced by FromCxxMethodName(), IsCtorOrDtor(), ParseFullName(), ParseFunctionBaseName(), ParseFunctionDeclContextName(), and ResetCxxMethodParser().
|
private |
Members for ItaniumPartialDemangler.
Definition at line 63 of file RichManglingContext.h.
Referenced by FromItaniumName(), IsCtorOrDtor(), ParseFullName(), ParseFunctionBaseName(), and ParseFunctionDeclContextName().
|
private |
Note: m_ipd_buf is a raw pointer due to being resized by realloc via ItaniumPartialDemangler.
It should be managed with malloc/free, not new/delete.
Definition at line 67 of file RichManglingContext.h.
Referenced by FromItaniumName(), ParseFullName(), ParseFunctionBaseName(), ParseFunctionDeclContextName(), processIPDStrResult(), RichManglingContext(), and ~RichManglingContext().
|
private |
Definition at line 68 of file RichManglingContext.h.
Referenced by ParseFullName(), ParseFunctionBaseName(), ParseFunctionDeclContextName(), processIPDStrResult(), and RichManglingContext().
|
private |
Selects the rich mangling info provider.
Definition at line 60 of file RichManglingContext.h.
Referenced by IsCtorOrDtor(), ParseFullName(), ParseFunctionBaseName(), ParseFunctionDeclContextName(), ResetCxxMethodParser(), and ResetProvider().