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...
 
llvm::StringRef ParseFunctionBaseName ()
 Get the base name of a function. More...
 
llvm::StringRef ParseFunctionDeclContextName ()
 Get the context name for a function. More...
 
llvm::StringRef ParseFullName ()
 Get the entire demangled name. 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...
 
llvm::StringRef 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::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 57 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 19 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 60 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 41 of file RichManglingContext.cpp.

References lldb_private::ConstString::GetCString(), lldb_private::GetLog(), 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 88 of file RichManglingContext.h.

◆ IsCtorOrDtor()

bool RichManglingContext::IsCtorOrDtor ( ) const

If this symbol describes a constructor or destructor.

Definition at line 66 of file RichManglingContext.cpp.

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

◆ ParseFullName()

llvm::StringRef RichManglingContext::ParseFullName ( )

Get the entire demangled name.

Definition at line 146 of file RichManglingContext.cpp.

◆ 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.

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

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::GetLog(), and LLDB_LOG.

◆ ResetCxxMethodParser()

void RichManglingContext::ResetCxxMethodParser ( )
private

Clean up memory when using PluginCxxLanguage.

Definition at line 24 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 34 of file RichManglingContext.cpp.

Member Data Documentation

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

◆ m_ipd

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

Members for ItaniumPartialDemangler.

Definition at line 63 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 67 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 68 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 60 of file RichManglingContext.h.


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