LLDB mainline
lldb_private::StringPool Class Reference

A thread-safe pool of interned, null-terminated strings. More...

#include <StringPool.h>

Classes

struct  PoolEntry

Public Member Functions

 StringPool ()
 ~StringPool ()
 StringPool (const StringPool &)=delete
StringPool & operator= (const StringPool &)=delete
const char * Intern (llvm::StringRef str)
 Returns the pooled copy of str, or nullptr if str has no data.
const char * GetConstCString (const char *cstr)
const char * GetConstCStringWithLength (const char *cstr, size_t cstr_len)
const char * GetConstTrimmedCStringWithLength (const char *cstr, size_t cstr_len)
const char * GetConstCStringAndSetMangledCounterPart (llvm::StringRef demangled, llvm::StringRef mangled)
 Interns demangled and links it with the already interned mangled.
const char * GetMangledCounterpart (llvm::StringRef str)
ConstString::MemoryStats GetMemoryStats () const

Static Public Member Functions

static StringPool & GetGlobal ()
 The pool backing ConstString. It is never destroyed.
static void Initialize ()
 Set up and tear down the system pool, for strings that are not owned by a Debugger.
static void Terminate ()
static StringPoolRef GetSystemPool ()
 The system pool. Only valid between Initialize and Terminate.
static size_t GetConstCStringLength (const char *ccstr)
 Length of a string returned by any pool.

Private Member Functions

PoolEntry & selectPool (uint32_t hash)
PoolEntry & selectPool (llvm::StringRef str)

Private Attributes

std::unique_ptr< PoolEntry[]> m_string_pools

Detailed Description

A thread-safe pool of interned, null-terminated strings.

A string returned by a pool stays valid for the lifetime of that pool.

Definition at line 25 of file StringPool.h.

Constructor & Destructor Documentation

◆ StringPool() [1/2]

StringPool::StringPool ( )

Definition at line 97 of file StringPool.cpp.

References m_string_pools.

Referenced by GetGlobal(), operator=(), and StringPool().

◆ ~StringPool()

StringPool::~StringPool ( )
default

◆ StringPool() [2/2]

lldb_private::StringPool::StringPool ( const StringPool & )
delete

References StringPool().

Member Function Documentation

◆ GetConstCString()

const char * StringPool::GetConstCString ( const char * cstr)

Definition at line 161 of file StringPool.cpp.

References GetConstCStringWithLength().

Referenced by lldb_private::ConstString::SetCString().

◆ GetConstCStringAndSetMangledCounterPart()

const char * StringPool::GetConstCStringAndSetMangledCounterPart ( llvm::StringRef demangled,
llvm::StringRef mangled )

◆ GetConstCStringLength()

size_t StringPool::GetConstCStringLength ( const char * ccstr)
static

Length of a string returned by any pool.

Definition at line 141 of file StringPool.cpp.

Referenced by lldb_private::ConstString::GetLength().

◆ GetConstCStringWithLength()

const char * StringPool::GetConstCStringWithLength ( const char * cstr,
size_t cstr_len )

◆ GetConstTrimmedCStringWithLength()

const char * StringPool::GetConstTrimmedCStringWithLength ( const char * cstr,
size_t cstr_len )

◆ GetGlobal()

◆ GetMangledCounterpart()

const char * StringPool::GetMangledCounterpart ( llvm::StringRef str)

◆ GetMemoryStats()

◆ GetSystemPool()

◆ Initialize()

void StringPool::Initialize ( )
static

Set up and tear down the system pool, for strings that are not owned by a Debugger.

Definition at line 121 of file StringPool.cpp.

References g_system_pool, and GetGlobal().

Referenced by lldb_private::SystemInitializerCommon::Initialize().

◆ Intern()

const char * StringPool::Intern ( llvm::StringRef str)

◆ operator=()

StringPool & lldb_private::StringPool::operator= ( const StringPool & )
delete

References StringPool().

◆ selectPool() [1/2]

StringPool::PoolEntry & StringPool::selectPool ( llvm::StringRef str)
private

Definition at line 137 of file StringPool.cpp.

References selectPool().

◆ selectPool() [2/2]

StringPool::PoolEntry & StringPool::selectPool ( uint32_t hash)
private

◆ Terminate()

void StringPool::Terminate ( )
static

Definition at line 126 of file StringPool.cpp.

References g_system_pool.

Referenced by lldb_private::SystemInitializerCommon::Terminate().

Member Data Documentation

◆ m_string_pools

std::unique_ptr<PoolEntry[]> lldb_private::StringPool::m_string_pools
private

Definition at line 68 of file StringPool.h.

Referenced by GetMemoryStats(), selectPool(), and StringPool().


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