LLDB mainline
Classes | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
lldb_private::ConstString Class Reference

A uniqued constant string class. More...

#include "lldb/Utility/ConstString.h"

Classes

struct  MemoryStats
 

Public Member Functions

 ConstString ()=default
 Default constructor.
 
 ConstString (llvm::StringRef s)
 
 ConstString (const char *cstr)
 Construct with C String value.
 
 ConstString (const char *cstr, size_t max_cstr_len)
 Construct with C String value with max length.
 
 operator bool () const
 Convert to bool operator.
 
bool operator== (ConstString rhs) const
 Equal to operator.
 
bool operator== (const char *rhs) const
 Equal to operator against a non-ConstString value.
 
bool operator!= (ConstString rhs) const
 Not equal to operator.
 
bool operator!= (const char *rhs) const
 Not equal to operator against a non-ConstString value.
 
bool operator< (ConstString rhs) const
 
 operator llvm::StringRef () const
 
 operator std::string_view () const
 
 operator std::string () const
 
const char * AsCString (const char *value_if_empty=nullptr) const
 Get the string value as a C string.
 
llvm::StringRef GetStringRef () const
 Get the string value as a llvm::StringRef.
 
std::string GetString () const
 Get the string value as a std::string.
 
const char * GetCString () const
 Get the string value as a C string.
 
size_t GetLength () const
 Get the length in bytes of string value.
 
void Clear ()
 Clear this object's state.
 
void Dump (Stream *s, const char *value_if_empty=nullptr) const
 Dump the object description to a stream.
 
void DumpDebug (Stream *s) const
 Dump the object debug description to a stream.
 
bool IsEmpty () const
 Test for empty string.
 
bool IsNull () const
 Test for null string.
 
void SetCString (const char *cstr)
 Set the C string value.
 
void SetString (llvm::StringRef s)
 
void SetStringWithMangledCounterpart (llvm::StringRef demangled, ConstString mangled)
 Set the C string value and its mangled counterpart.
 
bool GetMangledCounterpart (ConstString &counterpart) const
 Retrieve the mangled or demangled counterpart for a mangled or demangled ConstString.
 
void SetCStringWithLength (const char *cstr, size_t cstr_len)
 Set the C string value with length.
 
void SetTrimmedCStringWithLength (const char *cstr, size_t fixed_cstr_len)
 Set the C string value with the minimum length between fixed_cstr_len and the actual length of the C string.
 
size_t MemorySize () const
 Get the memory cost of this object.
 

Static Public Member Functions

static bool Equals (ConstString lhs, ConstString rhs, const bool case_sensitive=true)
 Equal to operator.
 
static int Compare (ConstString lhs, ConstString rhs, const bool case_sensitive=true)
 Compare two string objects.
 
static MemoryStats GetMemoryStats ()
 

Static Protected Member Functions

static ConstString FromStringPoolPointer (const char *ptr)
 Only used by DenseMapInfo.
 

Protected Attributes

const char * m_string = nullptr
 

Friends

template<typename T , typename Enable >
struct ::llvm::DenseMapInfo
 

Detailed Description

A uniqued constant string class.

Provides an efficient way to store strings as uniqued strings. After the strings are uniqued, finding strings that are equal to one another is very fast as just the pointers need to be compared. It also allows for many common strings from many different sources to be shared to keep the memory footprint low.

No reference counting is done on strings that are added to the string pool, once strings are added they are in the string pool for the life of the program.

Definition at line 40 of file ConstString.h.

Constructor & Destructor Documentation

◆ ConstString() [1/4]

lldb_private::ConstString::ConstString ( )
default

Default constructor.

Initializes the string to an empty string.

Referenced by MemorySize().

◆ ConstString() [2/4]

ConstString::ConstString ( llvm::StringRef  s)
explicit

Definition at line 217 of file ConstString.cpp.

◆ ConstString() [3/4]

ConstString::ConstString ( const char *  cstr)
explicit

Construct with C String value.

Constructs this object with a C string by looking to see if the C string already exists in the global string pool. If it doesn't exist, it is added to the string pool.

Parameters
[in]cstrA NULL terminated C string to add to the string pool.

Definition at line 211 of file ConstString.cpp.

◆ ConstString() [4/4]

ConstString::ConstString ( const char *  cstr,
size_t  max_cstr_len 
)
explicit

Construct with C String value with max length.

Constructs this object with a C string with a length. If max_cstr_len is greater than the actual length of the string, the string length will be truncated. This allows substrings to be created without the need to NULL terminate the string as it is passed into this function.

Parameters
[in]cstrA pointer to the first character in the C string. The C string can be NULL terminated in a buffer that contains more characters than the length of the string, or the string can be part of another string and a new substring can be created.
[in]max_cstr_lenThe max length of cstr. If the string length of cstr is less than max_cstr_len, then the string will be truncated. If the string length of cstr is greater than max_cstr_len, then only max_cstr_len bytes will be used from cstr.

Definition at line 214 of file ConstString.cpp.

Member Function Documentation

◆ AsCString()

const char * lldb_private::ConstString::AsCString ( const char *  value_if_empty = nullptr) const
inline

Get the string value as a C string.

Get the value of the contained string as a NULL terminated C string value.

If value_if_empty is nullptr, then nullptr will be returned.

Returns
Returns value_if_empty if the string is empty, otherwise the C string value contained in this object.

Definition at line 188 of file ConstString.h.

References IsEmpty(), and m_string.

