LLDB mainline
lldb_private::RichManglingContext Class Reference

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.

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
std::unique_ptr< Language::MethodNamem_cxx_method_parser

Detailed Description

Uniform wrapper for access to rich mangling information from different providers.

See Mangled::DemangleWithRichManglingInfo()

Definition at line 26 of file RichManglingContext.h.

Member Enumeration Documentation

◆ InfoProvider

Enumerator
None 
ItaniumPartialDemangler 
PluginCxxLanguage 

Definition at line 58 of file RichManglingContext.h.

Constructor & Destructor Documentation

◆ RichManglingContext()

lldb_private::RichManglingContext::RichManglingContext ( )
inline

Definition at line 28 of file RichManglingContext.h.

References m_ipd_buf, and m_ipd_buf_size.

◆ ~RichManglingContext()

RichManglingContext::~RichManglingContext ( )

Definition at line 18 of file RichManglingContext.cpp.

References m_ipd_buf, and ResetCxxMethodParser().

Member Function Documentation

◆ FromCxxMethodName()

bool RichManglingContext::FromCxxMethodName ( ConstString demangled)

Use the legacy language parser implementation to obtain rich mangling information from the given demangled name.

Definition at line 58 of file RichManglingContext.cpp.

References lldb::eLanguageTypeC_plus_plus, lldb_private::Language::FindPlugin(), m_cxx_method_parser, PluginCxxLanguage, and ResetProvider().

Referenced by lldb_private::Mangled::GetRichManglingInfo().

◆ FromItaniumName()

bool RichManglingContext::FromItaniumName ( ConstString mangled)

Use the ItaniumPartialDemangler to obtain rich mangling information from the given mangled name.

Definition at line 39 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().

◆ IsCtorOrDtor()

bool RichManglingContext::IsCtorOrDtor ( ) const

If this symbol describes a constructor or destructor.

Definition at line 67 of file RichManglingContext.cpp.

References ItaniumPartialDemangler, m_cxx_method_parser, m_ipd, m_provider, None, and PluginCxxLanguage.

Referenced by lldb_private::Symtab::RegisterMangledNameEntry().

◆ ParseFullName()

llvm::StringRef RichManglingContext::ParseFullName ( )

Get the entire demangled name.

Definition at line 144 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().

◆ ParseFunctionBaseName()

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().

◆ ParseFunctionDeclContextName()

llvm::StringRef RichManglingContext::ParseFunctionDeclContextName ( )

Get the context name for a function.

For "a::b::c", this function returns "a::b".

Definition at line 128 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().

◆ processIPDStrResult()

llvm::StringRef RichManglingContext::processIPDStrResult ( char * ipd_res,
size_t res_len )
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().

◆ ResetCxxMethodParser()

void RichManglingContext::ResetCxxMethodParser ( )
private

Clean up memory when using PluginCxxLanguage.

Definition at line 23 of file RichManglingContext.cpp.

References m_cxx_method_parser, m_provider, and PluginCxxLanguage.

Referenced by ResetProvider(), and ~RichManglingContext().

◆ ResetProvider()

void RichManglingContext::ResetProvider ( InfoProvider new_provider)
private

Clean up memory and set a new info provider for this instance.

Definition at line 32 of file RichManglingContext.cpp.

References m_provider, None, and ResetCxxMethodParser().

Referenced by FromCxxMethodName(), and FromItaniumName().

Member Data Documentation

◆ m_cxx_method_parser

std::unique_ptr<Language::MethodName> lldb_private::RichManglingContext::m_cxx_method_parser
private

◆ m_ipd

llvm::ItaniumPartialDemangler lldb_private::RichManglingContext::m_ipd
private

Members for ItaniumPartialDemangler.

Definition at line 64 of file RichManglingContext.h.

Referenced by FromItaniumName(), IsCtorOrDtor(), ParseFullName(), ParseFunctionBaseName(), and ParseFunctionDeclContextName().

◆ m_ipd_buf

char* lldb_private::RichManglingContext::m_ipd_buf
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 68 of file RichManglingContext.h.

Referenced by FromItaniumName(), ParseFullName(), ParseFunctionBaseName(), ParseFunctionDeclContextName(), processIPDStrResult(), RichManglingContext(), and ~RichManglingContext().

◆ m_ipd_buf_size

size_t lldb_private::RichManglingContext::m_ipd_buf_size = 2048
private

◆ m_provider

InfoProvider lldb_private::RichManglingContext::m_provider = None
private

Selects the rich mangling info provider.

Definition at line 61 of file RichManglingContext.h.

Referenced by IsCtorOrDtor(), ParseFullName(), ParseFunctionBaseName(), ParseFunctionDeclContextName(), ResetCxxMethodParser(), and ResetProvider().


The documentation for this class was generated from the following files: