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

StringPoolRef StringPool::GetSystemPool ( )
static

The system pool. Only valid between Initialize and Terminate.

Definition at line 128 of file StringPool.cpp.

References g_system_pool.

Referenced by lldb::SBEnvironment::Get(), lldb::SBProcessInfo::GetArg0(), lldb::SBLaunchInfo::GetArgumentAtIndex(), lldb::SBProcessInfo::GetArgumentAtIndex(), lldb::SBCommandInterpreter::GetArgumentDescriptionAsCString(), lldb::SBFunction::GetArgumentName(), lldb::SBCommandInterpreter::GetArgumentTypeAsCString(), lldb::SBFunction::GetBaseName(), lldb::SBSymbol::GetBaseName(), lldb::SBCommandInterpreter::GetBroadcasterClass(), lldb::SBCommunication::GetBroadcasterClass(), lldb::SBDebugger::GetBroadcasterClass(), lldb::SBEvent::GetBroadcasterClass(), lldb::SBProcess::GetBroadcasterClass(), lldb::SBProcess::GetBroadcasterClassName(), lldb::SBTarget::GetBroadcasterClassName(), lldb::SBThread::GetBroadcasterClassName(), lldb::SBLanguageRuntime::GetCatchKeywordForLanguage(), lldb::SBPlatformShellCommand::GetCommand(), lldb::SBInstruction::GetComment(), lldb::SBProtocolServer::GetConnectionURI(), lldb::SBEvent::GetCStringFromEvent(), lldb::SBStream::GetData(), lldb::SBTypeSummary::GetData(), lldb::SBTypeSynthetic::GetData(), lldb::SBEvent::GetDataFlavor(), lldb::SBTypeMemberFunction::GetDemangledName(), lldb::SBFileSpec::GetDirectory(), lldb::SBFunction::GetDisplayName(), lldb::SBSymbol::GetDisplayName(), lldb::SBType::GetDisplayTypeName(), lldb::SBValue::GetDisplayTypeName(), lldb::SBLaunchInfo::GetEnvironmentEntryAtIndex(), lldb::SBTraceCursor::GetError(), lldb::SBTraceCursor::GetEventTypeAsString(), lldb::SBTypeFilter::GetExpressionPathAtIndex(), lldb::SBFileSpec::GetFilename(), lldb::SBPlatform::GetHostname(), lldb::SBBlock::GetInlinedName(), lldb::SBLaunchInfo::GetLaunchEventData(), lldb::SBPlatformConnectOptions::GetLocalCacheDirectory(), lldb::SBValue::GetLocation(), lldb::SBFunction::GetMangledName(), lldb::SBSymbol::GetMangledName(), lldb::SBTypeMemberFunction::GetMangledName(), lldb::SBTypeStaticField::GetMangledName(), lldb::SBInstruction::GetMnemonic(), lldb::SBBreakpointName::GetName(), lldb::SBBroadcaster::GetName(), lldb::SBFunction::GetName(), lldb::SBMemoryRegionInfo::GetName(), lldb::SBPlatform::GetName(), lldb::SBProcessInfo::GetName(), lldb::SBSection::GetName(), lldb::SBSymbol::GetName(), lldb::SBType::GetName(), lldb::SBTypeCategory::GetName(), lldb::SBTypeEnumMember::GetName(), lldb::SBTypeMember::GetName(), lldb::SBTypeMemberFunction::GetName(), lldb::SBTypeNameSpecifier::GetName(), lldb::SBTypeStaticField::GetName(), lldb::SBValue::GetName(), lldb_private::QueueImpl::GetName(), lldb::SBEnvironment::GetNameAtIndex(), lldb::SBValue::GetObjectDescription(), lldb::SBModule::GetObjectName(), lldb::SBModuleSpec::GetObjectName(), lldb::SBInstruction::GetOperands(), lldb::SBPlatform::GetOSBuild(), lldb::SBPlatform::GetOSDescription(), lldb::SBPlatformShellCommand::GetOutput(), lldb::SBProcess::GetPluginName(), lldb::SBSaveCoreOptions::GetPluginName(), lldb::SBExpressionOptions::GetPrefix(), lldb::SBAttachInfo::GetProcessPluginName(), lldb::SBLaunchInfo::GetProcessPluginName(), lldb::SBDebugger::GetProgressFromEvent(), lldb::SBProcess::GetRestartedReasonAtIndexFromEvent(), lldb::SBAttachInfo::GetScriptedProcessClassName(), lldb::SBLaunchInfo::GetScriptedProcessClassName(), lldb::SBLaunchInfo::GetShell(), lldb::SBPlatformShellCommand::GetShell(), lldb::SBUnixSignals::GetSignalAsCString(), lldb::SBTrace::GetStartConfigurationHelp(), lldb::SBData::GetString(), lldb::SBStringList::GetStringAtIndex(), lldb::SBStringList::GetStringAtIndex(), lldb::SBValue::GetSummary(), lldb::SBValue::GetSummary(), lldb::SBLanguageRuntime::GetThrowKeywordForLanguage(), lldb::SBModule::GetTriple(), lldb::SBModuleSpec::GetTriple(), lldb::SBPlatform::GetTriple(), lldb::SBProcessInfo::GetTriple(), lldb::SBTypeFormat::GetTypeName(), lldb::SBValue::GetTypeName(), lldb::SBPlatformConnectOptions::GetURL(), lldb::SBModule::GetUUIDString(), lldb::SBValue::GetValue(), lldb::SBEnvironment::GetValueAtIndex(), lldb::SBLaunchInfo::GetWorkingDirectory(), lldb::SBPlatform::GetWorkingDirectory(), and lldb::SBPlatformShellCommand::GetWorkingDirectory().

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