Referenced by lldb_private::ClangExpressionSourceCode::AddLocalVariableDecls(), AddMacros(), lldb_private::ClangExpressionDeclMap::AddOneFunction(), lldb_private::ValueObject::AddressOf(), lldb_private::ValueObjectConstResultImpl::AddressOf(), lldb_private::AppleObjCTrampolineHandler::AppleObjCTrampolineHandler(), lldb_private::Target::ApplyNameToBreakpoints(), ObjectFileELF::ApplyRelocations(), lldb_private::x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(), BuildModulesSection(), lldb_private::IRExecutionUnit::CollectCandidateCNames(), lldb_private::SourceManager::File::CommonInitializer(), lldb_private::ClangFunctionCaller::CompileFunction(), lldb_private::plugin::dwarf::SymbolFileDWARF::CompleteType(), lldb_private::TypeSystemClang::CountDeclLevels(), CreateAllImageInfosPayload(), lldb_private::TypeSystemClang::DeclContextFindDeclByName(), lldb_private::ThreadPlanStepInRange::DefaultShouldStopHereCallback(), lldb_private::Target::DeleteBreakpointName(), EntityResultVariable::Dematerialize(), lldb_private::IRExecutionUnit::DisassembleFunction(), CommandObjectTargetModulesShowUnwind::DoExecute(), lldb_private::ClangExpressionParser::DoPrepareForExecution(), lldb_private::ThreadPlanStepOverRange::DoWillResume(), lldb_private::Mangled::Dump(), Dump(), lldb_private::Address::Dump(), lldb_private::SymbolContext::Dump(), lldb_private::Symbol::Dump(), DumpBasename(), DumpDirectory(), CommandObjectSourceInfo::DumpFileLinesInCompUnit(), CommandObjectSourceInfo::DumpLinesInFunctions(), lldb_private::Section::DumpName(), lldb_private::InlineFunctionInfo::DumpStopContext(), OutputWriterCLI::DumpUntracedContext(), DumpValue(), lldb_private::SymbolContext::FindBestGlobalDataSymbol(), lldb_private::Target::FindBreakpointName(), lldb_private::AppleObjCDeclVendor::FindDecls(), lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(), lldb_private::Module::FindFirstSymbolWithNameAndType(), lldb_private::Module::FindFunctionSymbols(), lldb_private::plugin::dwarf::SymbolFileDWARF::FindNamespace(), SymbolFilePDB::FindNamespace(), lldb_private::ClangASTSource::FindObjCMethodDecls(), lldb_private::FormatEntity::Format(), lldb::SBEnvironment::Get(), lldb_private::ModuleCache::Get(), lldb::SBCommandInterpreter::GetBroadcasterClass(), lldb::SBCommunication::GetBroadcasterClass(), lldb::SBDebugger::GetBroadcasterClass(), lldb::SBProcess::GetBroadcasterClass(), lldb::SBEvent::GetBroadcasterClass(), lldb::SBProcess::GetBroadcasterClassName(), lldb::SBTarget::GetBroadcasterClassName(), lldb::SBThread::GetBroadcasterClassName(), lldb_private::AppleObjCRuntimeV2::GetByteOffsetForIvar(), lldb_private::FormatManager::GetCached(), lldb::SBLanguageRuntime::GetCatchKeywordForLanguage(), lldb_private::TypeSystemClang::GetChildCompilerTypeAtIndex(), lldb_private::AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::GetClassInfoUtilityFunctionImpl(), GetCoffUUID(), lldb_private::PlatformRemoteDarwinDevice::GetConnectedSDKIndex(), lldb_private::TypeFormatImpl_EnumType::GetDescription(), lldb::SBFunction::GetDescription(), lldb::SBProcess::GetDescription(), lldb_private::TypeMemberFunctionImpl::GetDescription(), lldb_private::AddressResolverFileLine::GetDescription(), lldb_private::SearchFilterByModule::GetDescription(), lldb_private::SearchFilterByModuleList::GetDescription(), lldb_private::SearchFilterByModuleListAndCU::GetDescription(), lldb_private::BreakpointLocation::GetDescription(), lldb_private::ThreadPlanStepInRange::GetDescription(), lldb_private::StackFrame::GetDisplayFunctionName(), lldb::SBFunction::GetDisplayName(), lldb::SBSymbol::GetDisplayName(), lldb::SBCommandReturnObject::GetError(), SystemRuntimeMacOSX::GetExtendedBacktraceThread(), lldb_private::DWARFCallFrameInfo::GetFDEIndex(), lldb_private::CPlusPlusLanguage::GetFunctionDisplayName(), lldb_private::StackFrame::GetFunctionName(), lldb::SBCommand::GetHelp(), lldb::SBCommand::GetHelpLong(), lldb_private::formatters::BlockPointerSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::TypeSystemClang::GetIndexOfChildWithName(), lldb::SBBlock::GetInlinedName(), lldb::SBDebugger::GetInstanceName(), lldb::SBTarget::GetLabel(), lldb_private::process_freebsd::NativeProcessFreeBSD::GetLoadedModuleFileSpec(), lldb_private::process_linux::NativeProcessLinux::GetLoadedModuleFileSpec(), lldb_private::process_netbsd::NativeProcessNetBSD::GetLoadedModuleFileSpec(), lldb::SBFunction::GetMangledName(), lldb::SBSymbol::GetMangledName(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(), ObjectFileELF::GetModuleSpecifications(), lldb::SBCommand::GetName(), lldb::SBPlatform::GetName(), lldb::SBFunction::GetName(), lldb::SBSymbol::GetName(), lldb_private::ScriptedThread::GetName(), lldb::SBEnvironment::GetNameAtIndex(), lldb::SBValue::GetObjectDescription(), lldb::SBCommandReturnObject::GetOutput(), lldb_private::FileAction::GetPath(), lldb_private::FormatManager::GetPossibleMatches(), lldb::SBDebugger::GetProgressFromEvent(), lldb_private::ScriptedThread::GetQueueName(), lldb_private::DynamicRegisterInfo::GetRegisterSetIndexByName(), lldb_private::ValueObjectPrinter::GetRootNameForDisplay(), lldb::SBAttachInfo::GetScriptedProcessClassName(), lldb::SBLaunchInfo::GetScriptedProcessClassName(), lldb_private::PlatformDarwin::GetSDKPathFromDebugInfo(), lldb_private::PlatformDarwinDevice::GetSharedModuleWithLocalCache(), lldb::SBLaunchInfo::GetShell(), GetString(), lldb_private::ValueObject::GetSyntheticBase(), DynamicLoaderHexagonDYLD::GetThreadLocalData(), lldb::SBLanguageRuntime::GetThrowKeywordForLanguage(), lldb_private::ItaniumABILanguageRuntime::GetTypeInfo(), lldb_private::Value::GetValueAsData(), lldb::SBEnvironment::GetValueAtIndex(), lldb::SBWatchpoint::GetWatchSpec(), lldb_private::CommandInterpreter::HandleCommandsFromFile(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO(), lldb_private::ObjCLanguageRuntime::ClassDescriptor::IsCFType(), lldb_private::ObjCLanguageRuntime::ClassDescriptor::IsKVO(), lldb_private::Thread::JumpToLine(), lldb_private::Platform::LoadImage(), DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded(), lldb_private::Trace::LoadPostMortemTraceFromFile(), LocateDSYMInVincinityOfExecutable(), lldb_private::SymbolLocatorDefault::LocateExecutableObjectFile(), lldb_private::SymbolLocatorDebugSymbols::LocateExecutableSymbolFile(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), LookForDsymNextToExecutablePath(), lldb_private::AppleObjCRuntimeV2::LookupRuntimeSymbol(), lldb_private::TypeMatcher::Matches(), lldb_private::Module::Module(), lldb_private::Variable::NameMatches(), lldb_private::formatters::ObjCClassSummaryProvider(), CommandObjectTypeFilterAdd::CommandOptions::OptionParsingStarting(), SymbolFileSymtab::ParseCompileUnitAtIndex(), DWARFASTParserClang::ParseStructureLikeDIE(), ObjectFileELF::ParseSymtab(), ObjectFileMachO::ParseSymtab(), lldb_private::plugin::dwarf::SymbolFileDWARF::ParseType(), ObjectFileMachO::ProcessSegmentCommand(), lldb_private::ModuleCache::Put(), lldb_private::DynamicLoaderDarwin::Segment::PutToLog(), lldb_private::Target::RemoveNameFromBreakpoint(), lldb_private::Type::ResolveCompilerType(), lldb_private::Process::ResolveIndirectFunction(), lldb_private::BreakpointResolverFileLine::SearchCallback(), lldb_private::AddressResolverFileLine::SearchCallback(), elf::ELFSymbol::sectionIndexToCString(), lldb_private::DynamicRegisterInfo::SetRegisterInfo(), lldb_private::Debugger::StartEventHandlerThread(), lldb_private::TypeMatcher::StripTypeName(), lldb_private::ItaniumABILanguageRuntime::TypeHasVTable(), DYLDRendezvous::UpdateFileSpecIfNecessary(), lldb_private::ValueObjectSynthetic::UpdateValue(), and lldb_private::Module::~Module().

◆ Clear()

void lldb_private::ConstString::Clear ( )
inline

◆ Compare()

int ConstString::Compare ( ConstString  lhs,
ConstString  rhs,
const bool  case_sensitive = true 
)
static

Compare two string objects.

Compares the C string values contained in lhs and rhs and returns an integer result.

NOTE: only call this function when you want a true string comparison. If you want string equality use the, use the == operator as it is much more efficient. Also if you want string inequality, use the != operator for the same reasons.

Parameters
[in]lhsThe Left Hand Side const ConstString object reference.
[in]rhsThe Right Hand Side const ConstString object reference.
[in]case_sensitiveCase sensitivity of compare. If true, case sensitive compare will be performed, otherwise character case will be ignored
Returns
-1 if lhs < rhs, 0 if lhs == rhs, 1 if lhs > rhs

Definition at line 264 of file ConstString.cpp.

References GetStringRef(), and m_string.

Referenced by lldb_private::FileSpec::Compare(), lldb_private::FunctionInfo::Compare(), lldb_private::Mangled::Compare(), findSymbolAddress(), and lldb_private::ObjCLanguageRuntime::ClassAndSelStr::operator<().

◆ Dump()

void ConstString::Dump ( Stream s,
const char *  value_if_empty = nullptr 
) const

Dump the object description to a stream.

Dump the string value to the stream s. If the contained string is empty, print value_if_empty to the stream instead. If value_if_empty is nullptr, then nothing will be dumped to the stream.

Parameters
[in]sThe stream that will be used to dump the object description.
[in]value_if_emptyThe value to dump if the string is empty. If nullptr, nothing will be output to the stream.

Definition at line 288 of file ConstString.cpp.

References AsCString(), and lldb_private::Stream::PutCString().

Referenced by DumpBasename(), DumpDirectory(), lldb_private::Declaration::DumpStopContext(), lldb_private::LineEntry::DumpStopContext(), lldb_private::Type::DumpTypeName(), and lldb_private::BreakpointLocation::GetDescription().

◆ DumpDebug()

void ConstString::DumpDebug ( Stream s) const

Dump the object debug description to a stream.

Parameters
[in]sThe stream that will be used to dump the object description.

Definition at line 296 of file ConstString.cpp.

References GetCString(), GetLength(), and lldb_private::Stream::Printf().

Referenced by lldb_private::Mangled::DumpDebug().

◆ Equals()

bool ConstString::Equals ( ConstString  lhs,
ConstString  rhs,
const bool  case_sensitive = true 
)
static

Equal to operator.

Returns true if this string is equal to the string in rhs. If case sensitive equality is tested, this operation is very fast as it results in a pointer comparison since all strings are in a uniqued in a global string pool.

Parameters
[in]lhsThe Left Hand Side const ConstString object reference.
[in]rhsThe Right Hand Side const ConstString object reference.
[in]case_sensitiveCase sensitivity. If true, case sensitive equality will be tested, otherwise character case will be ignored
Returns
true if this object is equal to rhs, false otherwise.

Definition at line 247 of file ConstString.cpp.

References GetStringRef(), and m_string.

Referenced by lldb_private::FileSpec::DirectoryEquals(), lldb_private::FileSpec::FileEquals(), and FindFileIndex().

◆ FromStringPoolPointer()

static ConstString lldb_private::ConstString::FromStringPoolPointer ( const char *  ptr)
inlinestaticprotected

◆ GetCString()

const char * lldb_private::ConstString::GetCString ( ) const
inline

Get the string value as a C string.

Get the value of the contained string as a NULL terminated C string value. Similar to the ConstString::AsCString() function, yet this function will always return nullptr if the string is not valid. So this function is a direct accessor to the string pointer value.

Returns
Returns nullptr the string is invalid, otherwise the C string value contained in this object.

Definition at line 216 of file ConstString.h.

References m_string.

Referenced by PDBASTParser::AddRecordBases(), PDBASTParser::AddRecordMembers(), PDBASTParser::AddRecordMethod(), lldb_private::TypeCategoryImpl::AnyMatches(), ApplyELF32ABS32RelRelocation(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CalculateFrameVariableError(), CommandObjectTypeCategoryDefine::CommandObjectTypeCategoryDefine(), CommandObjectTypeSummaryDelete::CommandObjectTypeSummaryDelete(), IRForTarget::CreateResultVariable(), lldb::SBFrame::Disassemble(), CommandObjectSourceList::DisplayFunctionSource(), CommandObjectMemoryRead::DoExecute(), CommandObjectTargetModulesSearchPathsQuery::DoExecute(), CommandObjectTargetModulesShowUnwind::DoExecute(), CommandObjectMultiwordItaniumABI_Demangle::DoExecute(), TrieEntry::Dump(), lldb_private::UnwindPlan::Dump(), lldb_private::ProcessInstanceInfo::Dump(), lldb_private::ModuleSpec::Dump(), lldb_private::Module::Dump(), lldb_private::Address::Dump(), lldb_private::Target::Dump(), lldb_private::Symbol::Dump(), DumpDebug(), ObjectFileELF::DumpDependentModules(), lldb_private::SymbolContext::DumpStopContext(), DumpValue(), lldb_private::Disassembler::ElideMixedSourceAndDisassemblyLine(), lldb_private::plugin::dwarf::UniqueDWARFASTTypeMap::Find(), lldb_private::DynamicLoaderDarwin::FindEquivalentSymbols(), lldb_private::ClangASTSource::FindExternalVisibleDeclsByName(), lldb_private::plugin::dwarf::SymbolFileDWARF::FindFunctions(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::FindFunctions(), lldb_private::plugin::dwarf::SymbolFileDWARF::FindGlobalVariables(), lldb_private::plugin::dwarf::SymbolFileDWARF::FindNamespace(), lldb_private::ItaniumABILanguageRuntime::FixUpDynamicType(), lldb_private::AppleObjCRuntime::FixUpDynamicType(), lldb_private::GNUstepObjCRuntime::FixUpDynamicType(), lldb_private::FormatEntity::Format(), lldb_private::ThreadPlanStepInRange::FrameMatchesAvoidCriteria(), lldb_private::RichManglingContext::FromItaniumName(), lldb_private::CPlusPlusLanguage::GenerateAlternateFunctionManglings(), lldb::SBTarget::GetABIName(), lldb::SBLaunchInfo::GetArgumentAtIndex(), lldb::SBCommandInterpreter::GetArgumentDescriptionAsCString(), lldb::SBCommandInterpreter::GetArgumentTypeAsCString(), lldb_private::TypeSystemClang::GetChildCompilerTypeAtIndex(), lldb::SBPlatformShellCommand::GetCommand(), lldb::SBInstruction::GetComment(), lldb_private::ClangPersistentVariables::GetCompilerTypeFromPersistentDecl(), lldb::SBBreakpoint::GetCondition(), lldb::SBBreakpointLocation::GetCondition(), lldb::SBBreakpointName::GetCondition(), lldb::SBWatchpoint::GetCondition(), lldb::SBEvent::GetCStringFromEvent(), lldb::SBStream::GetData(), lldb::SBTypeSummary::GetData(), lldb::SBTypeSynthetic::GetData(), lldb::SBEvent::GetDataFlavor(), lldb_private::CPlusPlusLanguage::GetDemangledFunctionNameWithoutArguments(), lldb::SBTypeMemberFunction::GetDemangledName(), lldb_private::Mangled::GetDemangledName(), lldb_private::Module::GetDescription(), lldb_private::Address::GetDescription(), lldb_private::BreakpointLocation::GetDescription(), lldb_private::SymbolContext::GetDescription(), lldb_private::StackFrame::GetDisplayFunctionName(), lldb::SBLaunchInfo::GetEnvironmentEntryAtIndex(), lldb::SBTraceCursor::GetError(), lldb::SBTraceCursor::GetEventTypeAsString(), lldb::SBProcess::GetExitDescription(), lldb_private::ValueObject::GetExpressionPath(), lldb::SBTypeFilter::GetExpressionPathAtIndex(), GetFreeBSDProcessArgs(), lldb_private::PlatformDarwin::GetFullNameForDylib(), lldb_private::PlatformWindows::GetFullNameForDylib(), PlatformPOSIX::GetFullNameForDylib(), lldb_private::CPlusPlusLanguage::GetFunctionDisplayName(), lldb_private::StackFrame::GetFunctionName(), lldb::SBBreakpointName::GetHelpString(), lldb::SBPlatform::GetHostname(), lldb_private::TypeFilterImpl::FrontEnd::GetIndexOfChildWithName(), lldb_private::ScriptedSyntheticChildren::FrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::VectorTypeSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::LibcxxStdSliceArraySyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetIndexOfChildWithName(), lldb_private::formatters::GenericNSArrayISyntheticFrontEnd< D32, D64, Inline >::GetIndexOfChildWithName(), lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd< D32, D64 >::GetIndexOfChildWithName(), lldb_private::formatters::Foundation1100::NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName(), NSIndexPathSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::NSSetISyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::NSCFSetSyntheticFrontEnd::GetIndexOfChildWithName(), lldb_private::formatters::GenericNSSetMSyntheticFrontEnd< D32, D64 >::GetIndexOfChildWithName(), lldb_private::ValueObjectSynthetic::GetIndexOfChildWithName(), lldb::SBCommandInterpreter::GetIOHandlerControlSequence(), lldb::SBLaunchInfo::GetLaunchEventData(), lldb::SBPlatformConnectOptions::GetLocalCacheDirectory(), lldb::SBValue::GetLocation(), GetMacOSXProcessArgs(), lldb::SBInstruction::GetMnemonic(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(), lldb::SBProcessInfo::GetName(), lldb::SBTypeCategory::GetName(), lldb::SBTypeNameSpecifier::GetName(), lldb_private::TypeCategoryImpl::GetName(), lldb::SBBreakpointName::GetName(), lldb::SBBroadcaster::GetName(), lldb::SBThread::GetName(), lldb_private::ProcessInfo::GetName(), lldb_private::QueueImpl::GetName(), lldb_private::CommandObjectDisassemble::GetNameRanges(), GetNetBSDProcessArgs(), lldb_private::ObjectContainerMachOFileset::GetObjectFile(), GetOpenBSDProcessArgs(), lldb::SBInstruction::GetOperands(), lldb::SBPlatform::GetOSBuild(), lldb::SBPlatform::GetOSDescription(), lldb::SBPlatformShellCommand::GetOutput(), lldb_private::ClangPersistentVariables::GetPersistentDecl(), lldb::SBProcess::GetPluginName(), lldb::SBSaveCoreOptions::GetPluginName(), lldb::SBExpressionOptions::GetPrefix(), lldb::SBAttachInfo::GetProcessPluginName(), lldb::SBLaunchInfo::GetProcessPluginName(), lldb::SBDebugger::GetPrompt(), lldb::SBBreakpoint::GetQueueName(), lldb::SBBreakpointLocation::GetQueueName(), lldb::SBBreakpointName::GetQueueName(), lldb::SBThread::GetQueueName(), lldb::SBProcess::GetRestartedReasonAtIndexFromEvent(), lldb::SBPlatformShellCommand::GetShell(), lldb::SBUnixSignals::GetSignalAsCString(), lldb_private::Module::GetSpecificationDescription(), lldb::SBTrace::GetStartConfigurationHelp(), lldb_private::DynamicLoaderDarwin::GetStepThroughTrampolinePlan(), lldb_private::CPPLanguageRuntime::GetStepThroughTrampolinePlan(), lldb::SBData::GetString(), lldb::SBStringList::GetStringAtIndex(), lldb::SBValue::GetSummary(), GetSymbolNameFromAddress(), lldb::SBBreakpoint::GetThreadName(), lldb::SBBreakpointLocation::GetThreadName(), lldb::SBBreakpointName::GetThreadName(), lldb::SBModule::GetTriple(), lldb::SBModuleSpec::GetTriple(), lldb::SBPlatform::GetTriple(), lldb::SBProcessInfo::GetTriple(), lldb::SBTarget::GetTriple(), lldb_private::ItaniumABILanguageRuntime::GetTypeInfo(), DWARFASTParserClang::GetUniqueTypeNameAndDeclaration(), lldb::SBPlatformConnectOptions::GetURL(), lldb::SBModule::GetUUIDString(), lldb::SBValue::GetValue(), lldb::SBPlatformShellCommand::GetWorkingDirectory(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO(), lldb_private::plugin::dwarf::UniqueDWARFASTTypeMap::Insert(), lldb_private::Platform::Install(), lldb_private::StackFrame::LegacyGetValueForVariableExpressionPath(), lldb_private::formatters::LibcxxFunctionSummaryProvider(), DynamicLoaderPOSIXDYLD::LoadInterpreterModule(), loadMatchingPDBFile(), lldb_private::Lua::LoadModule(), lldb_private::PlatformDarwin::LocateExecutableScriptingResources(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), lldb_private::PersistentExpressionState::LookupSymbol(), lldb_private::InstrumentationRuntime::ModulesDidLoad(), lldb_private::formatters::NSStringSummaryProvider(), CommandObjectSourceList::SourceInfo::operator<(), lldb_private::operator<<(), DWARFASTParserClang::ParseCXXMethod(), DWARFASTParserClang::ParseEnum(), DWARFASTParserClang::ParseObjCMethod(), DWARFASTParserClang::ParseStructureLikeDIE(), ObjectFileMachO::ParseSymtab(), DWARFASTParserClang::ParseTypeModifier(), lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVariableDIE(), lldb_private::UnwindPlan::PlanValidAtAddress(), lldb_private::process_freebsd::NativeProcessFreeBSD::PopulateMemoryRegionCache(), lldb_private::process_netbsd::NativeProcessNetBSD::PopulateMemoryRegionCache(), lldb_private::ValueObjectPrinter::PrintDecl(), CommandObjectTargetModulesList::PrintModule(), ObjectFileELF::ReadSectionData(), lldb_private::Symtab::RegisterMangledNameEntry(), lldb_private::ClangPersistentVariables::RegisterPersistentDecl(), ObjectFileELF::RelocateSection(), resolve_tilde(), lldb_private::FileSystem::ResolveExecutableLocation(), lldb_private::Symbol::SetReExportedSymbolName(), lldb_private::Symbol::SetReExportedSymbolSharedLibrary(), lldb_private::DynamicRegisterInfo::SetRegisterInfo(), lldb_private::OptionValueEnumeration::SetValueFromString(), lldb_private::CPlusPlusLanguage::SymbolNameFitsToLanguage(), lldb_private::ObjCLanguage::SymbolNameFitsToLanguage(), lldb_private::UniqueCStringMap< T >::Compare::ThreeWay(), lldb_private::TypeNameSpecifierImpl::TypeNameSpecifierImpl(), and lldb_private::ValueObjectVTable::UpdateValue().

◆ GetLength()

size_t ConstString::GetLength ( ) const

Get the length in bytes of string value.

The string pool stores the length of the string, so we can avoid calling strlen() on the pointer value with this function.

Returns
Returns the number of bytes that this string occupies in memory, not including the NULL termination byte.

Definition at line 243 of file ConstString.cpp.

References Pool::GetConstCStringLength(), and m_string.

Referenced by lldb_private::ConstStringTable::Add(), DumpDebug(), GetString(), GetStringRef(), lldb_private::StackFrame::LegacyGetValueForVariableExpressionPath(), operator std::string_view(), and lldb_private::Debugger::StartEventHandlerThread().

◆ GetMangledCounterpart()

bool ConstString::GetMangledCounterpart ( ConstString counterpart) const

Retrieve the mangled or demangled counterpart for a mangled or demangled ConstString.

Object files and debug symbols often use mangled string to represent the linkage name for a symbol, function or global. The string pool can efficiently store these values and their counterparts so when we run into another instance of a mangled name, we can avoid calling the name demangler over and over on the same strings and then trying to unique them.

Parameters
[in]counterpartA reference to a ConstString object that might get filled in with the demangled/mangled counterpart.
Returns
/b True if counterpart was filled in with the counterpart /b false otherwise.

Definition at line 321 of file ConstString.cpp.

References Pool::GetMangledCounterpart(), m_string, and StringPool().

Referenced by lldb_private::Mangled::Encode(), lldb_private::Mangled::GetDemangledName(), and lldb_private::Mangled::GetRichManglingInfo().

◆ GetMemoryStats()

ConstString::MemoryStats ConstString::GetMemoryStats ( )
static

Definition at line 335 of file ConstString.cpp.

References Pool::GetMemoryStats(), and StringPool().

◆ GetString()

std::string lldb_private::ConstString::GetString ( ) const
inline

◆ GetStringRef()

llvm::StringRef lldb_private::ConstString::GetStringRef ( ) const
inline

Get the string value as a llvm::StringRef.

Returns
Returns a new llvm::StringRef object filled in with the needed data.

Definition at line 197 of file ConstString.h.

References GetLength(), and m_string.

Referenced by lldb_private::ClangExpressionSourceCode::AddLocalVariableDecls(), lldb_private::CppModuleConfiguration::analyzeFile(), ObjectFilePECOFF::AppendFromExportTable(), ABIAArch64::AugmentRegisterInfo(), lldb_private::OptionValueEnumeration::AutoComplete(), lldb_private::FormattersContainer< ValueType >::AutoComplete(), CanModuleBeGNUstepObjCLibrary(), lldb_private::Watchpoint::CaptureWatchedValue(), Compare(), ObjectFilePECOFF::CreateBinary(), ObjectFileXCOFF::CreateBinary(), ObjectFileCOFF::CreateInstance(), lldb_private::SymbolFileCTF::CreateInteger(), lldb_private::BreakpointResolverFileLine::DeduceSourceMapping(), lldb_private::Language::DemangledNameContainsPath(), CommandObjectMemoryRead::DoExecute(), InstructionLLVMC::DumpOperand(), lldb_private::ValueObject::DumpPrintableRepresentation(), lldb_private::wasm::ObjectFileWasm::DumpSectionHeader(), lldb_private::SymbolContext::DumpStopContext(), lldb_private::OptionValueEnumeration::DumpValue(), Equals(), lldb_private::Target::FindBreakpointName(), lldb_private::AppleObjCDeclVendor::FindDecls(), lldb_private::ClangASTSource::FindExternalVisibleDecls(), lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(), lldb::SBModule::FindFirstType(), lldb::SBTarget::FindFirstType(), lldb_private::plugin::dwarf::SymbolFileDWARF::FindFunctions(), lldb_private::npdb::SymbolFileNativePDB::FindFunctions(), lldb_private::plugin::dwarf::SymbolFileDWARF::FindGlobalVariables(), lldb_private::npdb::SymbolFileNativePDB::FindGlobalVariables(), SymbolFilePDB::FindGlobalVariables(), lldb_private::CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo(), FindMostRelevantFrame(), SymbolFilePDB::FindNamespace(), lldb_private::npdb::SymbolFileNativePDB::FindTypes(), SymbolFilePDB::FindTypes(), lldb_private::FormatEntity::FormatFileSpec(), lldb_private::TypeFormatImpl_EnumType::FormatObject(), lldb_private::CPlusPlusLanguage::GenerateAlternateFunctionManglings(), GetChildFileSpecificationsFromThin(), lldb_private::plugin::dwarf::DebugNamesDWARFIndex::GetCompleteObjCClass(), lldb_private::plugin::dwarf::ManualDWARFIndex::GetCompleteObjCClass(), lldb_private::FileSpec::GetComponents(), GetDebugLinkContents(), lldb_private::AppleObjCDeclVendor::GetDeclForISA(), lldb_private::Mangled::GetDemangledName(), lldb_private::ObjCLanguageRuntime::GetDescriptorIterator(), lldb_private::Target::GetEntryPointAddress(), lldb_private::ValueObject::GetExpressionPath(), lldb_private::platform_android::PlatformAndroid::GetFile(), lldb_private::FileSpec::GetFileNameExtension(), lldb_private::FileSpec::GetFileNameStrippingExtension(), lldb_private::IRExecutionUnit::GetFunction(), lldb_private::plugin::dwarf::DebugNamesDWARFIndex::GetFunctions(), lldb_private::plugin::dwarf::ManualDWARFIndex::GetFunctions(), lldb_private::plugin::dwarf::DebugNamesDWARFIndex::GetGlobalVariables(), lldb_private::plugin::dwarf::ManualDWARFIndex::GetGlobalVariables(), lldb_private::ObjCLanguage::GetMethodNameVariants(), ObjectContainerBSDArchive::GetModuleSpecifications(), ObjectFileCOFF::GetModuleSpecifications(), ObjectFilePECOFF::GetModuleSpecifications(), lldb_private::HTRBlockMetadata::GetMostFrequentlyCalledFunction(), lldb_private::ProcessInfo::GetNameAsStringRef(), lldb_private::Symtab::GetNameIndexes(), lldb_private::plugin::dwarf::DebugNamesDWARFIndex::GetNamespaces(), lldb_private::plugin::dwarf::ManualDWARFIndex::GetNamespaces(), lldb_private::plugin::dwarf::DebugNamesDWARFIndex::GetNamespacesWithParents(), lldb_private::plugin::dwarf::ManualDWARFIndex::GetObjCMethods(), ObjectContainerBSDArchive::GetObjectFile(), lldb_private::FileSpec::GetPath(), lldb_private::PlatformAppleSimulator::GetPluginName(), lldb_private::StackFrameRecognizerManager::GetRecognizerForFrame(), lldb_private::Mangled::GetRichManglingInfo(), ObjectFileELF::GetSectionType(), lldb_private::ModuleList::GetSharedModule(), lldb_private::Args::GetShellSafeArgument(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(), lldb_private::ItaniumABILanguageRuntime::GetTypeInfo(), lldb_private::FormattersContainer< ValueType >::GetTypeNameSpecifierAtIndex(), lldb_private::plugin::dwarf::DebugNamesDWARFIndex::GetTypes(), lldb_private::plugin::dwarf::ManualDWARFIndex::GetTypes(), lldb_private::ItaniumABILanguageRuntime::GetVTableInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo(), lldb_private::ClangASTSource::IgnoreName(), IsCompatible(), lldb_private::formatters::isStdTemplate(), lldb_private::Symbol::IsSyntheticWithAutoGeneratedName(), lldb_private::Platform::LoadImageUsingPaths(), DynamicLoaderPOSIXDYLD::LoadModuleAtAddress(), lldb_private::ObjCLanguageRuntime::LookupInCompleteClassCache(), LookupSymbolInModule(), lldb_private::formatters::NSDictionary_Additionals::AdditionalFormatterMatching::Prefix::Match(), lldb_private::TypeMatcher::Matches(), lldb_private::Mangled::NameMatches(), lldb_private::formatters::NSStringSummaryProvider(), operator llvm::StringRef(), operator<(), llvm::operator<<(), operator==(), DWARFASTParserClang::ParseEnum(), DWARFASTParserClang::ParseSubroutine(), ObjectFileELF::ParseSymbols(), DWARFASTParserClang::ParseTypeModifier(), lldb_private::ClangREPL::PrintOneVariable(), lldb_private::plugin::dwarf::DWARFIndex::ProcessFunctionDIE(), lldb_private::plugin::dwarf::DWARFIndex::ProcessTypeDIEMatchQuery(), ObjectFileELF::ReadSectionData(), lldb_private::VerboseTrapFrameRecognizer::RecognizeFrame(), lldb_private::RegisterAssertFrameRecognizer(), lldb_private::PathMappingList::RemapPath(), IRForTarget::runOnModule(), lldb_private::XcodeSDK::SDKSupportsModules(), lldb_private::Mangled::SetValue(), lldb_private::Debugger::StartEventHandlerThread(), and lldb_private::Watchpoint::WatchedValueReportable().

◆ IsEmpty()

bool lldb_private::ConstString::IsEmpty ( ) const
inline

Test for empty string.

Returns
true if the contained string is empty. false if the contained string is not empty.

Definition at line 304 of file ConstString.h.

References m_string.

Referenced by AsCString(), lldb_private::HostInfoLinux::ComputeSupportExeDirectory(), CommandObjectTargetModulesShowUnwind::DoExecute(), lldb_private::UnwindPlan::Dump(), FindFileIndex(), SymbolFilePDB::FindFunctions(), lldb_private::plugin::dwarf::SymbolFileDWARF::FindFunctions(), SymbolFilePDB::FindGlobalVariables(), lldb_private::AppleObjCRuntimeV2::GetByteOffsetForIvar(), lldb_private::FileSpec::GetComponents(), lldb_private::ValueObject::GetExpressionPath(), lldb_private::PlatformDarwin::GetFullNameForDylib(), lldb_private::PlatformWindows::GetFullNameForDylib(), PlatformPOSIX::GetFullNameForDylib(), SymbolFilePDB::GetMangledForPDBFunc(), ObjectContainerBSDArchive::GetModuleSpecifications(), lldb_private::Target::GetOrCreateModule(), lldb_private::Mangled::GetRichManglingInfo(), lldb_private::IRExecutionUnit::GetRunnableInfo(), ValueImpl::GetSP(), lldb_private::ValueObject::GetSyntheticBase(), lldb_private::ValueObject::GetSyntheticChildAtOffset(), lldb_private::ValueObjectChild::GetTypeName(), lldb_private::ValueObjectConstResult::GetTypeName(), lldb_private::ValueObjectRegister::GetTypeName(), DWARFASTParserClang::GetUniqueTypeNameAndDeclaration(), IsCompatible(), DynamicLoaderPOSIXDYLD::LoadInterpreterModule(), DynamicLoaderPOSIXDYLD::LoadModuleAtAddress(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), lldb_private::Module::Module(), lldb_private::formatters::NSArraySummaryProvider(), lldb_private::formatters::NSArraySyntheticFrontEndCreator(), lldb_private::formatters::NSDateSummaryProvider(), lldb_private::formatters::NSDictionarySummaryProvider(), lldb_private::formatters::NSDictionarySyntheticFrontEndCreator(), lldb_private::formatters::NSSetSummaryProvider(), lldb_private::formatters::NSSetSyntheticFrontEndCreator(), lldb_private::formatters::ObjCClassSummaryProvider(), operator bool(), lldb_private::Module::ReportWarningOptimization(), lldb_private::FileSystem::Resolve(), IRForTarget::runOnModule(), lldb_private::TypeMatcher::StripTypeName(), DYLDRendezvous::UpdateFileSpecIfNecessary(), ValueImpl::ValueImpl(), and lldb_private::Module::~Module().

◆ IsNull()

bool lldb_private::ConstString::IsNull ( ) const
inline

Test for null string.

Returns
true if there is no string associated with this instance. false if there is a string associated with this instance.

Definition at line 311 of file ConstString.h.

References m_string.

Referenced by lldb_private::Mangled::GetDemangledName().

◆ MemorySize()

size_t lldb_private::ConstString::MemorySize ( ) const
inline

Get the memory cost of this object.

Return the size in bytes that this object takes in memory. This returns the size in bytes of this object, which does not include any the shared string values it may refer to.

Returns
The number of bytes that this object occupies in memory.

Definition at line 397 of file ConstString.h.

References ConstString().

Referenced by lldb_private::Mangled::MemorySize(), lldb_private::FunctionInfo::MemorySize(), and lldb_private::FileSpec::MemorySize().

◆ operator bool()

lldb_private::ConstString::operator bool ( ) const
inlineexplicit

Convert to bool operator.

This allows code to check a ConstString object to see if it contains a valid string using code such as:

ConstString str(...);
if (str)
{ ...
A uniqued constant string class.
Definition: ConstString.h:40
Returns
/b True this object contains a valid non-empty C string, false otherwise.

Definition at line 95 of file ConstString.h.

References IsEmpty().

◆ operator llvm::StringRef()

lldb_private::ConstString::operator llvm::StringRef ( ) const
inline

Definition at line 169 of file ConstString.h.

References GetStringRef().

◆ operator std::string()

lldb_private::ConstString::operator std::string ( ) const
inlineexplicit

Definition at line 177 of file ConstString.h.

References GetString().

◆ operator std::string_view()

lldb_private::ConstString::operator std::string_view ( ) const
inlineexplicit

Definition at line 172 of file ConstString.h.

References GetLength(), and m_string.

◆ operator!=() [1/2]

bool lldb_private::ConstString::operator!= ( const char *  rhs) const
inline

Not equal to operator against a non-ConstString value.

Returns true if this string is not equal to the string in rhs. This overload is usually slower than comparing against a ConstString value. However, if the rhs string not already a ConstString and it is impractical to turn it into a non-temporary variable, then this overload is faster.

Parameters
[in]rhsAnother string object to compare this object to.
Returns
true if this object is not equal to rhs, false otherwise.

Definition at line 164 of file ConstString.h.

◆ operator!=() [2/2]

bool lldb_private::ConstString::operator!= ( ConstString  rhs) const
inline

Not equal to operator.

Returns true if this string is not equal to the string in rhs. This operation is very fast as it results in a pointer comparison since all strings are in a uniqued in a global string pool.

Parameters
[in]rhsAnother string object to compare this object to.
Returns
true if this object is not equal to rhs. false if this object is equal to rhs.

Definition at line 151 of file ConstString.h.

References m_string.

◆ operator<()

bool ConstString::operator< ( ConstString  rhs) const

Definition at line 220 of file ConstString.cpp.

References GetStringRef(), and m_string.

◆ operator==() [1/2]

bool lldb_private::ConstString::operator== ( const char *  rhs) const
inline

Equal to operator against a non-ConstString value.

Returns true if this string is equal to the string in rhs. This overload is usually slower than comparing against a ConstString value. However, if the rhs string not already a ConstString and it is impractical to turn it into a non-temporary variable, then this overload is faster.

Parameters
[in]rhsAnother string object to compare this object to.
Returns
true if this object is equal to rhs. false if this object is not equal to rhs.

Definition at line 128 of file ConstString.h.

References GetStringRef(), and m_string.

◆ operator==() [2/2]

bool lldb_private::ConstString::operator== ( ConstString  rhs) const
inline

Equal to operator.

Returns true if this string is equal to the string in rhs. This operation is very fast as it results in a pointer comparison since all strings are in a uniqued in a global string pool.

Parameters
[in]rhsAnother string object to compare this object to.
Returns
true if this object is equal to rhs. false if this object is not equal to rhs.

Definition at line 109 of file ConstString.h.

References m_string.

◆ SetCString()

void ConstString::SetCString ( const char *  cstr)

Set the C string value.

Set the string value in the object by uniquing the cstr string value in our global string pool.

If the C string already exists in the global string pool, it finds the current entry and returns the existing value. If it doesn't exist, it is added to the string pool.

Parameters
[in]cstrA NULL terminated C string to add to the string pool.

Definition at line 307 of file ConstString.cpp.

References Pool::GetConstCString(), m_string, and StringPool().

Referenced by ABIAArch64::AugmentRegisterInfo(), lldb_private::ValueObjectRegister::ConstructObject(), lldb_private::ValueObject::Dereference(), lldb_private::Mangled::GetDemangledName(), lldb::SBType::GetFieldAtIndex(), lldb_private::Mangled::GetRichManglingInfo(), lldb_private::ValueObject::GetSyntheticBase(), ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(), ParseTrieEntries(), lldb::SBPlatformConnectOptions::SetLocalCacheDirectory(), lldb_private::TypeAndOrName::SetName(), lldb_private::ValueObjectRegisterSet::UpdateValue(), and lldb_private::ValueObjectRegisterSet::ValueObjectRegisterSet().

◆ SetCStringWithLength()

void ConstString::SetCStringWithLength ( const char *  cstr,
size_t  cstr_len 
)

Set the C string value with length.

Set the string value in the object by uniquing cstr_len bytes starting at the cstr string value in our global string pool. If trim is true, then cstr_len indicates a maximum length of the CString and if the actual length of the string is less, then it will be trimmed.

If the C string already exists in the global string pool, it finds the current entry and returns the existing value. If it doesn't exist, it is added to the string pool.

Parameters
[in]cstrA NULL terminated C string to add to the string pool.
[in]cstr_lenThe maximum length of the C string.

Definition at line 326 of file ConstString.cpp.

References Pool::GetConstCStringWithLength(), m_string, and StringPool().

Referenced by ParseTrieEntries().

◆ SetString()

void ConstString::SetString ( llvm::StringRef  s)

◆ SetStringWithMangledCounterpart()

void ConstString::SetStringWithMangledCounterpart ( llvm::StringRef  demangled,
ConstString  mangled 
)

Set the C string value and its mangled counterpart.

Object files and debug symbols often use mangled string to represent the linkage name for a symbol, function or global. The string pool can efficiently store these values and their counterparts so when we run into another instance of a mangled name, we can avoid calling the name demangler over and over on the same strings and then trying to unique them.

Parameters
[in]demangledThe demangled string to correlate with the mangled name.
[in]mangledThe already uniqued mangled ConstString to correlate the soon to be uniqued version of demangled.

Definition at line 315 of file ConstString.cpp.

References Pool::GetConstCStringAndSetMangledCounterPart(), m_string, and StringPool().

Referenced by lldb_private::Mangled::GetDemangledName(), and lldb_private::Mangled::GetRichManglingInfo().

◆ SetTrimmedCStringWithLength()

void ConstString::SetTrimmedCStringWithLength ( const char *  cstr,
size_t  fixed_cstr_len 
)

Set the C string value with the minimum length between fixed_cstr_len and the actual length of the C string.

This can be used for data structures that have a fixed length to store a C string where the string might not be NULL terminated if the string takes the entire buffer.

Definition at line 330 of file ConstString.cpp.

References Pool::GetConstTrimmedCStringWithLength(), m_string, and StringPool().

Referenced by DynamicLoaderMacOSXDYLD::ParseLoadCommands(), and ObjectFileMachO::ProcessSegmentCommand().

Friends And Related Function Documentation

◆ ::llvm::DenseMapInfo

template<typename T , typename Enable >
friend struct ::llvm::DenseMapInfo
friend

Definition at line 410 of file ConstString.h.

Member Data Documentation

◆ m_string

const char* lldb_private::ConstString::m_string = nullptr
protected

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