|
LLDB mainline
|
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 |
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.
| StringPool::StringPool | ( | ) |
Definition at line 97 of file StringPool.cpp.
References m_string_pools.
Referenced by GetGlobal(), operator=(), and StringPool().
|
default |
|
delete |
References StringPool().
| const char * StringPool::GetConstCString | ( | const char * | cstr | ) |
Definition at line 161 of file StringPool.cpp.
References GetConstCStringWithLength().
Referenced by lldb_private::ConstString::SetCString().
| const char * StringPool::GetConstCStringAndSetMangledCounterPart | ( | llvm::StringRef | demangled, |
| llvm::StringRef | mangled ) |
Interns demangled and links it with the already interned mangled.
Definition at line 198 of file StringPool.cpp.
References lldb_private::StringPool::PoolEntry::m_mutex, lldb_private::StringPool::PoolEntry::m_string_map, selectPool(), and lldb_private::StringPool::PoolEntry::used_bytes.
Referenced by lldb_private::ConstString::SetStringWithMangledCounterpart().
|
static |
Length of a string returned by any pool.
Definition at line 141 of file StringPool.cpp.
Referenced by lldb_private::ConstString::GetLength().
| const char * StringPool::GetConstCStringWithLength | ( | const char * | cstr, |
| size_t | cstr_len ) |
Definition at line 167 of file StringPool.cpp.
References Intern().
Referenced by GetConstCString(), GetConstTrimmedCStringWithLength(), and lldb_private::ConstString::SetCStringWithLength().
| const char * StringPool::GetConstTrimmedCStringWithLength | ( | const char * | cstr, |
| size_t | cstr_len ) |
Definition at line 233 of file StringPool.cpp.
References GetConstCStringWithLength().
Referenced by lldb_private::ConstString::SetTrimmedCStringWithLength().
|
static |
The pool backing ConstString. It is never destroyed.
Definition at line 109 of file StringPool.cpp.
References StringPool().
Referenced by lldb_private::ConstString::GetMangledCounterpart(), lldb_private::ConstString::GetMemoryStats(), Initialize(), lldb_private::ConstString::SetCString(), lldb_private::ConstString::SetCStringWithLength(), lldb_private::ConstString::SetString(), lldb_private::ConstString::SetStringWithMangledCounterpart(), and lldb_private::ConstString::SetTrimmedCStringWithLength().
| const char * StringPool::GetMangledCounterpart | ( | llvm::StringRef | str | ) |
Definition at line 151 of file StringPool.cpp.
References lldb_private::StringPool::PoolEntry::m_mutex, and selectPool().
Referenced by lldb_private::ConstString::GetMangledCounterpart().
| ConstString::MemoryStats StringPool::GetMemoryStats | ( | ) | const |
Definition at line 242 of file StringPool.cpp.
References lldb_private::ConstString::MemoryStats::bytes_total, lldb_private::ConstString::MemoryStats::bytes_used, lldb_private::StringPool::PoolEntry::m_mutex, lldb_private::StringPool::PoolEntry::m_string_map, m_string_pools, and lldb_private::StringPool::PoolEntry::used_bytes.
Referenced by lldb_private::ConstString::GetMemoryStats().
|
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::SBLanguageRuntime::GetCatchKeywordForLanguage(), lldb::SBPlatformShellCommand::GetCommand(), lldb::SBFileSpec::GetDirectory(), lldb::SBLaunchInfo::GetEnvironmentEntryAtIndex(), lldb::SBFileSpec::GetFilename(), lldb::SBPlatform::GetHostname(), lldb::SBLaunchInfo::GetLaunchEventData(), lldb::SBBroadcaster::GetName(), lldb::SBPlatform::GetName(), lldb::SBProcessInfo::GetName(), lldb::SBEnvironment::GetNameAtIndex(), lldb::SBPlatform::GetOSBuild(), lldb::SBPlatform::GetOSDescription(), lldb::SBPlatformShellCommand::GetOutput(), lldb::SBExpressionOptions::GetPrefix(), lldb::SBAttachInfo::GetProcessPluginName(), lldb::SBLaunchInfo::GetProcessPluginName(), lldb::SBPlatformShellCommand::GetShell(), lldb::SBData::GetString(), lldb::SBLanguageRuntime::GetThrowKeywordForLanguage(), lldb::SBPlatform::GetTriple(), lldb::SBProcessInfo::GetTriple(), lldb::SBPlatformConnectOptions::GetURL(), lldb::SBModule::GetUUIDString(), lldb::SBEnvironment::GetValueAtIndex(), lldb::SBLaunchInfo::GetWorkingDirectory(), lldb::SBPlatform::GetWorkingDirectory(), and lldb::SBPlatformShellCommand::GetWorkingDirectory().
|
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().
| const char * StringPool::Intern | ( | llvm::StringRef | str | ) |
Returns the pooled copy of str, or nullptr if str has no data.
Definition at line 174 of file StringPool.cpp.
References lldb_private::StringPool::PoolEntry::m_mutex, lldb_private::StringPool::PoolEntry::m_string_map, selectPool(), and lldb_private::StringPool::PoolEntry::used_bytes.
Referenced by GetConstCStringWithLength(), and lldb_private::ConstString::SetString().
|
delete |
References StringPool().
|
private |
Definition at line 137 of file StringPool.cpp.
References selectPool().
|
private |
Definition at line 133 of file StringPool.cpp.
References m_string_pools.
Referenced by GetConstCStringAndSetMangledCounterPart(), GetMangledCounterpart(), Intern(), and selectPool().
|
static |
Definition at line 126 of file StringPool.cpp.
References g_system_pool.
Referenced by lldb_private::SystemInitializerCommon::Terminate().
|
private |
Definition at line 68 of file StringPool.h.
Referenced by GetMemoryStats(), selectPool(), and StringPool().