LLVM: llvm::StringRef Class Reference (original) (raw)

StringRef - Represent a constant reference to a string, i.e. More...

#include "[llvm/ADT/StringRef.h](StringRef%5F8h%5Fsource.html)"

Public Types
using iterator = const char *
using const_iterator = const char *
using size_type = size_t
using value_type = char
using reverse_iterator = std::reverse_iterator<iterator>
using const_reverse_iterator = std::reverse_iterator<const_iterator>
Public Member Functions
Constructors
StringRef ()=default
Construct an empty string ref.
StringRef (std::nullptr_t)=delete
Disable conversion from nullptr.
constexpr StringRef (const char *Str LLVM_LIFETIME_BOUND)
Construct a string ref from a cstring.
constexpr StringRef (const char *data LLVM_LIFETIME_BOUND, size_t length)
Construct a string ref from a pointer and length.
StringRef (const std::string &Str)
Construct a string ref from an std::string.
constexpr StringRef (std::string_view Str)
Construct a string ref from an std::string_view.
Iterators
iterator begin () const
iterator end () const
reverse_iterator rbegin () const
reverse_iterator rend () const
const unsigned char * bytes_begin () const
const unsigned char * bytes_end () const
iterator_range< const unsigned char * > bytes () const
String Operations
constexpr const char * data () const
data - Get a pointer to the start of the string (which may not be null terminated).
constexpr bool empty () const
empty - Check if the string is empty.
constexpr size_t size () const
size - Get the string size.
char front () const
front - Get the first character in the string.
char back () const
back - Get the last character in the string.
template<typename Allocator>
StringRef copy (Allocator &A) const
bool equals_insensitive (StringRef RHS) const
Check for string equality, ignoring case.
int compare (StringRef RHS) const
compare - Compare two strings; the result is negative, zero, or positive if this string is lexicographically less than, equal to, or greater than the RHS.
LLVM_ABI int compare_insensitive (StringRef RHS) const
Compare two strings, ignoring case.
LLVM_ABI int compare_numeric (StringRef RHS) const
compare_numeric - Compare two strings, treating sequences of digits as numbers.
LLVM_ABI unsigned edit_distance (StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const
Determine the edit distance between this string and another string.
LLVM_ABI unsigned edit_distance_insensitive (StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const
std::string str () const
str - Get the contents as an std::string.
LLVM_ABI std::string lower () const
LLVM_ABI std::string upper () const
Convert the given ASCII string to uppercase.
Operator Overloads
char operator[] (size_t Index) const
template<typename T>
std::enable_if_t< std::is_same< T, std::string >::value, StringRef > & operator= (T &&Str)=delete
Disallow accidental assignment from a temporary std::string.
Type Conversions
constexpr operator std::string_view () const
String Predicates
bool starts_with (StringRef Prefix) const
Check if this string starts with the given Prefix.
bool starts_with (char Prefix) const
LLVM_ABI bool starts_with_insensitive (StringRef Prefix) const
Check if this string starts with the given Prefix, ignoring case.
bool ends_with (StringRef Suffix) const
Check if this string ends with the given Suffix.
bool ends_with (char Suffix) const
LLVM_ABI bool ends_with_insensitive (StringRef Suffix) const
Check if this string ends with the given Suffix, ignoring case.
String Searching
size_t find (char C, size_t From=0) const
Search for the first character C in the string.
LLVM_ABI size_t find_insensitive (char C, size_t From=0) const
Search for the first character C in the string, ignoring case.
size_t find_if (function_ref< bool(char)> F, size_t From=0) const
Search for the first character satisfying the predicate F.
size_t find_if_not (function_ref< bool(char)> F, size_t From=0) const
Search for the first character not satisfying the predicate F.
LLVM_ABI size_t find (StringRef Str, size_t From=0) const
Search for the first string Str in the string.
LLVM_ABI size_t find_insensitive (StringRef Str, size_t From=0) const
Search for the first string Str in the string, ignoring case.
size_t rfind (char C, size_t From=npos) const
Search for the last character C in the string.
LLVM_ABI size_t rfind_insensitive (char C, size_t From=npos) const
Search for the last character C in the string, ignoring case.
LLVM_ABI size_t rfind (StringRef Str) const
Search for the last string Str in the string.
LLVM_ABI size_t rfind_insensitive (StringRef Str) const
Search for the last string Str in the string, ignoring case.
size_t find_first_of (char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
LLVM_ABI size_t find_first_of (StringRef Chars, size_t From=0) const
Find the first character in the string that is in Chars, or npos if not found.
LLVM_ABI size_t find_first_not_of (char C, size_t From=0) const
Find the first character in the string that is not C or npos if not found.
LLVM_ABI size_t find_first_not_of (StringRef Chars, size_t From=0) const
Find the first character in the string that is not in the string Chars, or npos if not found.
size_t find_last_of (char C, size_t From=npos) const
Find the last character in the string that is C, or npos if not found.
LLVM_ABI size_t find_last_of (StringRef Chars, size_t From=npos) const
Find the last character in the string that is in C, or npos if not found.
LLVM_ABI size_t find_last_not_of (char C, size_t From=npos) const
Find the last character in the string that is not C, or npos if not found.
LLVM_ABI size_t find_last_not_of (StringRef Chars, size_t From=npos) const
Find the last character in the string that is not in Chars, or npos if not found.
bool contains (StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
bool contains (char C) const
Return true if the given character is contained in *this, and false otherwise.
bool contains_insensitive (StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
bool contains_insensitive (char C) const
Return true if the given character is contained in *this, and false otherwise.
Helpful Algorithms
size_t count (char C) const
Return the number of occurrences of C in the string.
LLVM_ABI size_t count (StringRef Str) const
Return the number of non-overlapped occurrences of Str in the string.
template<typename T>
bool getAsInteger (unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
template<typename T>
bool consumeInteger (unsigned Radix, T &Result)
Parse the current string as an integer of the specified radix.
LLVM_ABI bool getAsInteger (unsigned Radix, APInt &Result) const
Parse the current string as an integer of the specified Radix, or of an autosensed radix if the Radix given is 0.
LLVM_ABI bool consumeInteger (unsigned Radix, APInt &Result)
Parse the current string as an integer of the specified Radix.
LLVM_ABI bool getAsDouble (double &Result, bool AllowInexact=true) const
Parse the current string as an IEEE double-precision floating point value.
Substring Operations
constexpr StringRef substr (size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
StringRef take_front (size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
StringRef take_back (size_t N=1) const
Return a StringRef equal to 'this' but with only the last N elements remaining.
StringRef take_while (function_ref< bool(char)> F) const
Return the longest prefix of 'this' such that every character in the prefix satisfies the given predicate.
StringRef take_until (function_ref< bool(char)> F) const
Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicate.
StringRef drop_front (size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
StringRef drop_back (size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
StringRef drop_while (function_ref< bool(char)> F) const
Return a StringRef equal to 'this', but with all characters satisfying the given predicate dropped from the beginning of the string.
StringRef drop_until (function_ref< bool(char)> F) const
Return a StringRef equal to 'this', but with all characters not satisfying the given predicate dropped from the beginning of the string.
bool consume_front (StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
bool consume_front_insensitive (StringRef Prefix)
Returns true if this StringRef has the given prefix, ignoring case, and removes that prefix.
bool consume_back (StringRef Suffix)
Returns true if this StringRef has the given suffix and removes that suffix.
bool consume_back_insensitive (StringRef Suffix)
Returns true if this StringRef has the given suffix, ignoring case, and removes that suffix.
StringRef slice (size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
std::pair< StringRef, StringRef > split (char Separator) const
Split into two substrings around the first occurrence of a separator character.
std::pair< StringRef, StringRef > split (StringRef Separator) const
Split into two substrings around the first occurrence of a separator string.
std::pair< StringRef, StringRef > rsplit (StringRef Separator) const
Split into two substrings around the last occurrence of a separator string.
LLVM_ABI void split (SmallVectorImpl< StringRef > &A, StringRef Separator, int MaxSplit=-1, bool KeepEmpty=true) const
Split into substrings around the occurrences of a separator string.
LLVM_ABI void split (SmallVectorImpl< StringRef > &A, char Separator, int MaxSplit=-1, bool KeepEmpty=true) const
Split into substrings around the occurrences of a separator character.
std::pair< StringRef, StringRef > rsplit (char Separator) const
Split into two substrings around the last occurrence of a separator character.
StringRef ltrim (char Char) const
Return string with consecutive Char characters starting from the the left removed.
StringRef ltrim (StringRef Chars=" \t\n\v\f\r") const
Return string with consecutive characters in Chars starting from the left removed.
StringRef rtrim (char Char) const
Return string with consecutive Char characters starting from the right removed.
StringRef rtrim (StringRef Chars=" \t\n\v\f\r") const
Return string with consecutive characters in Chars starting from the right removed.
StringRef trim (char Char) const
Return string with consecutive Char characters starting from the left and right removed.
StringRef trim (StringRef Chars=" \t\n\v\f\r") const
Return string with consecutive characters in Chars starting from the left and right removed.
StringRef detectEOL () const
Detect the line ending style of the string.
Static Public Attributes
static constexpr size_t npos = ~size_t(0)

StringRef - Represent a constant reference to a string, i.e.

a character array and a length, which need not be null terminated.

This class does not own the string data, it is expected to be used in situations where the character data resides in some other buffer, whose lifetime extends past that of the StringRef. For this reason, it is not in general safe to store a StringRef.

Definition at line 55 of file StringRef.h.

const_iterator

const_reverse_iterator

using llvm::StringRef::const_reverse_iterator = std::reverse_iterator<const_iterator>

iterator

reverse_iterator

using llvm::StringRef::reverse_iterator = std::reverse_iterator<iterator>

size_type

using llvm::StringRef::size_type = size_t

value_type

llvm::StringRef::StringRef ( ) default

Construct an empty string ref.

Referenced by compare(), compare_insensitive(), compare_numeric(), consume_back(), consume_back_insensitive(), consume_front(), consume_front_insensitive(), consumeInteger(), contains(), contains_insensitive(), copy(), count(), detectEOL(), drop_back(), drop_front(), drop_until(), drop_while(), edit_distance_insensitive(), ends_with(), ends_with_insensitive(), equals_insensitive(), find(), find_first_not_of(), find_first_of(), find_if(), find_insensitive(), find_last_not_of(), find_last_of(), getAsInteger(), ltrim(), ltrim(), rfind(), rfind_insensitive(), rsplit(), rsplit(), rtrim(), rtrim(), slice(), split(), split(), split(), split(), starts_with(), starts_with_insensitive(), StringRef(), substr(), take_back(), take_front(), take_until(), take_while(), trim(), and trim().

StringRef() [2/6]

llvm::StringRef::StringRef ( std::nullptr_t ) delete

Disable conversion from nullptr.

This prevents things like if (S == nullptr)

StringRef() [3/6]

llvm::StringRef::StringRef ( const char *Str LLVM_LIFETIME_BOUND) inlineconstexpr

StringRef() [4/6]

llvm::StringRef::StringRef ( const char *data LLVM_LIFETIME_BOUND, size_t length ) inlineconstexpr

StringRef() [5/6]

llvm::StringRef::StringRef ( const std::string & Str) inline

Construct a string ref from an std::string.

Definition at line 101 of file StringRef.h.

References data().

StringRef() [6/6]

llvm::StringRef::StringRef ( std::string_view Str) inlineconstexpr

back()

char llvm::StringRef::back ( ) const inlinenodiscard

back - Get the last character in the string.

Definition at line 155 of file StringRef.h.

References assert(), data, empty(), and size().

Referenced by llvm::ELFYAML::dropUniqueSuffix(), llvm::SystemZHLASMAsmStreamer::EmitComment(), ends_with(), llvm::mir2vec::MIRVocabulary::extractBaseOpcodeName(), llvm::getObjCNamesIfSelector(), getQualifiedNameIndex(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), handleCompressedSection(), llvm::yaml::needsQuotes(), and llvm::object::ExportEntry::otherName().

begin()

iterator llvm::StringRef::begin ( ) const inline

Definition at line 112 of file StringRef.h.

References data.

Referenced by llvm::sys::path::append(), llvm::MDString::begin(), llvm::yaml::BlockScalarNode::BlockScalarNode(), bytes_begin(), chopOneUTF32(), llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), llvm::detail::IEEEFloat::convertFromString(), llvm::convertUTF8ToUTF16String(), copy(), llvm::APInt::getBitsNeeded(), llvm::sys::detail::getHostCPUNameForPowerPC(), getHostID(), llvm::object::Archive::Symbol::getName(), llvm::object::Archive::getNumberOfSymbols(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::getRecords(), llvm::object::COFFObjectFile::getRelocationTypeName(), llvm::object::MachOObjectFile::getRelocationTypeName(), llvm::object::WasmObjectFile::getRelocationTypeName(), llvm::object::XCOFFObjectFile::getRelocationTypeName(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::TextInstrProfReader::hasFormat(), llvm::Timer::init(), llvm::object::DirectX::Signature::initialize(), llvm::pdb::NamedStreamMap::load(), lower(), llvm::object::MachOUniversalBinary::MachOUniversalBinary(), llvm::sys::path::make_absolute(), llvm::SmallString< 0 >::operator+=(), llvm::object::Archive::Child::operator==(), parseMaybeMangledName(), percentDecode(), readInteger(), readStruct(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::reconstituteName(), rend(), llvm::MachO::replace_extension(), llvm::sys::path::replace_extension(), llvm::RewriteBuffer::ReplaceText(), llvm::yaml::ScalarNode::ScalarNode(), llvm::EngineBuilder::setMArch(), llvm::EngineBuilder::setMCPU(), llvm::TimerGroup::setName(), llvm::sys::unicode::startsWith(), llvm::object::Archive::symbol_begin(), and upper().

bytes()

bytes_begin()

bytes_end()

compare()

int llvm::StringRef::compare ( StringRef RHS) const inlinenodiscard

compare_insensitive()

int StringRef::compare_insensitive ( StringRef RHS) const nodiscard

compare_numeric()

int StringRef::compare_numeric ( StringRef RHS) const nodiscard

consume_back()

consume_back_insensitive()

bool llvm::StringRef::consume_back_insensitive ( StringRef Suffix) inline

consume_front()

Returns true if this StringRef has the given prefix and removes that prefix.

Definition at line 637 of file StringRef.h.

References starts_with(), StringRef(), and substr().

Referenced by FindCheckType(), getAbsolutePath(), llvm::Triple::getEnvironmentVersionString(), getLiteralSectionName(), llvm::SPIRVGlobalRegistry::getOrCreateSPIRVTypeByName(), llvm::Triple::getOSVersion(), llvm::GlobPattern::match(), parseAMDGPUAtomicOptimizerStrategy(), llvm::RISCVISAInfo::parseArchString(), llvm::SPIRV::parseBuiltinCallArgumentType(), parseFilePathFromURI(), parseMagic(), llvm::RISCVISAInfo::parseNormalizedArchString(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), parseReplacementItem(), llvm::lsp::JSONTransportInputOverFile::readStandardMessage(), llvm::MCContext::setGenDwarfRootFile(), stripExperimentalPrefix(), llvm::VFABI::tryDemangleForVFABI(), llvm::VersionTuple::tryParse(), tryParseAlign(), tryParseCompileTimeLinearToken(), tryParseISA(), tryParseLinearTokenWithRuntimeStep(), tryParseMask(), tryParseParameter(), tryParseVLEN(), and uriFromAbsolutePath().

consume_front_insensitive()

bool llvm::StringRef::consume_front_insensitive ( StringRef Prefix) inline

consumeInteger() [1/2]

Parse the current string as an integer of the specified Radix.

If Radix is specified as zero, this does radix autosensing using extended C rules: 0 is octal, 0x is hex, 0b is binary.

If the string does not begin with a number of the specified radix, this returns true to signify the error. The string is considered erroneous if empty. The portion of the string representing the discovered numeric value is removed from the beginning of the string.

Definition at line 502 of file StringRef.cpp.

References assert(), llvm::BitWidth, llvm::getAutoSenseRadix(), size(), and StringRef().

consumeInteger() [2/2]

template<typename T>

bool llvm::StringRef::consumeInteger ( unsigned Radix, T & Result ) inline

Parse the current string as an integer of the specified radix.

If Radix is specified as zero, this does radix autosensing using extended C rules: 0 is octal, 0x is hex, 0b is binary.

If the string does not begin with a number of the specified radix, this returns true to signify the error. The string is considered erroneous if empty or if it overflows T. The portion of the string representing the discovered numeric value is removed from the beginning of the string.

Definition at line 501 of file StringRef.h.

References llvm::consumeSignedInteger(), llvm::consumeUnsignedInteger(), and T.

Referenced by llvm::AMDGPUMachineFunction::AMDGPUMachineFunction(), FindCheckType(), llvm::HexagonSubtarget::initializeSubtargetDependencies(), llvm::yaml::ScalarTraits< FrameIndex >::input(), llvm::Pattern::parseNumericSubstitutionBlock(), parseReplacementItem(), llvm::AMDGPUPALMetadata::setFromString(), llvm::SIMachineFunctionInfo::SIMachineFunctionInfo(), tryParseAlign(), tryParseCompileTimeLinearToken(), tryParseLinearTokenWithRuntimeStep(), and tryParseVLEN().

contains() [1/2]

bool llvm::StringRef::contains ( char C) const inlinenodiscard

contains() [2/2]

bool llvm::StringRef::contains ( StringRef Other) const inlinenodiscard

Return true if the given string is a substring of *this, and false otherwise.

Definition at line 426 of file StringRef.h.

References find(), npos, llvm::Other, and StringRef().

Referenced by llvm::Hexagon_MC::addArchSubtarget(), llvm::Hexagon_MC::createHexagonMCSubtargetInfo(), llvm::AsmPrinter::emitPCSections(), expandProtectedFieldPtr(), llvm::generatePipeInst(), llvm::generateSampleImageInst(), llvm::generateVectorLoadStoreInst(), llvm::Triple::getEnvironmentVersionString(), llvm::NVPTXTTIImpl::getInstructionCost(), llvm::object::getNameType(), llvm::AMDGPU::HSAMD::MetadataStreamerMsgPackV4::getValueKind(), llvm::object::isDecorated(), llvm::offloading::amdgpu::isImageCompatibleWithEnv(), llvm::isPunct(), isSmallDataSection(), llvm::gsym::operator<<(), parseBraceExpansions(), llvm::SPIRV::parseBuiltinTypeNameToTargetExtType(), llvm::Pattern::parsePattern(), llvm::MCContext::parseSymbol(), printSymbolizedStackTrace(), and sanitizeFunctionName().

contains_insensitive() [1/2]

bool llvm::StringRef::contains_insensitive ( char C) const inlinenodiscard

contains_insensitive() [2/2]

bool llvm::StringRef::contains_insensitive ( StringRef Other) const inlinenodiscard

copy()

count() [1/2]

size_t llvm::StringRef::count ( char C) const inlinenodiscard

count() [2/2]

size_t StringRef::count ( StringRef Str ) const

Return the number of non-overlapped occurrences of Str in the string.

count - Return the number of non-overlapped occurrences of

Definition at line 367 of file StringRef.cpp.

References llvm::Count, find(), N, npos, and StringRef().

data()

const char * llvm::StringRef::data ( ) const inlinenodiscardconstexpr

data - Get a pointer to the start of the string (which may not be null terminated).

Definition at line 140 of file StringRef.h.

Referenced by llvm::msgpack::Document::addString(), annotateAllFunctions(), appendGlobalSymbolTableInfo(), llvm::object::BigArchive::BigArchive(), llvm::CachedHashString::CachedHashString(), llvm::FileCheckString::CheckDag(), llvm::FileCheckString::CheckNext(), llvm::FileCheckString::CheckSame(), compare_numeric(), constructSegment(), constructSymbolEntry(), llvm::objcopy::coff::createGnuDebugLinkSectionContents(), llvm::jitlink::createLinkGraphFromELFObject(), createMemberHeaderParseError(), llvm::MachO::createRegexFromGlob(), llvm::DWARFDebugPubTable::dump(), llvm::DWARFDebugLoclists::dumpRawEntry(), edit_distance(), edit_distance_insensitive(), llvm::BitstreamWriter::emitBlob(), llvm::DWARFYAML::emitDebugAbbrev(), llvm::DWARFYAML::emitDebugLine(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::emitFDE(), ends_with(), llvm:🆑:Option::error(), ExpandBasePaths(), llvm::DWARFListType< ListEntryType >::extract(), find(), find_first_not_of(), find_first_of(), find_last_not_of(), find_last_not_of(), find_last_of(), FindFirstMatchingPrefix(), llvm::json::fixUTF8(), llvm::RuntimeDyldCOFFAArch64::generateRelocationStub(), llvm::RuntimeDyldCOFFX86_64::generateRelocationStub(), llvm::ErrorDiagnostic::get(), llvm::irsymtab::storage::Range< T >::get(), llvm::irsymtab::storage::Str::get(), llvm::DataExtractor::getCStr(), llvm::DataExtractor::getCStr(), llvm::LTOModule::getDependentLibrary(), llvm::SelectionDAG::getExternalSymbol(), llvm::objcopy:🧝:SRecord::getHeader(), llvm::HexagonInstrInfo::getInlineAsmLength(), getInstructionID(), llvm::dwarf_linker::parallel::SectionDescriptor::getIntVal(), llvm::LibcallLoweringInfo::getLibcallName(), llvm::SelectionDAG::getMemcmp(), llvm::NVPTXRegisterInfo::getName(), llvm::object::Elf_Sym_Impl< ELFT >::getName(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::PPCTargetLowering::getRegForInlineAsmConstraint(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::RuntimeDyldMachO::getRelocationValueRef(), llvm::lto::LTO::getRuntimeLibcallSymbols(), llvm::object::ELFFile< ELFT >::getSectionName(), llvm::SelectionDAG::getStrlen(), getUUID(), llvm::object::ELFFile< ELFT >::getVersionDependencies(), gsiRecordCmp(), llvm::dwarf_linker::guessDeveloperDir(), isAsmComment(), llvm::json::isUTF8(), LLVMGetDebugLocDirectory(), LLVMGetDebugLocFilename(), LLVMGetInlineAsmAsmString(), LLVMGetInlineAsmConstraintString(), LLVMGetNamedMetadataName(), llvm::LegalizerHelper::lowerReadWriteRegister(), llvm::remarks::magicToFormat(), llvm::Pattern::match(), PrefixMatcher::match(), llvm::remarks::parseFormat(), llvm::remarks::parseHotnessThresholdOption(), parseMaybeMangledName(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), parseRD(), parseStrTabSize(), parseTypeIdSummaryRecord(), parseV2DirFileTables(), parseVersion(), parseWholeProgramDevirtResolution(), llvm::X86Operand::print(), ProcessMatchResult(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::irsymtab::readBitcode(), llvm::FileCheck::readCheckFile(), readCoverageMappingData(), llvm::jitlink::readTargetMachineArch(), llvm::LessRecordRegister::RecordParts::RecordParts(), llvm::Regex::Regex(), llvm::report_fatal_error(), reportError(), rfind_insensitive(), llvm::StringSaver::save(), llvm::orc::MachOBuilder< MachOTraits >::Section::Section(), llvm::orc::MachOBuilder< MachOTraits >::Segment::Segment(), llvm::orc::shared::SPSSerializationTraits< SPSString, StringRef >::serialize(), StringRef(), StringRef(), StringRef(), llvm::detail::to_float(), llvm:🆑:TokenizeGNUCommandLine(), llvm::object::CompressedOffloadBundle::CompressedBundleHeader::tryParse(), llvm::Twine::Twine(), llvm::Twine::Twine(), llvm::codeview::TypeServer2Record::TypeServer2Record(), and llvm::yaml::yaml2archive().

detectEOL()

StringRef llvm::StringRef::detectEOL ( ) const inlinenodiscard

Detect the line ending style of the string.

If the string contains a line ending, return the line ending character sequence that is detected. Otherwise return '
' for unix line endings.

Returns

- The line ending character sequence.

Definition at line 832 of file StringRef.h.

References data, find(), npos, size(), and StringRef().

drop_back()

StringRef llvm::StringRef::drop_back ( size_t N = 1) const inlinenodiscard

Return a StringRef equal to 'this' but with the last N elements dropped.

Definition at line 618 of file StringRef.h.

References assert(), N, size(), StringRef(), and substr().

Referenced by llvm::Hexagon_MC::addArchSubtarget(), llvm::mir2vec::MIRVocabulary::extractBaseOpcodeName(), llvm::AMDGPU::getArchFamilyNameAMDGCN(), llvm::getObjCNamesIfSelector(), llvm::yaml::Document::parseBlockNode(), llvm::omp::prettifyFunctionName(), rtrim(), rtrim(), and take_front().

drop_front()

StringRef llvm::StringRef::drop_front ( size_t N = 1) const inlinenodiscard

Return a StringRef equal to 'this' but with the first N elements dropped.

Definition at line 611 of file StringRef.h.

References assert(), N, size(), StringRef(), and substr().

Referenced by llvm::symbolize::advanceTo(), llvm::objcopy:🧝:OwnedDataSection::appendHexData(), llvm::ELFAttrs::attrTypeAsString(), llvm::ELFAttrs::attrTypeFromString(), chopOneUTF32(), llvm::consumeSignedInteger(), llvm::object::OffloadBundleURI::createFileURI(), llvm::omp::deconstructOpenMPKernelName(), extractOffloadBundle(), find_if(), FindCheckType(), FindFirstMatchingPrefix(), llvm::AArch64::getArchExtFeature(), llvm::objcopy:🧝:IHexRecord::getChecksum(), llvm:🆑:getCompilerBuildConfig(), getDXILArchNameFromShaderModel(), llvm::getFuncNameWithoutPrefix(), getLiteralSectionName(), llvm::memprof::getMemprofOptionsSymbolName(), llvm::getObjCNamesIfSelector(), llvm::codeview::getSymbolName(), llvm::object::ELFFile< ELFT >::getVersionDependencies(), llvm::HexagonSubtarget::initializeSubtargetDependencies(), llvm::yaml::isNumeric(), ltrim(), ltrim(), maxPlainSubstring(), llvm::RISCVISAInfo::parseArchString(), llvm::yaml::parseBool(), llvm::DebugCounter::parseChunks(), llvm::AArch64::ExtensionSet::parseModifier(), llvm::RISCVISAInfo::parseNormalizedArchString(), llvm::Pattern::parseNumericSubstitutionBlock(), parseScalarValue(), parseStrTabSize(), parseSVERegAsConstraint(), llvm::MachO::parseSymbol(), parseThunkName(), parseVersion(), popFront(), printSourceLine(), llvm::TextCodeGenDataReader::read(), llvm::FileCheck::readCheckFile(), llvm::sys::path::remove_dots(), llvm::orc::SearchPathResolver::resolve(), llvm::MCContext::setGenDwarfRootFile(), splitLiteralAndReplacement(), llvm::orc::DylibSubstitutor::substitute(), take_back(), llvm::mustache::tokenize(), tryParseISA(), llvm::orc::DLLImportDefinitionGenerator::tryToGenerate(), upgradeLoopTag(), and uriFromAbsolutePath().

drop_until()

Return a StringRef equal to 'this', but with all characters not satisfying the given predicate dropped from the beginning of the string.

Definition at line 631 of file StringRef.h.

References F, find_if(), StringRef(), and substr().

drop_while()

edit_distance()

Determine the edit distance between this string and another string.

Parameters

Other the string to compare this string against.
AllowReplacements whether to allow character replacements (change one character into another) as a single operation, rather than as two operations (an insertion and a removal).
MaxEditDistance If non-zero, the maximum edit distance that this routine is allowed to compute. If the edit distance will exceed that maximum, returns MaxEditDistance+1.

Returns

the minimum number of character insertions, removals, or (if AllowReplacements is true) replacements needed to transform one of the given strings into the other. If zero, the strings are identical.

Definition at line 88 of file StringRef.cpp.

References llvm::ArrayRef(), llvm::ComputeEditDistance(), data(), llvm::Other, and size().

Referenced by LookupNearestOption().

edit_distance_insensitive()

unsigned llvm::StringRef::edit_distance_insensitive ( StringRef Other, bool AllowReplacements = true, unsigned MaxEditDistance = 0 ) const nodiscard

empty()

bool llvm::StringRef::empty ( ) const inlinenodiscardconstexpr

empty - Check if the string is empty.

Definition at line 143 of file StringRef.h.

References size().

Referenced by addMappingsFromTLI(), llvm::MipsTargetLowering::AdjustInstrPostInstrSelection(), llvm::AMDGPUMachineFunction::AMDGPUMachineFunction(), llvm::analyzeImportedModule(), llvm::dwarf_linker::parallel::CompileUnit::analyzeImportedModule(), llvm::objcopy:🧝:OwnedDataSection::appendHexData(), llvm::object::applyNameType(), back(), buildDWODescription(), llvm::caseFoldingDjbHash(), llvm::checkDebugInfoMetadata(), chopOneUTF32(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::cloneAndEmitDebugFrame(), collectAddressSymbols(), llvm::InlineAsm::collectAsmStrs(), collectMetadataInfo(), llvm::DIEHash::computeCUSignature(), llvm::ARM::computeTargetABI(), llvm::LoongArchABI::computeTargetABI(), llvm::MipsABIInfo::computeTargetABI(), llvm::RISCVABI::computeTargetABI(), llvm::orc::DylibSubstitutor::configure(), llvm::DwarfUnit::constructTypeDIE(), llvm::consumeUnsignedInteger(), llvm::detail::IEEEFloat::convertFromString(), llvm::convertToCamelFromSnakeCase(), llvm::convertToSnakeFromCamelCase(), llvm::convertUTF8ToUTF16String(), copy(), llvm::memprof::RawMemProfReader::create(), llvm::sampleprof::SampleProfileReader::create(), llvm::vfs::RedirectingFileSystem::create(), llvm::sys::fs::create_directories(), llvm::orc::createComponent(), llvm::sampleprof::SampleContext::createCtxVectorFromStr(), llvm::dxil::ResourceTypeInfo::createElementStruct(), createProfileFileNameVar(), llvm::createProfileFileNameVar(), llvm::createSanitizerCtorAndInitFunctions(), llvm::sys::fs::createTemporaryFile(), llvm::declareSanitizerInitFunction(), llvm::FileCheckPatternContext::defineCmdlineVariables(), llvm::remarks::detectFormat(), llvm::ELFYAML::dropUniqueSuffix(), llvm::gsym::GsymReader::dump(), dumpAttribute(), llvm::DWARFDebugLoclists::dumpRawEntry(), llvm::emitAMDGPUPrintfCall(), emitCATTR(), llvm::SystemZHLASMAsmStreamer::EmitComment(), emitComments(), EmitGenDwarfAbbrev(), EmitGenDwarfInfo(), llvm::TargetLoweringObjectFileMachO::emitModuleMetadata(), llvm::ARMTargetStreamer::emitTargetAttributes(), ends_with(), llvm:🆑:Option::error(), ExpandBasePaths(), llvm::mir2vec::MIRVocabulary::extractBaseOpcodeName(), llvm::memprof::extractCallsFromIR(), llvm::AMDGPU::fillAMDGPUFeatureMap(), find_if(), FindFirstMatchingPrefix(), llvm::sampleprof::FunctionSamples::findFunctionSamplesAt(), findLastNonVersionCharacter(), llvm::finishBuildOpDecorate(), llvm::format_provider< llvm::lsp::Position >::format(), llvm::format_provider< std::chrono::duration< Rep, Period > >::format(), llvm::JITSymbolFlags::fromGlobalValue(), front(), llvm::Attribute::get(), llvm::get_stable_name(), llvm::get_threadpool_strategy(), getAbsolutePath(), llvm::AMDGPU::getArchFamilyNameAMDGCN(), llvm::ARM::getARMCPUForArch(), llvm::DIMacroNode::getCanonicalMDString(), llvm::DINode::getCanonicalMDString(), llvm::objcopy:🧝:IHexRecord::getChecksum(), llvm::dwarf_linker::classic::DeclContextTree::getChildDeclContext(), llvm::MCContext::getCOFFSection(), llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable(), llvm::MCContext::getELFSection(), getExtensionVersion(), getFeatures(), llvm::DWARFDebugLine::Prologue::getFileNameByIndex(), llvm::getFnAttrParsedVector(), llvm::getFuncNameWithoutPrefix(), llvm::InstrProfSymtab::getFuncOrVarNameIfDefined(), llvm::gsym::GsymReader::getFunctionInfoDataAtIndex(), llvm::object::AbstractArchiveMemberHeader::getGID(), llvm::GlobalValue::getGlobalIdentifier(), getGPUOrDefault(), llvm::NVPTXTTIImpl::getInstructionCost(), llvm::AMDGPU::getIntegerVecAttribute(), llvm::X86TargetLowering::getIRStackGuard(), llvm::TargetLibraryInfoImpl::getLibFunc(), llvm::object::MachOObjectFile::getLibraryShortNameByIndex(), getMipsABI(), llvm::PPC::getNormalizedPPCTargetCPU(), getOpEnabled(), getOpRefinementSteps(), llvm::DwarfCompileUnit::getOrCreateCommonBlock(), llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(), llvm::symbolize::LLVMSymbolizer::getOrCreateModuleInfo(), llvm::getOrCreateSanitizerCtorAndInitFunctions(), llvm::MCContext::getOrCreateSymbol(), getPassNameAndInstanceNum(), llvm::getPGOFuncName(), getPrettyScopeName(), llvm::MCObjectFileInfo::getPseudoProbeDescSection(), getQualifiedNameIndex(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::getRecords(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), getSearchPaths(), llvm::TargetLoweringObjectFile::getSectionForConstant(), llvm::TargetLoweringObjectFileELF::getSectionForConstant(), getStackGuard(), llvm::getSubDirectoryPath(), llvm::M68kMCInstLower::GetSymbolFromOperand(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::RISCVISAInfo::getTargetFeatureForExtension(), llvm::lto::getThinLTOOutputFile(), llvm::MCSymbolXCOFF::getUnqualifiedName(), getUUID(), llvm::VFABI::getVectorVariantNames(), llvm::yaml::Node::getVerbatimTag(), llvm::TargetLibraryInfoImpl::getWidestVF(), handleArgs(), llvm::objcopy::coff::handleArgs(), llvm::DWARFVerifier::handleDebugAbbrev(), HandlePrefixedOrGroupedOption(), llvm::sys::path::has_extension(), llvm::sys::path::has_filename(), llvm::sys::path::has_parent_path(), llvm::sys::path::has_relative_path(), llvm::sys::path::has_root_directory(), llvm::sys::path::has_root_name(), llvm::sys::path::has_root_path(), llvm::sys::path::has_stem(), llvm::SubtargetFeatures::hasFlag(), llvm::GlobalValue::hasSection(), llvm::X86TargetLowering::hasStackProbeSymbol(), llvm::mustache::hasTextBehind(), llvm::CSKYSubtarget::initializeSubtargetDependencies(), llvm::MSP430Subtarget::initializeSubtargetDependencies(), llvm::SparcSubtarget::initializeSubtargetDependencies(), llvm::X86TargetLowering::insertSSPDeclarations(), llvm::gsym::GsymCreator::insertString(), insertWaveSizeFeature(), llvm::SampleProfileProber::instrumentOneFunc(), llvm::ELFCompactAttrParser::integerAttribute(), isCanonical(), llvm::SubtargetFeatures::isEnabled(), llvm::TargetLibraryInfoImpl::isFunctionVectorizable(), llvm::TargetLibraryInfoImpl::isFunctionVectorizable(), llvm::yaml::isNumeric(), isStructurallyValidScheme(), llvm::RISCVISAInfo::isSupportedExtensionWithVersion(), llvm::AMDGPU::SendMsg::isValidMsgOp(), llvm::AMDGPU::MTBUFFormat::isValidNfmt(), llvm::LoadAndStorePromoter::LoadAndStorePromoter(), loadBinaryFormat(), LookupNearestOption(), llvm::TargetRegistry::lookupTarget(), llvm::codeview::CodeViewRecordIO::mapStringZVectorZ(), llvm::GlobPattern::match(), PrefixMatcher::match(), maxPlainSubstring(), llvm::yaml::needsQuotes(), llvm::Triple::normalize(), llvm::gsym::operator<<(), llvm::InterleavedRange< Range >::operator<<, optimizeNaN(), llvm::AMDGPULibFunc::parse(), llvm::DWARFDebugFrame::parse(), llvm::PassBuilder::parseAAPipeline(), llvm::MachO::parseAliasList(), parseAMDGPUAtomicOptimizerStrategy(), parseAMDGPUAttributorPassOptions(), llvm::AArch64::parseArchExtension(), llvm::RISCVISAInfo::parseArchString(), parseARMArch(), parseCC(), llvm::DebugCounter::parseChunks(), parseDebugType(), llvm::parseDenormalFPAttribute(), llvm::remarks::ParsedStringTable::ParsedStringTable(), parseInt(), llvm::RISCVISAInfo::parseNormalizedArchString(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), llvm::remarks::YAMLRemarkParser::parseRemark(), parseReplacementItem(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::PassBuilder::parseSinglePassOption(), parseSubArch(), parseV2DirFileTables(), llvm::AMDGPUCallLowering::passSpecialInputs(), llvm::SITargetLowering::passSpecialInputs(), llvm::MCInstPrinter::printAnnotation(), llvm::ELFCompactAttrParser::printAttribute(), printCFI(), PrintCFIEscape(), printExtendedName(), PrintExtension(), printFile(), llvm::hlsl::rootsig::printFlags(), llvm::AMDGPUInstPrinter::printHwreg(), llvm::NVPTXInstPrinter::printMmaCode(), llvm::printOp(), llvm:🆑:generic_parser_base::printOptionInfo(), RAGreedyPass::printPipeline(), llvm::AMDGPUInstPrinter::printSendMsg(), llvm::SparcELFMCAsmInfo::printSpecifierExpr(), llvm::XtensaMCAsmInfo::printSpecifierExpr(), processLoadCommands(), llvm::AttributeImpl::Profile(), llvm::irsymtab::readBitcode(), llvm::FileCheck::readCheckFile(), llvm::GCOVFile::readGCNO(), llvm::lsp::JSONTransportInputOverFile::readStandardMessage(), llvm::LessRecordRegister::RecordParts::RecordParts(), remarkAlloca(), llvm::sys::path::remove_dots(), llvm::MachO::replace_extension(), llvm::sys::path::replace_path_prefix(), runOnFunction(), llvm::sampleprof::SampleContext::SampleContext(), sanitizeFunctionName(), llvm::dwarf_linker::parallel::AcceleratorRecordsSaver::save(), llvm::StringSaver::save(), saveTempBitcode(), llvm::yaml::Output::scalarString(), llvm::Hexagon_MC::selectHexagonCPU(), llvm::orc::shared::SPSSerializationTraits< SPSString, StringRef >::serialize(), llvm::MachO::InterfaceFile::setFromBinaryAttrs(), llvm::codegen::setFunctionAttributes(), llvm::MCContext::setGenDwarfRootFile(), llvm::GlobalValue::setPartition(), llvm::sandboxir::PassManager< ParentPass, ContainedPass >::setPassPipeline(), llvm::GlobalObject::setSection(), llvm::lto::setupStatsFile(), llvm::VFABI::setVectorVariantNames(), shouldPrintOption(), llvm::MachO::shouldSkipSymLink(), llvm::SIMachineFunctionInfo::SIMachineFunctionInfo(), llvm::SIModeRegisterDefaults::SIModeRegisterDefaults(), llvm::SPIRVTranslate(), split(), split(), splitLiteralAndReplacement(), starts_with(), llvm::sys::unicode::startsWith(), llvm::ELFCompactAttrParser::stringAttribute(), llvm::Regex::sub(), llvm::BTFParser::symbolize(), llvm::symbolize::toJSON(), llvm::mustache::tokenize(), llvm::InlineAdvisorAnalysis::Result::tryCreate(), llvm::VFABI::tryDemangleForVFABI(), llvm::MCDwarfLineTableHeader::tryGetFile(), llvm::VersionTuple::tryParse(), tryParseISA(), updateAndRemoveSymbols(), llvm::UpgradeAttributes(), upgradeNVVMFnVectorAttr(), uriFromAbsolutePath(), llvm::InlineAsm::verify(), verifyFuncBFI(), llvm::cgdata::warn(), llvm::write(), writeDWARFExpression(), llvm::ThinLTOCodeGenerator::writeGeneratedObject(), and llvm::writeStringsAndOffsets().

end()

iterator llvm::StringRef::end ( ) const inline

Definition at line 114 of file StringRef.h.

References data, and size().

Referenced by llvm::sys::path::append(), llvm::yaml::BlockScalarNode::BlockScalarNode(), bytes_end(), llvm::FileCheckString::CheckNext(), llvm::FileCheckString::CheckSame(), chopOneUTF32(), llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), llvm::convertUTF8ToUTF16String(), copy(), llvm::MDString::end(), ends_with(), llvm::sys::detail::getHostCPUNameForPowerPC(), getHostID(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::getRecords(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::object::COFFObjectFile::getRelocationTypeName(), llvm::object::MachOObjectFile::getRelocationTypeName(), llvm::object::WasmObjectFile::getRelocationTypeName(), llvm::object::XCOFFObjectFile::getRelocationTypeName(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::Timer::init(), llvm::pdb::NamedStreamMap::load(), lower(), llvm::sys::path::make_absolute(), parseMaybeMangledName(), parseRD(), parseRegisterNumber(), percentDecode(), rbegin(), readInteger(), readStruct(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::reconstituteName(), llvm::Regex::Regex(), llvm::MachO::replace_extension(), llvm::sys::path::replace_extension(), llvm::RewriteBuffer::ReplaceText(), llvm::yaml::ScalarNode::ScalarNode(), llvm::AsmLexer::setBuffer(), llvm::EngineBuilder::setMArch(), llvm::EngineBuilder::setMCPU(), llvm::TimerGroup::setName(), llvm::sys::unicode::startsWith(), and upper().

ends_with() [1/2]

bool llvm::StringRef::ends_with ( char Suffix) const inlinenodiscard

ends_with() [2/2]

bool llvm::StringRef::ends_with ( StringRef Suffix) const inlinenodiscard

Check if this string ends with the given Suffix.

Definition at line 273 of file StringRef.h.

References data(), end(), size(), and StringRef().

Referenced by llvm::DWARFTypePrinter< DieType >::appendTypeTagName(), consume_back(), llvm::X86TargetLowering::EmitKCFICheck(), llvm::SmallString< 0 >::ends_with(), getHostCPUNameForARMFromComponents(), llvm::TargetLoweringObjectFileGOFF::getModuleMetadata(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::object::BigArchiveMemberHeader::getRawName(), llvm::AMDGPU::IsaInfo::getTargetIDSettingFromFeatureString(), llvm::mustache::hasTextBehind(), isDWOSection(), isDwoSection(), llvm::MachO::isPrivateLibrary(), optimizeDoubleFP(), llvm::parseAnalysisUtilityPasses(), llvm::ARM::parseArchEndian(), llvm::SPIRV::parseBuiltinCallArgumentType(), parseSubArch(), parseSVERegAsConstraint(), llvm::omp::prettifyFunctionName(), and llvm::SimplifyTypeTestsPass::run().

ends_with_insensitive()

bool StringRef::ends_with_insensitive ( StringRef Suffix) const nodiscard

equals_insensitive()

bool llvm::StringRef::equals_insensitive ( StringRef RHS) const inlinenodiscard

Check for string equality, ignoring case.

Definition at line 172 of file StringRef.h.

References compare_insensitive(), RHS, size(), and StringRef().

Referenced by llvm::SmallString< 0 >::equals_insensitive(), llvm::findVCToolChainViaEnvironment(), llvm::RISCVISAInfo::getRISCVFeaturesBitsInfo(), llvm::X86TargetLowering::isInlineAsmTargetBranch(), llvm::HexagonMCInstrInfo::isOrderedDuplexPair(), rfind_insensitive(), and llvm::StrInStrNoCase().

find() [1/2]

size_t llvm::StringRef::find ( char C, size_t From = 0 ) const inlinenodiscard

Search for the first character C in the string.

Returns

The index of the first occurrence of C, or npos if not found.

Definition at line 293 of file StringRef.h.

References llvm::CallingConv::C.

Referenced by checkLinkerOptCommand(), CommaSeparateAndAddOccurrence(), count(), llvm::SystemZHLASMAsmStreamer::EmitComment(), emitComments(), llvm::AsmPrinter::emitPCSections(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::ELFObjectWriter::executePostLayoutBinding(), ExpandBasePaths(), llvm::SmallString< 0 >::find(), llvm::SmallString< 0 >::find(), llvm::ReplayInlineAdvisor::getAdviceImpl(), llvm::PGOContextualProfile::getFunctionName(), getLiteralSectionName(), llvm::getObjCNamesIfSelector(), llvm::SPIRVGlobalRegistry::getOrCreateSPIRVTypeByName(), llvm::PassInstrumentationCallbacks::getPassNameForClassName(), llvm::object::ArchiveMemberHeader::getRawName(), llvm::codeview::DebugStringTableSubsection::getStringForId(), llvm::isSpecialPass(), llvm::lookupBuiltin(), llvm::Pattern::match(), llvm::RISCVISAInfo::parseArchString(), parseBraceExpansions(), llvm::SPIRV::parseBuiltinCallArgumentType(), llvm::SPIRV::parseBuiltinTypeNameToTargetExtType(), llvm::SPIRV::parseBuiltinTypeStr(), parseDebugType(), parseFilePathFromURI(), ParseLine(), llvm::RISCVISAInfo::parseNormalizedArchString(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), printSourceLine(), llvm::object::replace(), split(), split(), and llvm::Regex::sub().

find() [2/2]

size_t StringRef::find ( StringRef Str, size_t From = 0 ) const nodiscard

Search for the first string Str in the string.

find - Search for the first string

Returns

The index of the first occurrence of Str, or npos if not found.

Returns

- The index of the first occurrence of

Definition at line 126 of file StringRef.cpp.

References data(), llvm::Last, LLVM_UNLIKELY, N, npos, Size, size(), and StringRef().

find_first_not_of() [1/2]

StringRef::size_type StringRef::find_first_not_of ( char C, size_t From = 0 ) const nodiscard

find_first_not_of() [2/2]

StringRef::size_type StringRef::find_first_not_of ( StringRef Chars, size_t From = 0 ) const nodiscard

Find the first character in the string that is not in the string Chars, or npos if not found.

find_first_not_of - Find the first character in the string that is not in the string

Complexity: O(size() + Chars.size())

Note: O(size() + Chars.size())

Definition at line 255 of file StringRef.cpp.

References llvm::CallingConv::C, data(), npos, size(), and StringRef().

find_first_of() [1/2]

size_t llvm::StringRef::find_first_of ( char C, size_t From = 0 ) const inlinenodiscard

Find the first character in the string that is C, or npos if not found.

Same as find.

Definition at line 376 of file StringRef.h.

References llvm::CallingConv::C, and find().

Referenced by contains(), llvm::GlobPattern::create(), llvm::SmallString< 0 >::find_first_of(), llvm::SmallString< 0 >::find_first_of(), llvm::generateConvertInst(), maxPlainSubstring(), llvm::SPIRV::parseBuiltinCallArgumentType(), ParseLine(), llvm::Pattern::parsePattern(), parseScalarValue(), llvm::sys::printArg(), llvm::FileCheck::readCheckFile(), llvm::BinaryStreamReader::readCString(), llvm::sys::path::remove_dots(), and splitLiteralAndReplacement().

find_first_of() [2/2]

StringRef::size_type StringRef::find_first_of ( StringRef Chars, size_t From = 0 ) const nodiscard

Find the first character in the string that is in Chars, or npos if not found.

find_first_of - Find the first character in the string that is in

Complexity: O(size() + Chars.size())

Note: O(size() + Chars.size())

Definition at line 233 of file StringRef.cpp.

References llvm::CallingConv::C, data(), npos, size(), and StringRef().

find_if()

Search for the first character satisfying the predicate F.

Returns

The index of the first character satisfying F starting from From, or npos if not found.

Definition at line 308 of file StringRef.h.

References drop_front(), empty(), F, front(), npos, size(), and StringRef().

Referenced by drop_until(), find_if_not(), find_insensitive(), and take_until().

find_if_not()

Search for the first character not satisfying the predicate F.

Returns

The index of the first character not satisfying F starting from From, or npos if not found.

Definition at line 323 of file StringRef.h.

References F, and find_if().

Referenced by drop_while(), and take_while().

find_insensitive() [1/2]

size_t StringRef::find_insensitive ( char C, size_t From = 0 ) const nodiscard

find_insensitive() [2/2]

size_t StringRef::find_insensitive ( StringRef Str, size_t From = 0 ) const nodiscard

Search for the first string Str in the string, ignoring case.

Returns

The index of the first occurrence of Str, or npos if not found.

Definition at line 187 of file StringRef.cpp.

References npos, StringRef(), and substr().

find_last_not_of() [1/2]

StringRef::size_type StringRef::find_last_not_of ( char C, size_t From = npos ) const nodiscard

find_last_not_of() [2/2]

StringRef::size_type StringRef::find_last_not_of ( StringRef Chars, size_t From = npos ) const nodiscard

Find the last character in the string that is not in Chars, or npos if not found.

find_last_not_of - Find the last character in the string that is not in

Complexity: O(size() + Chars.size())

Note: O(size() + Chars.size())

Definition at line 296 of file StringRef.cpp.

References llvm::CallingConv::C, data(), npos, size(), and StringRef().

find_last_of() [1/2]

size_t llvm::StringRef::find_last_of ( char C, size_t From = npos ) const inlinenodiscard

Find the last character in the string that is C, or npos if not found.

Definition at line 401 of file StringRef.h.

References llvm::CallingConv::C, npos, and rfind().

Referenced by llvm::GlobPattern::create(), llvm::sys::path::extension(), llvm::SmallString< 0 >::find_last_of(), llvm::SmallString< 0 >::find_last_of(), llvm::SourceMgr::getLineAndColumn(), llvm::yaml::Node::getVerbatimTag(), ParseLine(), and llvm::sys::path::stem().

find_last_of() [2/2]

StringRef::size_type StringRef::find_last_of ( StringRef Chars, size_t From = npos ) const nodiscard

Find the last character in the string that is in C, or npos if not found.

find_last_of - Find the last character in the string that is in

Complexity: O(size() + Chars.size())

Note: O(size() + Chars.size())

Definition at line 271 of file StringRef.cpp.

References llvm::CallingConv::C, data(), npos, size(), and StringRef().

front()

char llvm::StringRef::front ( ) const inlinenodiscard

front - Get the first character in the string.

Definition at line 149 of file StringRef.h.

References assert(), data, and empty().

Referenced by llvm::convertToCamelFromSnakeCase(), find_if(), FindCheckType(), llvm::JITSymbolFlags::fromGlobalValue(), llvm::codeview::VFTableRecord::getName(), getQualifiedNameIndex(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::yaml::isNumeric(), maxPlainSubstring(), llvm::yaml::needsQuotes(), llvm::RISCVISAInfo::parseArchString(), llvm::yaml::parseBool(), llvm::PassBuilder::parsePassPipeline(), llvm::PassBuilder::parsePassPipeline(), llvm::PassBuilder::parsePassPipeline(), popFront(), llvm::sys::path::remove_dots(), llvm::MCContext::setGenDwarfRootFile(), splitLiteralAndReplacement(), starts_with(), and llvm::mustache::tokenize().

getAsDouble()

bool StringRef::getAsDouble ( double & Result,
bool AllowInexact = true ) const

getAsInteger() [1/2]

Parse the current string as an integer of the specified Radix, or of an autosensed radix if the Radix given is 0.

The current value in Result is discarded, and the storage is changed to be wide enough to store the parsed integer.

Returns

true if the string does not solely consist of a valid non-empty number in the appropriate base.

APInt::fromString is superficially similar but assumes the string is well-formed in the given radix.

Definition at line 583 of file StringRef.cpp.

References StringRef().

getAsInteger() [2/2]

template<typename T>

bool llvm::StringRef::getAsInteger ( unsigned Radix, T & Result ) const inline

Parse the current string as an integer of the specified radix.

If Radix is specified as zero, this does radix autosensing using extended C rules: 0 is octal, 0x is hex, 0b is binary.

If the string is invalid or if only a subset of the string is valid, this returns true to signify the error. The string is considered erroneous if empty or if it overflows T.

Definition at line 472 of file StringRef.h.

References llvm::getAsSignedInteger(), llvm::getAsUnsignedInteger(), and T.

Referenced by adjustCallerStackProbeSize(), adjustMinLegalVectorWidth(), llvm::object::BigArchive::BigArchive(), checkedGetHex(), llvm::object::Archive::Child::Child(), llvm::object::OffloadBundleURI::createFileURI(), llvm::get_threadpool_strategy(), getAllDBDirs(), getArchiveMemberDecField(), getArchiveMemberOctField(), getExtensionVersion(), getGlobalSymtabLocAndSize(), getHostCPUNameForARMFromComponents(), getNextDBDirName(), llvm::SPIRVGlobalRegistry::getOrCreateSPIRVTypeByName(), llvm::cas::ondisk::getOverriddenMaxMappingSize(), getPassNameAndInstanceNum(), llvm::getStringFnAttrAsInt(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::AMDGPU::Exp::getTgtId(), llvm::yaml::isInteger(), optimizeNaN(), llvm::vfs::RedirectingFileSystemParser::parse(), llvm::SPIRV::parseBuiltinCallArgumentType(), llvm::parseCachePruningPolicy(), parseDuration(), llvm::remarks::parseHotnessThresholdOption(), ParseLine(), parseMetadata(), llvm::RISCVISAInfo::parseNormalizedArchString(), parseRegisterNumber(), parseSectionFlags(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::parseStatepointDirectivesFromAttrs(), parseSVERegAsConstraint(), llvm::to_integer(), llvm::updateMinLegalVectorWidthAttr(), and llvm::writeArchiveToStream().

lower()

std::string StringRef::lower ( ) const nodiscard

Definition at line 107 of file StringRef.cpp.

References begin(), end(), llvm::map_iterator(), and llvm::toLower().

Referenced by llvm::ARMCondCodeFromString(), llvm::ARMVectorCondCodeFromString(), llvm::ELF::convertArchNameToEMachine(), llvm::MipsTargetAsmStreamer::emitDirectiveCpAdd(), llvm::MipsTargetAsmStreamer::emitDirectiveCpLoad(), llvm::MipsTargetAsmStreamer::emitDirectiveCpLocal(), llvm::MipsTargetAsmStreamer::emitDirectiveCpsetup(), llvm::MipsTargetAsmStreamer::emitFrame(), llvm::SparcTargetAsmStreamer::emitSparcRegisterIgnore(), llvm::SparcTargetAsmStreamer::emitSparcRegisterScratch(), llvm::VETargetAsmStreamer::emitVERegisterIgnore(), llvm::VETargetAsmStreamer::emitVERegisterScratch(), getBankedRegisterMask(), llvm::getMachineType(), llvm::RISCVTargetLowering::getRegForInlineAsmConstraint(), getRegisterName(), llvm::ELFCompactAttrParser::parseSubsection(), parseVectorKind(), printMIOperand(), llvm::MipsAsmPrinter::printOperand(), llvm::printRegClassOrBank(), llvm::ARCInstPrinter::printRegName(), llvm::LanaiInstPrinter::printRegName(), llvm::MipsInstPrinter::printRegName(), and llvm::XCoreInstPrinter::printRegName().

ltrim() [1/2]

StringRef llvm::StringRef::ltrim ( char Char) const inlinenodiscard

Return string with consecutive Char characters starting from the the left removed.

Definition at line 792 of file StringRef.h.

References drop_front(), find_first_not_of(), size(), and StringRef().

Referenced by llvm::RuntimeDyldCheckerExprEval::evaluate(), FindCheckType(), llvm::sys::detail::getHostCPUNameForARM(), llvm::sys::detail::getHostCPUNameForRISCV(), llvm::NVPTXTTIImpl::getInstructionCost(), llvm::mustache::hasTextAhead(), llvm::Pattern::parseNumericSubstitutionBlock(), parseReplacementItem(), parseScalarValue(), trim(), trim(), and llvm::VFABI::tryDemangleForVFABI().

ltrim() [2/2]

operator std::string_view()

llvm::StringRef::operator std::string_view ( ) const inlineconstexpr

operator=()

template<typename T>

std::enable_if_t< std::is_same< T, std::string >::value, StringRef > & llvm::StringRef::operator= ( T && Str) delete

Disallow accidental assignment from a temporary std::string.

The declaration here is extra complicated so that stringRef = {} and stringRef = "abc" continue to select the move assignment operator.

References T.

operator[]()

char llvm::StringRef::operator[] ( size_t Index) const inlinenodiscard

rbegin()

reverse_iterator llvm::StringRef::rbegin ( ) const inline

rend()

reverse_iterator llvm::StringRef::rend ( ) const inline

rfind() [1/2]

size_t llvm::StringRef::rfind ( char C, size_t From = npos ) const inlinenodiscard

Search for the last character C in the string.

Returns

The index of the last occurrence of C, or npos if not found.

Definition at line 345 of file StringRef.h.

References llvm::CallingConv::C, data, I, npos, and size().

Referenced by llvm::omp::deconstructOpenMPKernelName(), llvm::ELFYAML::dropUniqueSuffix(), find_last_of(), llvm::sampleprof::FunctionSamples::getCanonicalFnName(), getStringIndex(), llvm::object::MachOObjectFile::guessLibraryShortName(), llvm::SPIRV::lookupBuiltinNameHelper(), llvm::SmallString< 0 >::rfind(), llvm::SmallString< 0 >::rfind(), and rsplit().

rfind() [2/2]

size_t StringRef::rfind ( StringRef Str) const nodiscard

Search for the last string Str in the string.

rfind - Search for the last string

Returns

The index of the last occurrence of Str, or npos if not found.

Returns

- The index of the last occurrence of

Definition at line 213 of file StringRef.cpp.

References StringRef().

rfind_insensitive() [1/2]

size_t StringRef::rfind_insensitive ( char C, size_t From = npos ) const nodiscard

rfind_insensitive() [2/2]

size_t StringRef::rfind_insensitive ( StringRef Str) const nodiscard

rsplit() [1/2]

Split into two substrings around the last occurrence of a separator character.

If Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is minimal. If Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").

Parameters

Separator - The character to split on.

Returns

- The split substrings.

Definition at line 786 of file StringRef.h.

References rsplit(), and StringRef().

rsplit() [2/2]

Split into two substrings around the last occurrence of a separator string.

If Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is minimal. If Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").

Parameters

Separator - The string to split on.

Returns

- The split substrings.

Definition at line 735 of file StringRef.h.

References npos, rfind(), size(), slice(), StringRef(), and substr().

Referenced by llvm::RISCVISAInfo::parseNormalizedArchString(), and rsplit().

rtrim() [1/2]

StringRef llvm::StringRef::rtrim ( char Char) const inlinenodiscard

Return string with consecutive Char characters starting from the right removed.

Definition at line 804 of file StringRef.h.

References drop_back(), find_last_not_of(), size(), and StringRef().

Referenced by llvm::VPlanPrinter::dump(), llvm::RuntimeDyldCheckerExprEval::evaluate(), getFieldRawString(), llvm::object::ArchiveMemberHeader::getName(), getPayloadString(), llvm::mustache::hasTextBehind(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), llvm::X86InstPrinterCommon::printCondFlags(), llvm::TextCodeGenDataReader::read(), and llvm::mustache::stripTokenBefore().

rtrim() [2/2]

size()

size_t llvm::StringRef::size ( ) const inlinenodiscardconstexpr

size - Get the string size.

Definition at line 146 of file StringRef.h.

Referenced by llvm::AArch64FunctionInfo::AArch64FunctionInfo(), llvm::json::abbreviate(), addSection(), llvm::BTFStringTable::addString(), llvm::msgpack::Document::addString(), angleBracketString(), angleBracketString(), llvm::objcopy:🧝:OwnedDataSection::appendHexData(), llvm::DWARFTypePrinter< DieType >::appendTypeTagName(), argPlusPrefixesSize(), argPrefix(), back(), llvm::CachedHashString::CachedHashString(), llvm::CachedHashStringRef::CachedHashStringRef(), callBufferedPrintfStart(), charTailAt(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), checkArchVersion(), llvm::SITargetLowering::checkAsmConstraintVal(), compare(), compare_insensitive(), compare_numeric(), llvm::ComputeCrossModuleImport(), computeStringTable(), constructSegment(), constructSymbolEntry(), consume_back(), consume_back_insensitive(), consumeInteger(), llvm::consumeUnsignedInteger(), llvm::detail::IEEEFloat::convertFromString(), llvm::convertToCamelFromSnakeCase(), llvm::convertToSnakeFromCamelCase(), llvm::convertUTF8ToUTF16String(), copy(), count(), llvm::coverage::BinaryCoverageReader::create(), llvm::GlobPattern::create(), llvm::StringMapEntry< EmptyStringSetTag >::create(), llvm::sampleprof::SampleContext::createCtxVectorFromStr(), llvm::object::OffloadBundleURI::createFileURI(), llvm::objcopy::coff::createGnuDebugLinkSectionContents(), llvm::jitlink::createLinkGraphFromELFObject(), llvm::MachO::createRegexFromGlob(), llvm::object::CompressedOffloadBundle::decompress(), detectEOL(), drop_back(), drop_front(), dumpStringOffsetsSection(), edit_distance(), edit_distance_insensitive(), llvm::BitstreamWriter::emitBlob(), llvm::dwarf_linker::classic::DwarfStreamer::emitCIE(), llvm::DWARFYAML::emitDebugAbbrev(), llvm::DWARFYAML::emitDebugLine(), llvm::dwarf_linker::classic::DwarfStreamer::emitFDE(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::emitFDE(), llvm::MCObjectStreamer::emitFileDirective(), emitPPA1Name(), llvm::emitSourceFileHeader(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::emitStringSections(), empty(), llvm::CodeViewContext::encodeDefRange(), encodeRegisterForDwarf(), end(), ends_with(), ends_with_insensitive(), equals_insensitive(), expand(), ExpandBasePaths(), llvm::sys::path::extension(), extractOffloadBundle(), find(), find_first_not_of(), find_first_of(), find_if(), find_last_not_of(), find_last_not_of(), find_last_of(), FindCheckType(), FindFirstMatchingPrefix(), findLastNonVersionCharacter(), llvm::sys::unicode::findSyllable(), fixupIndexV4(), fixupIndexV5(), llvm::json::fixUTF8(), formatPax(), llvm::ErrorDiagnostic::get(), llvm::APInt::getBitsNeeded(), llvm::objcopy:🧝:IHexRecord::getChecksum(), llvm::ARMTargetLowering::getConstraintType(), llvm::AVRTargetLowering::getConstraintType(), llvm::BPFTargetLowering::getConstraintType(), llvm::HexagonTargetLowering::getConstraintType(), llvm::M68kTargetLowering::getConstraintType(), llvm::MSP430TargetLowering::getConstraintType(), llvm::NVPTXTargetLowering::getConstraintType(), llvm::PPCTargetLowering::getConstraintType(), llvm::RISCVTargetLowering::getConstraintType(), llvm::SITargetLowering::getConstraintType(), llvm::SparcTargetLowering::getConstraintType(), llvm::SystemZTargetLowering::getConstraintType(), llvm::TargetLowering::getConstraintType(), llvm::VETargetLowering::getConstraintType(), llvm::X86TargetLowering::getConstraintType(), llvm::XtensaTargetLowering::getConstraintType(), llvm::LTOModule::getDependentLibrary(), llvm::MCContext::getELFSection(), llvm::NonRelocatableStringpool::getEntry(), getErrorForInvalidExt(), getExtensionVersion(), llvm::getFuncNameWithoutPrefix(), llvm::objcopy:🧝:SRecord::getHeader(), llvm::HexagonInstrInfo::getInlineAsmLength(), llvm::ARMTargetLowering::getInlineAsmMemConstraint(), llvm::RISCVTargetLowering::getInlineAsmMemConstraint(), llvm::SystemZTargetLowering::getInlineAsmMemConstraint(), llvm::MDString::getLength(), getMemBufferCopyImpl(), llvm::TargetLoweringObjectFileGOFF::getModuleMetadata(), llvm::object::Elf_Sym_Impl< ELFT >::getName(), llvm::WritableMemoryBuffer::getNewUninitMemBuffer(), llvm::getObjCNamesIfSelector(), llvm:🆑:basic_parser_impl::getOptionWidth(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::Triple::getOSVersion(), getQualifiedNameIndex(), llvm::object::BigArchiveMemberHeader::getRawName(), llvm::ARMTargetLowering::getRegForInlineAsmConstraint(), llvm::AVRTargetLowering::getRegForInlineAsmConstraint(), llvm::BPFTargetLowering::getRegForInlineAsmConstraint(), llvm::HexagonTargetLowering::getRegForInlineAsmConstraint(), llvm::LanaiTargetLowering::getRegForInlineAsmConstraint(), llvm::M68kTargetLowering::getRegForInlineAsmConstraint(), llvm::MSP430TargetLowering::getRegForInlineAsmConstraint(), llvm::NVPTXTargetLowering::getRegForInlineAsmConstraint(), llvm::PPCTargetLowering::getRegForInlineAsmConstraint(), llvm::RISCVTargetLowering::getRegForInlineAsmConstraint(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::SystemZTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::VETargetLowering::getRegForInlineAsmConstraint(), llvm::X86TargetLowering::getRegForInlineAsmConstraint(), llvm::XtensaTargetLowering::getRegForInlineAsmConstraint(), llvm::logicalview::getScopedName(), llvm::object::ELFFile< ELFT >::getSectionName(), llvm::object::MachOObjectFile::getSectionSize(), llvm::RISCVISAInfo::getTargetFeatureForExtension(), llvm::AMDGPU::Exp::getTgtId(), getUUID(), getVarName(), llvm::object::ELFFile< ELFT >::getVersionDependencies(), llvm::CodeViewYAML::GlobalHash::GlobalHash(), gsiRecordCmp(), llvm::object::MachOObjectFile::guessLibraryShortName(), HandlePrefixedOrGroupedOption(), llvm::handleSection(), llvm::jitlink::identifyELFSectionStartAndEndSymbols(), llvm::jitlink::identifyMachOSectionStartAndEndSymbols(), llvm::object::DirectX::Signature::initialize(), llvm::codeview::DebugStringTableSubsection::insert(), isAsmComment(), isImmConstraint(), llvm::yaml::isNumeric(), llvm::json::isUTF8(), llvm::detail::join_impl(), LLVMGetDebugLocDirectory(), LLVMGetDebugLocFilename(), LLVMGetInlineAsmAsmString(), LLVMGetInlineAsmConstraintString(), LLVMGetNamedMetadataName(), llvm::gsym::FunctionInfo::lookup(), llvm::SPIRV::lookupBuiltinNameHelper(), lookupLLVMIntrinsicByName(), llvm::ARMTargetLowering::LowerAsmOperandForConstraint(), llvm::AVRTargetLowering::LowerAsmOperandForConstraint(), llvm::LanaiTargetLowering::LowerAsmOperandForConstraint(), llvm::M68kTargetLowering::LowerAsmOperandForConstraint(), llvm::NVPTXTargetLowering::LowerAsmOperandForConstraint(), llvm::PPCTargetLowering::LowerAsmOperandForConstraint(), llvm::RISCVTargetLowering::LowerAsmOperandForConstraint(), llvm::SparcTargetLowering::LowerAsmOperandForConstraint(), llvm::SystemZTargetLowering::LowerAsmOperandForConstraint(), llvm::TargetLowering::LowerAsmOperandForConstraint(), llvm::XtensaTargetLowering::LowerAsmOperandForConstraint(), llvm::InlineAsmLowering::lowerAsmOperandForConstraint(), ltrim(), ltrim(), llvm::object::MachOUniversalBinary::MachOUniversalBinary(), llvm::opt::DerivedArgList::MakeJoinedArg(), mapNameAndUniqueName(), llvm::Pattern::match(), PrefixMatcher::match(), maxPlainSubstring(), maybeLexIndex(), maybeLexIndexAndName(), maybeLexIRBlock(), maybeLexIRValue(), maybeLexMCSymbol(), maybeLexSubRegisterIndex(), operator new(), operator std::string_view(), llvm::gsym::operator<<(), llvm::gsym::operator<<(), operator, optimizeDoubleFP(), optimizeMemCmpVarSize(), llvm::DWARFDebugFrame::parse(), llvm::ELFExtendedAttrParser::parse(), llvm::object::DirectX::PSVRuntimeInfo::parse(), llvm::parseAnalysisUtilityPasses(), llvm::RISCVISAInfo::parseArchString(), llvm::yaml::parseBool(), parseBraceExpansions(), ParseLine(), parseMagic(), parseMaybeMangledName(), llvm::RISCVISAInfo::parseNormalizedArchString(), llvm::Pattern::parsePattern(), parseRefinementStep(), parseRegisterNumber(), parseScalarValue(), parseStrTabSize(), parseSVERegAsConstraint(), parseVersion(), populateDependencyMatrix(), printCFI(), PrintCFIEscape(), llvm:🆑:Option::printEnumValHelpStr(), llvm::Pattern::printFuzzyMatch(), llvm:🆑:generic_parser_base::printGenericOptionDiff(), printLine(), printNoMatch(), llvm:🆑:generic_parser_base::printOptionInfo(), printSourceLine(), promoteToConstantPool(), llvm::irsymtab::readBitcode(), llvm::FileCheck::readCheckFile(), readCoverageMappingData(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::reconstituteName(), llvm::LessRecordRegister::RecordParts::RecordParts(), llvm::sys::path::relative_path(), llvm::sys::path::remove_dots(), llvm::object::replace(), llvm::sys::path::replace_extension(), llvm::sys::path::replace_path_prefix(), llvm::RewriteBuffer::ReplaceText(), llvm::report_fatal_error(), llvm::logicalview::LVElement::resolveFullname(), rfind(), rfind_insensitive(), rfind_insensitive(), llvm::RISCVMachineFunctionInfo::RISCVMachineFunctionInfo(), rsplit(), rtrim(), rtrim(), llvm::SimplifyTypeTestsPass::run(), llvm::StringSaver::save(), llvm::orc::MachOBuilder< MachOTraits >::Section::Section(), llvm::orc::MachOBuilder< MachOTraits >::Segment::Segment(), llvm::orc::shared::SPSSerializationTraits< SPSString, StringRef >::serialize(), llvm::orc::shared::SPSSerializationTraits< SPSString, StringRef >::size(), slice(), split(), split(), splitLiteralAndReplacement(), starts_with(), starts_with_insensitive(), llvm::sys::unicode::startsWith(), llvm::sys::path::stem(), str(), StringRef(), llvm::StrInStrNoCase(), llvm::impl::strip_quotes(), llvm::mustache::stripTokenBefore(), llvm::Regex::sub(), substr(), llvm::BTFParser::symbolize(), take_back(), take_front(), llvm::mustache::tokenize(), llvm::StringAttributeImpl::totalSizeToAlloc(), llvm::object::CompressedOffloadBundle::CompressedBundleHeader::tryParse(), llvm::Twine::Twine(), llvm::Twine::Twine(), llvm::codeview::TypeServer2Record::TypeServer2Record(), updateAndRemoveSymbols(), updateLoadCommandPayloadString(), updateSection(), llvm::UpgradeDataLayoutString(), upgradeLoopTag(), llvm::orc::ELFDebugObjectSection< ELFT >::validateInBounds(), llvm::DWARFVerifier::verifyDebugStrOffsets(), llvm::logicalview::LVLogicalVisitor::visitKnownMember(), llvm::object::WasmObjectFile::WasmObjectFile(), wordsOfString(), llvm::msgpack::Writer::write(), llvm::writeArchiveToStream(), llvm::writeStringsAndOffsets(), and llvm::yaml::yaml2archive().

slice()

StringRef llvm::StringRef::slice ( size_t Start, size_t End ) const inlinenodiscard

Return a reference to the substring from [Start, End).

Parameters

Start The index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned.
End The index following the last character to include in the substring. If this is npos or exceeds the number of characters remaining in the string, the string suffix (starting with Start) will be returned. If this is less than Start, an empty string will be returned.

Definition at line 686 of file StringRef.h.

References data, size(), and StringRef().

Referenced by llvm::FileCheckString::CheckDag(), llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), llvm::object::ObjectFile::createMachOObjectFile(), llvm::BTFParser::findString(), llvm::objcopy:🧝:SRecord::getHeader(), llvm::object::MinidumpFile::getRawStream(), llvm::object::MachOObjectFile::guessLibraryShortName(), llvm::lookupBuiltin(), llvm::RISCVISAInfo::parseArchString(), llvm::SPIRV::parseBuiltinCallArgumentType(), llvm::SPIRV::parseBuiltinTypeStr(), llvm::RISCVISAInfo::parseNormalizedArchString(), parseRegisterNumber(), printSourceLine(), rsplit(), llvm::sandboxir::PassManager< ParentPass, ContainedPass >::setPassPipeline(), llvm::SmallString< 0 >::slice(), split(), split(), split(), splitLiteralAndReplacement(), llvm::Regex::sub(), and tokenizeWindowsCommandLineImpl().

split() [1/4]

Split into two substrings around the first occurrence of a separator character.

If Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is maximal. If Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").

Parameters

Separator The character to split on.

Returns

The split substrings.

Definition at line 702 of file StringRef.h.

References split(), and StringRef().

Referenced by addSection(), collectAddressSymbols(), llvm::InlineAsm::collectAsmStrs(), collectMetadataInfo(), llvm::orc::createComponent(), llvm::sampleprof::SampleContext::createCtxVectorFromStr(), llvm::sampleprof::SampleContext::decodeContextString(), llvm::FileCheckPatternContext::defineCmdlineVariables(), llvm::VPlanPrinter::dump(), llvm::AMDGPU::HSAMD::MetadataStreamerMsgPackV4::emitKernelArg(), findSection(), llvm::findVCToolChainViaEnvironment(), forceAttributes(), llvm::Triple::getArchName(), llvm::codeview::getBytesAsCString(), llvm::sampleprof::FunctionSamples::getCanonicalFnName(), llvm::object::COFFObjectFile::getDebugPDBInfo(), llvm::getDefaultDebuginfodUrls(), llvm::Triple::getEnvironmentName(), llvm::AArch64TTIImpl::getFeatureMask(), llvm::getFnAttrParsedVector(), llvm::sys::detail::getHostCPUNameForARM(), llvm::sys::detail::getHostCPUNameForRISCV(), llvm::sys::detail::getHostCPUNameForS390x(), llvm::AMDGPU::getIntegerVecAttribute(), getIntOperandFromRegisterString(), getIntOperandsFromRegisterString(), getOpEnabled(), getOpRefinementSteps(), llvm::Triple::getOSAndEnvironmentName(), llvm::Triple::getOSName(), llvm::getParsedIRPGOName(), llvm::LoongArchTargetLowering::getRegisterByName(), getSearchPaths(), llvm::object::COFFObjectFile::getSectionName(), llvm::VFABI::getVectorVariantNames(), llvm::Triple::getVendorName(), llvm::handleExecNameEncodedBEOpts(), llvm::handleExecNameEncodedOptimizerOpts(), hasObjCCategoryInModule(), llvm::isHeader(), llvm::offloading::amdgpu::isImageCompatibleWithEnv(), isThumbFunction(), llvm::object::Lexer::lex(), llvm::lookupBuiltin(), LookupNearestOption(), llvm::SPIRVExtensionsParser::parse(), llvm::PassBuilder::parseAAPipeline(), parseAMDGPUAttributorPassOptions(), llvm::SPIRV::parseBuiltinTypeStr(), parseCHRFilterFiles(), llvm::parseDenormalFPAttribute(), parseNamePrefix(), llvm::PassBuilder::parseSinglePassOption(), parseThunkName(), llvm::DebugCounter::push_back(), llvm::ForceFunctionAttrsPass::run(), llvm::lsp::URIForFile::scheme(), llvm::Hexagon_MC::selectHexagonCPU(), llvm::AMDGPU::IsaInfo::AMDGPUTargetID::setTargetIDFromTargetIDStream(), llvm::SubtargetFeatures::Split(), split(), llvm::Regex::sub(), llvm::opt::OptTable::suggestValueCompletions(), llvm::mustache::tokenize(), llvm::Triple::Triple(), and upgradeNVVMFnVectorAttr().

split() [2/4]

Split into substrings around the occurrences of a separator character.

Each substring is stored in A. If MaxSplit is >= 0, at most MaxSplit splits are done and consequently <= MaxSplit + 1 elements are added to A. If KeepEmpty is false, empty strings are not added to A. They still count when considering MaxSplit An useful invariant is that Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true

Parameters

A - Where to put the substrings.
Separator - The string to split on.
MaxSplit - The maximum number of times the string is split.
KeepEmpty - True if empty substring should be added.

Definition at line 335 of file StringRef.cpp.

References A(), empty(), find(), npos, slice(), StringRef(), and substr().

split() [3/4]

Split into substrings around the occurrences of a separator string.

Each substring is stored in A. If MaxSplit is >= 0, at most MaxSplit splits are done and consequently <= MaxSplit + 1 elements are added to A. If KeepEmpty is false, empty strings are not added to A. They still count when considering MaxSplit An useful invariant is that Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true

Parameters

A - Where to put the substrings.
Separator - The string to split on.
MaxSplit - The maximum number of times the string is split.
KeepEmpty - True if empty substring should be added.

Definition at line 308 of file StringRef.cpp.

References A(), empty(), find(), npos, size(), slice(), StringRef(), and substr().

split() [4/4]

Split into two substrings around the first occurrence of a separator string.

If Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is maximal. If Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").

Parameters

Separator - The string to split on.

Returns

- The split substrings.

Definition at line 717 of file StringRef.h.

References find(), npos, size(), slice(), StringRef(), and substr().

starts_with() [1/2]

bool llvm::StringRef::starts_with ( char Prefix) const inlinenodiscard

starts_with() [2/2]

bool llvm::StringRef::starts_with ( StringRef Prefix) const inlinenodiscard

Check if this string starts with the given Prefix.

Definition at line 261 of file StringRef.h.

References data, size(), and StringRef().

Referenced by llvm::DWARFTypePrinter< DieType >::appendTypeTagName(), llvm::object::Archive::Archive(), llvm::AsmLexer::AsmLexer(), llvm::ELFAttrs::attrTypeFromString(), collectAddressSymbols(), llvm::objcopy:🧝:Object::compressOrDecompressSections(), llvm::ARM::computeTargetABI(), llvm::MipsABIInfo::computeTargetABI(), llvm::RISCVABI::computeTargetABI(), llvm::object::Archive::create(), llvm::remarks::createYAMLParserFromMeta(), llvm::omp::deconstructOpenMPKernelName(), doesIgnoreDataTypeSuffix(), llvm::Attributor::emitRemark(), llvm::Attributor::emitRemark(), llvm::ARMTargetStreamer::emitTargetAttributes(), llvm::NVPTXTargetStreamer::emitValue(), llvm::ELFObjectWriter::executePostLayoutBinding(), FindCheckType(), llvm::JITSymbolFlags::fromGlobalValue(), llvm::generateGroupInst(), getAbsolutePath(), getAllDBDirs(), getAllGarbageDirs(), llvm::AArch64::getArchExtFeature(), llvm::SystemZTargetLowering::getConstraintType(), getExtensionType(), getExtensionTypeDesc(), llvm::getFuncNameWithoutPrefix(), getMipsABI(), llvm::TargetLoweringObjectFileGOFF::getModuleMetadata(), llvm::object::getNameType(), getNextDBDirName(), llvm::MCContext::getOrCreateSymbol(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::Triple::getOSVersion(), getPointeeTypeByCallInst(), llvm::SPIRVTargetLowering::getRegForInlineAsmConstraint(), llvm::SystemZTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(), llvm::yaml::Node::getVerbatimTag(), llvm::MVT::getVT(), globalVariableNeedsRedirect(), hasAnyUnrollPragma(), llvm::memprof::YAMLMemProfReader::hasFormat(), llvm::mustache::hasTextAhead(), llvm::HexagonSubtarget::initializeSubtargetDependencies(), llvm::LTOModule::isBitcodeForTarget(), llvm::orc::isCOFFInitializerSection(), isDebugSection(), llvm::objcopy::coff::isDebugSection(), llvm::objcopy::wasm::isDebugSection(), llvm::object::isDecorated(), llvm::objcopy::wasm::isLinkerSection(), llvm::yaml::isNumeric(), llvm::MachO::isPrivateLibrary(), llvm::objcopy::macho::SymbolEntry::isSwiftSymbol(), llvm::LoongArch::isValidFeatureName(), llvm::SPIRV::lookupBuiltinNameHelper(), llvm::makeFollowupLoopID(), llvm::makePostTransformationMetadata(), matchOption(), llvm::Triple::normalize(), optimizeDoubleFP(), llvm::parseAnalysisUtilityPasses(), parseArch(), llvm::ARM::parseArchEndian(), llvm::RISCVISAInfo::parseArchString(), parseARMArch(), llvm::SPIRV::parseBuiltinTypeNameToTargetExtType(), llvm::DebugCounter::parseChunks(), ParseLine(), parseMaybeMangledName(), llvm::AArch64::ExtensionSet::parseModifier(), llvm::Pattern::parsePattern(), parseSubArch(), parseSVERegAsConstraint(), llvm::MachO::parseSymbol(), parseThunkName(), processGlobal(), llvm::RuntimeDyldCOFFAArch64::processRelocationRef(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::pruneCache(), llvm::lsp::JSONTransportInputOverFile::readDelimitedMessage(), llvm::object::replace(), replaceAndRemoveSections(), llvm::SimplifyTypeTestsPass::run(), llvm::ThunkInserter< Derived, InsertedThunksTy >::run(), llvm::runFuzzerOnInputs(), llvm::sampleprof::SampleContext::SampleContext(), llvm::pdb::NativeSession::searchForPdb(), llvm::HexagonTargetObjectFile::SelectSectionForGlobal(), llvm:🆑:Option::setArgStr(), shouldCheckArgs(), llvm::SmallString< 0 >::starts_with(), llvm::mustache::stripTokenAhead(), llvm::mustache::tokenize(), llvm::orc::DLLImportDefinitionGenerator::tryToGenerate(), updateAndRemoveSymbols(), upgradeLoopTag(), and llvm::gsym::DwarfTransformer::verify().

starts_with_insensitive()

bool StringRef::starts_with_insensitive ( StringRef Prefix) const nodiscard

str()

std::string llvm::StringRef::str ( ) const inlinenodiscard

str - Get the contents as an std::string.

Definition at line 225 of file StringRef.h.

References data, and size().

Referenced by llvm::vfs::InMemoryFileSystem::addHardLink(), llvm::DCData::addSuccessorLabel(), buildFrameDebugInfo(), llvm::cacheAnnotationFromMD(), checkOperandCount(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::orc::DylibSubstitutor::configure(), constructSymbolEntry(), convertSRPoints(), llvm::TextEncodingConverter::create(), llvm::Hexagon_MC::createHexagonMCSubtargetInfo(), llvm::orc::StaticLibraryDefinitionGenerator::createMemberBuffer(), createMergedFunction(), decodeError(), llvm::objcopy::dxbc::dumpPartToFile(), dumpSectionToFile(), dumpSectionToFile(), llvm::objcopy::wasm::dumpSectionToFile(), llvm::emitAMDGPUPrintfCall(), llvm::objcopy::macho::executeObjcopyOnBinary(), llvm::objcopy::macho::executeObjcopyOnMachOUniversalBinary(), llvm::mir2vec::MIRVocabulary::extractBaseOpcodeName(), llvm::object::OffloadBundleFatBin::extractBundle(), llvm::CodeExtractor::extractCodeRegion(), llvm::object::extractOffloadBundleByURI(), llvm::objcopy::dxbc::extractPartAsObject(), llvm::object::MachOObjectFile::findDsymObjectMembers(), findSection(), llvm::lsp::URIForFile::fromURI(), llvm::generateSampleImageInst(), llvm::DiagnosticLocation::getAbsolutePath(), llvm::RecordKeeper::getAllDerivedDefinitions(), llvm::DWARFFormValue::getAsCString(), llvm::Attribute::getAsString(), llvm::bfi_detail::getBlockName(), llvm::mir2vec::MIRVocabulary::getCanonicalIndexForBaseName(), llvm::pdb::NativeSourceFile::getChecksum(), getExtensionVersion(), llvm::DOTGraphTraits< DOTFuncInfo * >::getGraphName(), llvm::DOTGraphTraits< DOTFuncMSSAInfo * >::getGraphName(), llvm::DOTGraphTraits< DOTMachineFuncInfo * >::getGraphName(), getHighestNumericTupleInDirectory(), llvm::vfs::File::getName(), getNewName(), llvm::DOTGraphTraits< AttributorCallGraph * >::getNodeLabel(), llvm::SDNode::getOperationName(), llvm::symbolize::LLVMSymbolizer::getOrCreateModuleInfo(), llvm::SPIRVGlobalRegistry::getOrCreateSPIRVTypeByName(), llvm::getPGOFuncName(), getQualifiedNameIndex(), llvm::pdb::PDBSymbolCompiland::getSourceFileName(), llvm::getStringValueFromReg(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::CSKYTargetMachine::getSubtargetImpl(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::LoongArchTargetMachine::getSubtargetImpl(), llvm::M68kTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::RISCVTargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::SystemZTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::XtensaTargetMachine::getSubtargetImpl(), llvm::getSymbolicOperandMnemonic(), llvm::dwarf_linker::classic::CompileUnit::getSysRoot(), llvm::object::IRObjectFile::getTargetTriple(), llvm::objcopy::coff::handleArgs(), llvm::RISCVISAInfo::hasExtension(), llvm::orc::LibraryPathCache::hasSeenOrMark(), INITIALIZE_PASS(), llvm::M68kSubtarget::initializeSubtargetDependencies(), llvm::orc::LibraryResolver::SymbolQuery::isResolved(), llvm::lookupPGONameFromMetadata(), llvm::SPIRV::lowerBuiltinType(), llvm::XtensaTargetLowering::LowerCall(), mangleCoveragePath(), llvm::yaml::MappingTraits< const InterfaceFile * >::NormalizedTBD::NormalizedTBD(), llvm::vfs::RedirectingFileSystem::openFileForRead(), llvm::orc::LoadAndLinkDynLibrary::operator()(), llvm::objcopy:🧝:OwnedDataSection::OwnedDataSection(), llvm:🆑:parser< std::optional< std::string > >::parse(), llvm:🆑:parser< std::string >::parse(), llvm::SPIRVExtensionsParser::parse(), llvm::MachO::parseAliasList(), llvm::RISCVISAInfo::parseArchString(), parseBraceExpansions(), llvm::SPIRV::parseBuiltinCallArgumentType(), parseDebugType(), parseIRConstant(), llvm::RISCVISAInfo::parseNormalizedArchString(), llvm::dwarf::parseRows(), llvm::omp::prettifyFunctionName(), llvm::MCDecodedPseudoProbe::print(), llvm::jitlink::printSymbolEntry(), processConstantStringArg(), llvm::lsp::JSONTransportInputOverFile::readDelimitedMessage(), replaceWithCallToVeclib(), llvm::logicalview::LVScopeArray::resolveExtra(), llvm::DroppedVariableStatsMIR::runAfterPass(), llvm::PseudoProbeVerifier::runAfterPass(), runImpl(), llvm::IRSimilarity::IRInstructionData::setCalleeName(), llvm::MCContext::setCompilationDir(), llvm::setKCFIType(), llvm::VPInstruction::setName(), llvm::vfs::YAMLVFSWriter::setOverlayDir(), llvm::vfs::RedirectingFileSystem::setOverlayFileDir(), setSocketAddr(), smallData(), llvm::SPIRVTranslate(), llvm::Twine::str(), llvm::orc::DylibSubstitutor::substitute(), suffixed_name_or(), llvm::timeTraceProfilerWrite(), llvm::symbolize::toJSON(), uriFromAbsolutePath(), llvm::write(), writeListEntryAddress(), and writeTimestampFile().

substr()

StringRef llvm::StringRef::substr ( size_t Start, size_t N = npos ) const inlinenodiscardconstexpr

Return a reference to the substring from [Start, Start + N).

Parameters

Start The index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned.
N The number of characters to included in the substring. If N exceeds the number of characters remaining in the string, the string suffix (starting with Start) will be returned.

Definition at line 573 of file StringRef.h.

References data, N, npos, size(), and StringRef().

Referenced by llvm::DWARFTypePrinter< DieType >::appendTypeTagName(), llvm::object::applyNameType(), llvm::FileCheckString::Check(), llvm::FileCheckString::CheckDag(), llvm::FileCheck::checkInput(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::cloneAndEmitDebugFrame(), CommaSeparateAndAddOccurrence(), llvm::consumeUnsignedInteger(), llvm::GlobPattern::create(), llvm::sampleprof::SampleContext::createCtxVectorFromStr(), llvm::object::CompressedOffloadBundle::decompress(), llvm::FileCheckPatternContext::defineCmdlineVariables(), llvm::ELFYAML::dropUniqueSuffix(), llvm::SystemZHLASMAsmStreamer::EmitComment(), emitComments(), llvm::AsmPrinter::emitPCSections(), emitPPA1Name(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::ELFObjectWriter::executePostLayoutBinding(), expand(), ExpandBasePaths(), llvm::sys::path::extension(), find_insensitive(), FindFirstMatchingPrefix(), llvm::MCJIT::findModuleForSymbol(), llvm::format_provider< T, std::enable_if_t< support::detail::use_string_formatter< T >::value > >::format(), llvm::JITSymbolFlags::fromGlobalValue(), getAbsolutePath(), getAllDBDirs(), llvm::object::MachOUniversalBinary::ObjectForArch::getAsArchive(), llvm::object::MachOUniversalBinary::ObjectForArch::getAsIRObject(), llvm::object::MachOUniversalBinary::ObjectForArch::getAsObjectFile(), llvm::sampleprof::FunctionSamples::getCanonicalFnName(), llvm::getConstantStringInfo(), llvm::TargetLowering::getConstraintType(), llvm::gsym::GsymReader::getFunctionInfoDataAtIndex(), getHexUint(), llvm::sys::detail::getHostCPUNameForRISCV(), getLiteralSectionName(), llvm::TargetLoweringObjectFileGOFF::getModuleMetadata(), getNextDBDirName(), getOpEnabled(), getOpRefinementSteps(), llvm::SPIRVGlobalRegistry::getOrCreateSPIRVTypeByName(), llvm::Triple::getOSVersion(), llvm::object::DirectX::RootSignature::getParameter(), getQualifiedNameIndex(), getStringIndex(), llvm::object::MachOObjectFile::getStringTableData(), llvm::RISCVISAInfo::getTargetFeatureForExtension(), getVarName(), llvm::yaml::Node::getVerbatimTag(), llvm::object::MachOObjectFile::guessLibraryShortName(), HandlePrefixedOrGroupedOption(), llvm::object::DirectX::Signature::initialize(), llvm::isSpecialPass(), llvm::RISCVISAInfo::isSupportedExtensionWithVersion(), llvm::object::Lexer::lex(), llvm::SPIRV::lookupBuiltinNameHelper(), llvm::MCGenDwarfLabelEntry::Make(), matchOption(), llvm::objcopy:🧝:IHexRecord::parse(), llvm::object::DirectX::PSVRuntimeInfo::parse(), llvm::SPIRVExtensionsParser::parse(), llvm::parseAnalysisUtilityPasses(), llvm::RISCVISAInfo::parseArchString(), llvm::yaml::Document::parseBlockNode(), parseBraceExpansions(), llvm::SPIRV::parseBuiltinCallArgumentType(), llvm::SPIRV::parseBuiltinTypeNameToTargetExtType(), llvm::dwarf_linker::parseDebugTableName(), parseDebugType(), parseFilePathFromURI(), parseInt(), ParseLine(), llvm::RISCVISAInfo::parseNormalizedArchString(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), parseScalarValue(), parseSVERegAsConstraint(), llvm::Pattern::printFuzzyMatch(), llvm::FileCheck::readCheckFile(), llvm::GCOVBuffer::readGCDAFormat(), llvm::GCOVBuffer::readGCNOFormat(), llvm::TextInstrProfReader::readHeader(), llvm::object::replace(), llvm::sys::path::replace_path_prefix(), rfind_insensitive(), llvm::SimplifyTypeTestsPass::run(), split(), split(), splitLiteralAndReplacement(), llvm::sys::path::stem(), llvm::streamFile(), llvm::StrInStrNoCase(), llvm::stripDirPrefix(), llvm::SubtargetFeatures::StripFlag(), llvm::mustache::stripTokenAhead(), llvm::Regex::sub(), llvm::SmallString< 0 >::substr(), llvm::BTFParser::symbolize(), llvm::mustache::Token::Token(), llvm::VersionTuple::tryParse(), llvm::UpgradeSectionAttributes(), llvm::object::WasmObjectFile::WasmObjectFile(), and llvm::write().

take_back()

StringRef llvm::StringRef::take_back ( size_t N = 1) const inlinenodiscard

take_front()

StringRef llvm::StringRef::take_front ( size_t N = 1) const inlinenodiscard

Return a StringRef equal to 'this' but with only the first N elements remaining.

If N is greater than the length of the string, the entire string is returned.

Definition at line 582 of file StringRef.h.

References drop_back(), N, size(), and StringRef().

Referenced by llvm::json::abbreviate(), llvm::objcopy:🧝:OwnedDataSection::appendHexData(), compare_insensitive(), emitNullTerminatedSymbolName(), llvm::objcopy:🧝:IHexRecord::getChecksum(), llvm::getObjCNamesIfSelector(), llvm::ThreadSafeTrieRawHashMapBase::getTriePrefixAsString(), llvm::TextCodeGenDataReader::hasFormat(), mapNameAndUniqueName(), maxPlainSubstring(), llvm::RISCVISAInfo::parseArchString(), parseDebugType(), llvm::Pattern::parseNumericSubstitutionBlock(), parseScalarValue(), llvm::GlobPattern::prefix(), llvm::sys::path::remove_dots(), splitLiteralAndReplacement(), starts_with_insensitive(), llvm::symbolize::takeTo(), and tryParseISA().

take_until()

take_while()

trim() [1/2]

StringRef llvm::StringRef::trim ( char Char) const inlinenodiscard

Return string with consecutive Char characters starting from the left and right removed.

Definition at line 816 of file StringRef.h.

References ltrim(), and StringRef().

Referenced by llvm::MachO::TextAPIReader::canRead(), llvm::RuntimeDyldCheckerImpl::check(), llvm::logicalview::LVBinaryReader::createInstructions(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::DataExtractor::getFixedLengthString(), llvm::NVPTXTTIImpl::getInstructionCost(), llvm::MachO::parseAliasList(), llvm::Pattern::parseNumericSubstitutionBlock(), parseReplacementItem(), llvm::lsp::JSONTransportInputOverFile::readStandardMessage(), llvm::mustache::tokenize(), upgradeNVVMFnVectorAttr(), and usesTriple().

trim() [2/2]

Return string with consecutive characters in Chars starting from the left and right removed.

Definition at line 822 of file StringRef.h.

References ltrim(), and StringRef().

upper()

std::string StringRef::upper ( ) const nodiscard

npos

size_t llvm::StringRef::npos = ~size_t(0) staticconstexpr

Definition at line 57 of file StringRef.h.

Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::DWARFTypePrinter< DieType >::appendUnqualifiedNameBefore(), buildFixItLine(), llvm::FileCheckString::Check(), llvm::FileCheckString::CheckDag(), checkIfSupported(), llvm::FileCheck::checkInput(), CommaSeparateAndAddOccurrence(), contains(), contains(), contains_insensitive(), contains_insensitive(), count(), llvm::sys::fs::createTemporaryFile(), llvm::omp::deconstructOpenMPKernelName(), llvm::FileCheckPatternContext::defineCmdlineVariables(), detectEOL(), llvm::ELFYAML::dropUniqueSuffix(), llvm::object::Archive::ec_symbols(), llvm::ELFObjectWriter::executePostLayoutBinding(), ExpandBasePaths(), llvm::sys::path::extension(), extractOffloadBundle(), find(), find_first_not_of(), find_first_of(), find_if(), find_insensitive(), find_last_not_of(), find_last_not_of(), llvm::SmallString< 0 >::find_last_of(), llvm::SmallString< 0 >::find_last_of(), find_last_of(), find_last_of(), llvm::SourceMgr::FindLocForLineAndColumn(), llvm::format_provider< T, std::enable_if_t< support::detail::use_string_formatter< T >::value > >::format(), llvm::symbolize::SourceCode::format(), llvm::ARM::getCanonicalArchName(), llvm::sampleprof::FunctionSamples::getCanonicalFnName(), llvm::DataExtractor::getCStrRef(), llvm::sys::detail::getHostCPUNameForS390x(), getInstrStrFromOpNo(), llvm::SourceMgr::getLineAndColumn(), llvm::object::ArchiveMemberHeader::getName(), llvm::getObjCNamesIfSelector(), llvm::object::ArchiveMemberHeader::getRawName(), getTypeNamePrefix(), llvm::object::MachOObjectFile::guessLibraryShortName(), llvm::Regex::isLiteralERE(), llvm::yaml::isNumeric(), llvm::isSpecialPass(), locateCStrings(), lookupLLVMIntrinsicByName(), llvm::Pattern::match(), PrefixMatcher::match(), llvm::sys::path::reverse_iterator::operator++(), llvm::sys::path::parent_path(), llvm::SPIRV::parseBuiltinTypeStr(), parseDebugType(), parseFilePathFromURI(), ParseLine(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), parseRefinementStep(), parseScalarValue(), parseTypeCountMap(), llvm::sys::printArg(), llvm::Pattern::printFuzzyMatch(), printSourceLine(), llvm::BinaryStreamReader::readCString(), llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::orc::PathResolver::realpathCached(), llvm::sys::path::remove_dots(), llvm::sys::path::remove_filename(), llvm::object::replace(), llvm::sys::path::replace_extension(), llvm::SmallString< 0 >::rfind(), rfind(), rfind_insensitive(), rfind_insensitive(), rsplit(), llvm::serializeValueProfRecordFrom(), singleLetterExtensionRank(), split(), split(), split(), splitLiteralAndReplacement(), splitUstar(), llvm::sys::path::stem(), llvm::StrInStrNoCase(), llvm::Regex::sub(), llvm::SmallString< 0 >::substr(), substr(), llvm::ifs::terminatedSubstr(), llvm::mustache::tokenize(), llvm::UpgradeDataLayoutString(), and llvm::mustache::EscapeStringStream::write_impl().


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