LLDB  mainline
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
lldb_private::RichManglingContext Class Reference

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

#include <RichManglingContext.h>

Collaboration diagram for lldb_private::RichManglingContext:
Collaboration graph
[legend]

Public Member Functions

 RichManglingContext ()
 
 ~RichManglingContext ()
 
bool FromItaniumName (ConstString mangled)
 Use the ItaniumPartialDemangler to obtain rich mangling information from the given mangled name. More...
 
bool FromCxxMethodName (ConstString demangled)
 Use the legacy language parser implementation to obtain rich mangling information from the given demangled name. More...
 
bool IsCtorOrDtor () const
 If this symbol describes a constructor or destructor. More...
 
void ParseFunctionBaseName ()
 Get the base name of a function. More...
 
void ParseFunctionDeclContextName ()
 Get the context name for a function. More...
 
void ParseFullName ()
 Get the entire demangled name. More...
 
llvm::StringRef GetBufferRef () const
 Obtain a StringRef to the internal buffer that holds the result of the most recent ParseXy() operation. More...
 

Private Types

enum  InfoProvider { None, ItaniumPartialDemangler, PluginCxxLanguage }
 

Private Member Functions

void ResetCxxMethodParser ()
 Clean up memory when using PluginCxxLanguage. More...
 
void ResetProvider (InfoProvider new_provider)
 Clean up memory and set a new info provider for this instance. More...
 
void processIPDStrResult (char *ipd_res, size_t res_len)
 Uniform handling of string buffers for ItaniumPartialDemangler. More...
 

Static Private Member Functions

template<class ParserT >
static ParserT * get (llvm::Any parser)
 Cast the given parser to the given type. More...
 

Private Attributes

InfoProvider m_provider = None
 Selects the rich mangling info provider. More...
 
llvm::StringRef m_buffer
 Reference to the buffer used for results of ParseXy() operations. More...
 
llvm::ItaniumPartialDemangler m_ipd
 Members for ItaniumPartialDemangler. More...
 
char * m_ipd_buf
 Note: m_ipd_buf is a raw pointer due to being resized by realloc via ItaniumPartialDemangler. More...
 
size_t m_ipd_buf_size = 2048
 
llvm::Any m_cxx_method_parser
 Members for PluginCxxLanguage Cannot forward declare inner class CPlusPlusLanguage::MethodName. More...
 

Detailed Description

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

See Mangled::DemangleWithRichManglingInfo()

Definition at line 25 of file RichManglingContext.h.

Member Enumeration Documentation

◆ InfoProvider

Enumerator
None 
ItaniumPartialDemangler 
PluginCxxLanguage 

Definition at line 67 of file RichManglingContext.h.

Constructor & Destructor Documentation

◆ RichManglingContext()

lldb_private::RichManglingContext::RichManglingContext ( )
inline

Definition at line 27 of file RichManglingContext.h.

References m_ipd_buf, and m_ipd_buf_size.

◆ ~RichManglingContext()

RichManglingContext::~RichManglingContext ( )

Definition at line 22 of file RichManglingContext.cpp.

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 63 of file RichManglingContext.cpp.

◆ FromItaniumName()

bool RichManglingContext::FromItaniumName ( ConstString  mangled)

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

Definition at line 44 of file RichManglingContext.cpp.

References lldb_private::ConstString::GetCString(), lldb_private::GetLogIfAllCategoriesSet(), LIBLLDB_LOG_DEMANGLE, and LLDB_LOG.

◆ get()

template<class ParserT >
static ParserT* lldb_private::RichManglingContext::get ( llvm::Any  parser)
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 101 of file RichManglingContext.h.

◆ GetBufferRef()

llvm::StringRef lldb_private::RichManglingContext::GetBufferRef ( ) const
inline

Obtain a StringRef to the internal buffer that holds the result of the most recent ParseXy() operation.

The next ParseXy() call invalidates it.

Definition at line 61 of file RichManglingContext.h.

References m_buffer, m_provider, and None.

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

◆ IsCtorOrDtor()

bool RichManglingContext::IsCtorOrDtor ( ) const

If this symbol describes a constructor or destructor.

Definition at line 69 of file RichManglingContext.cpp.

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

◆ ParseFullName()

void RichManglingContext::ParseFullName ( )

Get the entire demangled name.

The result will overwrite the internal buffer. It can be obtained via GetBufferRef().

Definition at line 151 of file RichManglingContext.cpp.

◆ ParseFunctionBaseName()

void RichManglingContext::ParseFunctionBaseName ( )

Get the base name of a function.

This doesn't include trailing template arguments, ie "a::b<int>" gives "b". The result will overwrite the internal buffer. It can be obtained via GetBufferRef().

Definition at line 115 of file RichManglingContext.cpp.

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

◆ ParseFunctionDeclContextName()

void RichManglingContext::ParseFunctionDeclContextName ( )

Get the context name for a function.

For "a::b::c", this function returns "a::b". The result will overwrite the internal buffer. It can be obtained via GetBufferRef().

Definition at line 133 of file RichManglingContext.cpp.

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

◆ processIPDStrResult()

void RichManglingContext::processIPDStrResult ( char *  ipd_res,
size_t  res_len 
)
private

Uniform handling of string buffers for ItaniumPartialDemangler.

Definition at line 86 of file RichManglingContext.cpp.

References lldb_private::GetLogIfAllCategoriesSet(), LIBLLDB_LOG_DEMANGLE, and LLDB_LOG.

◆ ResetCxxMethodParser()

void RichManglingContext::ResetCxxMethodParser ( )
private

Clean up memory when using PluginCxxLanguage.

Definition at line 27 of file RichManglingContext.cpp.

◆ ResetProvider()

void RichManglingContext::ResetProvider ( InfoProvider  new_provider)
private

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

Definition at line 37 of file RichManglingContext.cpp.

Member Data Documentation

◆ m_buffer

llvm::StringRef lldb_private::RichManglingContext::m_buffer
private

Reference to the buffer used for results of ParseXy() operations.

Definition at line 73 of file RichManglingContext.h.

Referenced by GetBufferRef().

◆ m_cxx_method_parser

llvm::Any lldb_private::RichManglingContext::m_cxx_method_parser
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 87 of file RichManglingContext.h.

◆ m_ipd

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

Members for ItaniumPartialDemangler.

Definition at line 76 of file RichManglingContext.h.

◆ 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 80 of file RichManglingContext.h.

Referenced by RichManglingContext().

◆ m_ipd_buf_size

size_t lldb_private::RichManglingContext::m_ipd_buf_size = 2048
private

Definition at line 81 of file RichManglingContext.h.

Referenced by RichManglingContext().

◆ m_provider

InfoProvider lldb_private::RichManglingContext::m_provider = None
private

Selects the rich mangling info provider.

Definition at line 70 of file RichManglingContext.h.

Referenced by GetBufferRef().


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