LLVM
15.0.0git
|
StringRef - Represent a constant reference to a string, i.e. More...
#include "llvm/ADT/StringRef.h"
Public Types | |
using | iterator = const char * |
using | const_iterator = const char * |
using | size_type = size_t |
Public Member Functions | |
Constructors | |
StringRef ()=default | |
Construct an empty string ref. More... | |
StringRef (std::nullptr_t)=delete | |
Disable conversion from nullptr. More... | |
constexpr | StringRef (const char *Str) |
Construct a string ref from a cstring. More... | |
constexpr | StringRef (const char *data, size_t length) |
Construct a string ref from a pointer and length. More... | |
StringRef (const std::string &Str) | |
Construct a string ref from an std::string. More... | |
Iterators | |
iterator | begin () const |
iterator | end () const |
const unsigned char * | bytes_begin () const |
const unsigned char * | bytes_end () const |
iterator_range< const unsigned char * > | bytes () const |
String Operations | |
const LLVM_NODISCARD char * | data () const |
data - Get a pointer to the start of the string (which may not be null terminated). More... | |
constexpr LLVM_NODISCARD bool | empty () const |
empty - Check if the string is empty. More... | |
constexpr LLVM_NODISCARD size_t | size () const |
size - Get the string size. More... | |
LLVM_NODISCARD char | front () const |
front - Get the first character in the string. More... | |
LLVM_NODISCARD char | back () const |
back - Get the last character in the string. More... | |
template<typename Allocator > | |
LLVM_NODISCARD StringRef | copy (Allocator &A) const |
LLVM_NODISCARD bool | equals (StringRef RHS) const |
equals - Check for string equality, this is more efficient than compare() when the relative ordering of inequal strings isn't needed. More... | |
LLVM_NODISCARD bool | equals_insensitive (StringRef RHS) const |
Check for string equality, ignoring case. More... | |
LLVM_NODISCARD int | compare (StringRef RHS) const |
compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than, equal to, or greater than the RHS . More... | |
LLVM_NODISCARD int | compare_insensitive (StringRef RHS) const |
Compare two strings, ignoring case. More... | |
LLVM_NODISCARD int | compare_numeric (StringRef RHS) const |
compare_numeric - Compare two strings, treating sequences of digits as numbers. More... | |
LLVM_NODISCARD unsigned | edit_distance (StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const |
Determine the edit distance between this string and another string. More... | |
LLVM_NODISCARD unsigned | edit_distance_insensitive (StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const |
LLVM_NODISCARD std::string | str () const |
str - Get the contents as an std::string. More... | |
LLVM_NODISCARD std::string | lower () const |
LLVM_NODISCARD std::string | upper () const |
Convert the given ASCII string to uppercase. More... | |
Operator Overloads | |
LLVM_NODISCARD 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. More... | |
Type Conversions | |
operator std::string () const | |
String Predicates | |
LLVM_NODISCARD bool | startswith (StringRef Prefix) const |
Check if this string starts with the given Prefix . More... | |
LLVM_NODISCARD bool | startswith_insensitive (StringRef Prefix) const |
Check if this string starts with the given Prefix , ignoring case. More... | |
LLVM_NODISCARD bool | endswith (StringRef Suffix) const |
Check if this string ends with the given Suffix . More... | |
LLVM_NODISCARD bool | endswith_insensitive (StringRef Suffix) const |
Check if this string ends with the given Suffix , ignoring case. More... | |
String Searching | |
LLVM_NODISCARD size_t | find (char C, size_t From=0) const |
Search for the first character C in the string. More... | |
LLVM_NODISCARD size_t | find_insensitive (char C, size_t From=0) const |
Search for the first character C in the string, ignoring case. More... | |
LLVM_NODISCARD size_t | find_if (function_ref< bool(char)> F, size_t From=0) const |
Search for the first character satisfying the predicate F . More... | |
LLVM_NODISCARD 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 . More... | |
LLVM_NODISCARD size_t | find (StringRef Str, size_t From=0) const |
Search for the first string Str in the string. More... | |
LLVM_NODISCARD size_t | find_insensitive (StringRef Str, size_t From=0) const |
Search for the first string Str in the string, ignoring case. More... | |
LLVM_NODISCARD size_t | rfind (char C, size_t From=npos) const |
Search for the last character C in the string. More... | |
LLVM_NODISCARD size_t | rfind_insensitive (char C, size_t From=npos) const |
Search for the last character C in the string, ignoring case. More... | |
LLVM_NODISCARD size_t | rfind (StringRef Str) const |
Search for the last string Str in the string. More... | |
LLVM_NODISCARD size_t | rfind_insensitive (StringRef Str) const |
Search for the last string Str in the string, ignoring case. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD bool | contains (StringRef Other) const |
Return true if the given string is a substring of *this, and false otherwise. More... | |
LLVM_NODISCARD bool | contains (char C) const |
Return true if the given character is contained in *this, and false otherwise. More... | |
LLVM_NODISCARD bool | contains_insensitive (StringRef Other) const |
Return true if the given string is a substring of *this, and false otherwise. More... | |
LLVM_NODISCARD bool | contains_insensitive (char C) const |
Return true if the given character is contained in *this, and false otherwise. More... | |
Helpful Algorithms | |
LLVM_NODISCARD size_t | count (char C) const |
Return the number of occurrences of C in the string. More... | |
size_t | count (StringRef Str) const |
Return the number of non-overlapped occurrences of Str in the string. More... | |
template<typename T > | |
std::enable_if_t< std::numeric_limits< T >::is_signed, bool > | getAsInteger (unsigned Radix, T &Result) const |
Parse the current string as an integer of the specified radix. More... | |
template<typename T > | |
std::enable_if_t<!std::numeric_limits< T >::is_signed, bool > | getAsInteger (unsigned Radix, T &Result) const |
template<typename T > | |
std::enable_if_t< std::numeric_limits< T >::is_signed, bool > | consumeInteger (unsigned Radix, T &Result) |
Parse the current string as an integer of the specified radix. More... | |
template<typename T > | |
std::enable_if_t<!std::numeric_limits< T >::is_signed, bool > | consumeInteger (unsigned Radix, T &Result) |
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. More... | |
bool | getAsDouble (double &Result, bool AllowInexact=true) const |
Parse the current string as an IEEE double-precision floating point value. More... | |
Substring Operations | |
LLVM_NODISCARD StringRef | substr (size_t Start, size_t N=npos) const |
Return a reference to the substring from [Start, Start + N). More... | |
LLVM_NODISCARD StringRef | take_front (size_t N=1) const |
Return a StringRef equal to 'this' but with only the first N elements remaining. More... | |
LLVM_NODISCARD StringRef | take_back (size_t N=1) const |
Return a StringRef equal to 'this' but with only the last N elements remaining. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD StringRef | drop_front (size_t N=1) const |
Return a StringRef equal to 'this' but with the first N elements dropped. More... | |
LLVM_NODISCARD StringRef | drop_back (size_t N=1) const |
Return a StringRef equal to 'this' but with the last N elements dropped. More... | |
LLVM_NODISCARD 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. More... | |
LLVM_NODISCARD 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. More... | |
bool | consume_front (StringRef Prefix) |
Returns true if this StringRef has the given prefix and removes that prefix. More... | |
bool | consume_front_insensitive (StringRef Prefix) |
Returns true if this StringRef has the given prefix, ignoring case, and removes that prefix. More... | |
bool | consume_back (StringRef Suffix) |
Returns true if this StringRef has the given suffix and removes that suffix. More... | |
bool | consume_back_insensitive (StringRef Suffix) |
Returns true if this StringRef has the given suffix, ignoring case, and removes that suffix. More... | |
LLVM_NODISCARD StringRef | slice (size_t Start, size_t End) const |
Return a reference to the substring from [Start, End). More... | |
LLVM_NODISCARD std::pair< StringRef, StringRef > | split (char Separator) const |
Split into two substrings around the first occurrence of a separator character. More... | |
LLVM_NODISCARD std::pair< StringRef, StringRef > | split (StringRef Separator) const |
Split into two substrings around the first occurrence of a separator string. More... | |
LLVM_NODISCARD std::pair< StringRef, StringRef > | rsplit (StringRef Separator) const |
Split into two substrings around the last occurrence of a separator string. More... | |
void | split (SmallVectorImpl< StringRef > &A, StringRef Separator, int MaxSplit=-1, bool KeepEmpty=true) const |
Split into substrings around the occurrences of a separator string. More... | |
void | split (SmallVectorImpl< StringRef > &A, char Separator, int MaxSplit=-1, bool KeepEmpty=true) const |
Split into substrings around the occurrences of a separator character. More... | |
LLVM_NODISCARD std::pair< StringRef, StringRef > | rsplit (char Separator) const |
Split into two substrings around the last occurrence of a separator character. More... | |
LLVM_NODISCARD StringRef | ltrim (char Char) const |
Return string with consecutive Char characters starting from the the left removed. More... | |
LLVM_NODISCARD StringRef | ltrim (StringRef Chars=" \t\n\v\f\r") const |
Return string with consecutive characters in Chars starting from the left removed. More... | |
LLVM_NODISCARD StringRef | rtrim (char Char) const |
Return string with consecutive Char characters starting from the right removed. More... | |
LLVM_NODISCARD StringRef | rtrim (StringRef Chars=" \t\n\v\f\r") const |
Return string with consecutive characters in Chars starting from the right removed. More... | |
LLVM_NODISCARD StringRef | trim (char Char) const |
Return string with consecutive Char characters starting from the left and right removed. More... | |
LLVM_NODISCARD StringRef | trim (StringRef Chars=" \t\n\v\f\r") const |
Return string with consecutive characters in Chars starting from the left and right removed. More... | |
LLVM_NODISCARD StringRef | detectEOL () const |
Detect the line ending style of the string. More... | |
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 58 of file StringRef.h.
using llvm::StringRef::const_iterator = const char * |
Definition at line 63 of file StringRef.h.
using llvm::StringRef::iterator = const char * |
Definition at line 62 of file StringRef.h.
using llvm::StringRef::size_type = size_t |
Definition at line 64 of file StringRef.h.
|
default |
Construct an empty string ref.
|
delete |
Disable conversion from nullptr.
This prevents things like if (S == nullptr)
|
inlineconstexpr |
Construct a string ref from a cstring.
Definition at line 107 of file StringRef.h.
Construct a string ref from a pointer and length.
Definition at line 111 of file StringRef.h.
|
inline |
Construct a string ref from an std::string.
Definition at line 115 of file StringRef.h.
|
inline |
back - Get the last character in the string.
Definition at line 168 of file StringRef.h.
References assert(), llvm::Data, and llvm::empty().
Referenced by llvm::opt::OptTable::findNearest(), getQualifiedNameIndex(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), handleCompressedSection(), llvm::ChangeReporter< IRDataT< EmptyData > >::handleIRAfterPass(), optimizeDoubleFP(), llvm::Pattern::parsePattern(), and llvm::sampleprof::SampleProfileReaderExtBinaryBase::readStringFromTable().
|
inline |
Definition at line 128 of file StringRef.h.
References llvm::Data.
Referenced by llvm::MDString::begin(), llvm::yaml::BlockScalarNode::BlockScalarNode(), chopOneUTF32(), llvm::detail::IEEEFloat::convertFromString(), llvm::convertUTF8ToUTF16String(), decodeUTF8(), llvm::APInt::getBitsNeeded(), llvm::sys::detail::getHostCPUNameForPowerPC(), getHostID(), llvm::object::Archive::Symbol::getName(), llvm::object::Archive::getNumberOfSymbols(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::getRecords(), llvm::object::WasmObjectFile::getRelocationTypeName(), llvm::object::MachOObjectFile::getRelocationTypeName(), llvm::object::XCOFFObjectFile::getRelocationTypeName(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::yaml::ScalarNode::getValue(), llvm::TextInstrProfReader::hasFormat(), llvm::Timer::init(), llvm::TGLexer::Lex(), llvm::pdb::NamedStreamMap::load(), llvm::MIToken::location(), lower(), llvm::sys::fs::make_absolute(), makeAbsolute(), mangleCoveragePath(), llvm::symbolize::MarkupParser::nextNode(), llvm::object::MachOUniversalBinary::ObjectForArch::ObjectForArch(), llvm::SmallString< 256 >::operator+=(), llvm::object::Archive::Child::operator==(), llvm::RISCVISAInfo::parseArchString(), llvm::InlineAsm::ParseConstraints(), parseMaybeMangledName(), readInteger(), readStruct(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::reconstituteName(), llvm::sys::path::replace_extension(), llvm::yaml::ScalarNode::ScalarNode(), llvm::AsmLexer::setBuffer(), llvm::EngineBuilder::setMArch(), llvm::EngineBuilder::setMCPU(), llvm::TimerGroup::setName(), llvm::sys::unicode::startsWith(), llvm::object::Archive::symbol_begin(), llvm::TGLexer::TGLexer(), and upper().
|
inline |
Definition at line 138 of file StringRef.h.
References llvm::make_range().
Referenced by llvm::djbHash().
|
inline |
Definition at line 132 of file StringRef.h.
References llvm::sys::path::begin().
Referenced by llvm::object::ELFFile< ELFT >::base(), llvm::MDString::bytes_begin(), loadObj(), llvm::xray::readBinaryFormatHeader(), llvm::readPGOFuncNameStrings(), and llvm::orc::ELFDebugObjectSection< ELFT >::validateInBounds().
|
inline |
Definition at line 135 of file StringRef.h.
References llvm::sys::path::end().
Referenced by llvm::MDString::bytes_end(), loadObj(), and llvm::readPGOFuncNameStrings().
|
inline |
compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than, equal to, or greater than the RHS
.
Definition at line 201 of file StringRef.h.
References llvm::Data, llvm::min(), and RHS.
Referenced by llvm::FunctionComparator::cmpMem(), llvm::SmallString< 256 >::compare(), compareNames(), llvm::sampleprof::SampleContext::operator<(), and SortSymbolPair().
Compare two strings, ignoring case.
Definition at line 37 of file StringRef.cpp.
References ascii_strncasecmp(), llvm::min(), and RHS.
Referenced by llvm::SmallString< 256 >::compare_insensitive(), gsiRecordCmp(), and llvm::DetectRoundChange::runOnMachineFunction().
compare_numeric - Compare two strings, treating sequences of digits as numbers.
compare_numeric - Compare strings, handle embedded numbers.
Definition at line 61 of file StringRef.cpp.
References E, I, isDigit(), llvm::min(), and RHS.
Referenced by llvm::SmallString< 256 >::compare_numeric(), and llvm::LessRecord::operator()().
|
inline |
Returns true if this StringRef has the given suffix and removes that suffix.
Definition at line 706 of file StringRef.h.
References size().
Referenced by llvm::VFABI::tryDemangleForVFABI().
|
inline |
Returns true if this StringRef has the given suffix, ignoring case, and removes that suffix.
Definition at line 716 of file StringRef.h.
References size().
|
inline |
Returns true if this StringRef has the given prefix and removes that prefix.
Definition at line 686 of file StringRef.h.
References llvm::cl::Prefix, and startswith().
Referenced by llvm::Annotations::Annotations(), llvm::Triple::getOSVersion(), llvm::orc::ELFNixPlatform::isInitializerSection(), llvm::RISCVISAInfo::parseArchString(), parseMagic(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::MCContext::setGenDwarfRootFile(), and llvm::VFABI::tryDemangleForVFABI().
|
inline |
Returns true if this StringRef has the given prefix, ignoring case, and removes that prefix.
Definition at line 696 of file StringRef.h.
References llvm::cl::Prefix.
|
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 548 of file StringRef.h.
References llvm::consumeSignedInteger(), and T.
Referenced by llvm::formatv_object_base::consumeFieldLayout(), llvm::HexagonSubtarget::initializeSubtargetDependencies(), llvm::yaml::ScalarTraits< FrameIndex >::input(), llvm::Pattern::parseNumericSubstitutionBlock(), and llvm::formatv_object_base::parseReplacementItem().
|
inline |
Definition at line 559 of file StringRef.h.
References llvm::consumeUnsignedInteger(), and T.
|
inline |
Return true if the given character is contained in *this, and false otherwise.
Definition at line 471 of file StringRef.h.
|
inline |
Return true if the given string is a substring of *this, and false otherwise.
Definition at line 466 of file StringRef.h.
References llvm::find(), and Other.
Referenced by llvm::Hexagon_MC::addArchSubtarget(), llvm::object::getNameType(), llvm::AMDGPU::HSAMD::MetadataStreamerV3::getValueKind(), llvm::object::isDecorated(), isSmallDataSection(), llvm::gsym::operator<<(), llvm::RISCVISAInfo::parseArchString(), llvm::Pattern::parsePattern(), sanitizeFunctionName(), and usesTriple().
|
inline |
Return true if the given character is contained in *this, and false otherwise.
Definition at line 483 of file StringRef.h.
|
inline |
Return true if the given string is a substring of *this, and false otherwise.
Definition at line 476 of file StringRef.h.
References Other.
|
inline |
Definition at line 175 of file StringRef.h.
References llvm::sys::path::begin(), copy, llvm::empty(), llvm::sys::path::end(), and S.
Referenced by llvm::yaml::Document::parseBlockNode().
|
inline |
Return the number of occurrences of C
in the string.
Definition at line 493 of file StringRef.h.
References llvm::Data, llvm::numbers::e, and i.
Referenced by llvm::SmallString< 256 >::count(), llvm::HexagonInstrInfo::getInlineAsmLength(), and llvm::yaml::MappingTraits< Argument >::mapping().
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 371 of file StringRef.cpp.
References llvm::numbers::e, equals(), i, N, and substr().
|
inline |
data - Get a pointer to the start of the string (which may not be null terminated).
Definition at line 149 of file StringRef.h.
References llvm::Data.
Referenced by annotateAllFunctions(), llvm::sys::unicode::columnWidthUTF8(), constructSegment(), constructSymbolEntry(), llvm::objcopy::coff::createGnuDebugLinkSectionContents(), llvm::jitlink::createLinkGraphFromELFObject(), llvm::DWARFDebugPubTable::dump(), llvm::DWARFListTableHeader::dump(), edit_distance(), edit_distance_insensitive(), llvm::DIEAbbrev::Emit(), llvm::BitstreamWriter::emitBlob(), llvm::DWARFYAML::emitDebugAbbrev(), llvm::DWARFYAML::emitDebugLine(), llvm::InstrProfRecordWriterTrait::EmitKey(), llvm::RuntimeDyldImpl::emitSection(), llvm::cl::Option::error(), ExpandBasePaths(), ExpandResponseFile(), llvm::DWARFListType< RangeListEntry >::extract(), llvm::RuntimeDyldCOFFAArch64::generateRelocationStub(), llvm::RuntimeDyldCOFFX86_64::generateRelocationStub(), llvm::irsymtab::storage::Str::get(), llvm::irsymtab::storage::Range< llvm::irsymtab::storage::Comdat >::get(), llvm::ErrorDiagnostic::get(), llvm::DataExtractor::getCStr(), llvm::AsmToken::getEndLoc(), llvm::HexagonInstrInfo::getInlineAsmLength(), getInstructionID(), llvm::AsmToken::getLoc(), llvm::DWARFDie::getLocations(), getMemBufferCopyImpl(), llvm::object::ArchiveMemberHeader::getName(), llvm::GCOVFunction::getName(), llvm::object::Elf_Sym_Impl< ELFT >::getName(), llvm::object::BigArchiveMemberHeader::getNextChildLoc(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::object::ArchiveMemberHeader::getRawName(), llvm::object::BigArchiveMemberHeader::getRawName(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::PPCTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::RuntimeDyldMachO::getRelocationValueRef(), llvm::object::ELFFile< ELFT >::getSectionName(), getUUID(), gsiRecordCmp(), isAsmComment(), LLVMGetNamedMetadataName(), llvm::VETargetLowering::LowerCustomJumpTableEntry(), llvm::LegalizerHelper::lowerReadWriteRegister(), llvm::remarks::magicToFormat(), llvm::sys::path::native(), llvm::MCJIT::notifyFreeingObject(), llvm::MCJIT::notifyObjectLoaded(), llvm::SourceMgr::OpenIncludeFile(), llvm::remarks::ParsedStringTable::operator[](), llvm::remarks::ParsedStringTable::ParsedStringTable(), llvm::remarks::parseFormat(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), parseRD(), parseStrTab(), parseStrTabSize(), parseTypeIdSummaryRecord(), parseVersion(), parseWholeProgramDevirtResolution(), llvm::X86Operand::print(), llvm::BitcodeAnalyzer::printStats(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::irsymtab::readBitcode(), readCoverageMappingData(), llvm::jitlink::readTargetMachineArch(), llvm::LessRecordRegister::RecordParts::RecordParts(), llvm::Regex::Regex(), llvm::report_fatal_error(), reportError(), X86ReturnThunks::runOnMachineFunction(), llvm::cl::TokenizeGNUCommandLine(), transformCallee(), llvm::codeview::TypeServer2Record::TypeServer2Record(), validateMagicNumber(), llvm::writeFileAtomically(), and llvm::yaml::yaml2archive().
|
inline |
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.
Definition at line 892 of file StringRef.h.
References llvm::Data, and llvm::find().
|
inline |
Return a StringRef equal to 'this' but with the last N
elements dropped.
Definition at line 665 of file StringRef.h.
References assert(), N, llvm::size(), and substr().
Referenced by llvm::yaml::Document::parseBlockNode(), and llvm::GCOVBuffer::readString().
|
inline |
Return a StringRef equal to 'this' but with the first N
elements dropped.
Definition at line 657 of file StringRef.h.
References assert(), N, llvm::size(), and substr().
Referenced by llvm::Annotations::Annotations(), llvm::objcopy::elf::OwnedDataSection::appendHexData(), llvm::ELFAttrs::attrTypeAsString(), llvm::ELFAttrs::attrTypeFromString(), chopOneUTF32(), llvm::formatv_object_base::consumeFieldLayout(), llvm::getFuncNameWithoutPrefix(), llvm::InstrProfSymtab::getOrigFuncName(), llvm::codeview::getSymbolName(), llvm::HexagonSubtarget::initializeSubtargetDependencies(), llvm::symbolize::MarkupParser::nextNode(), llvm::Triple::normalize(), llvm::objcopy::elf::IHexRecord::parse(), llvm::RISCVISAInfo::parseArchString(), llvm::RISCVISAInfo::parseFeatures(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::formatv_object_base::parseReplacementItem(), parseStrTab(), parseStrTabSize(), parseVersion(), printSourceLine(), llvm::sys::path::remove_dots(), llvm::MCContext::setGenDwarfRootFile(), llvm::formatv_object_base::splitLiteralAndReplacement(), and upgradeLoopTag().
|
inline |
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 680 of file StringRef.h.
References F, llvm::find_if(), and substr().
|
inline |
Return a StringRef equal to 'this', but with all characters satisfying the given predicate dropped from the beginning of the string.
Definition at line 673 of file StringRef.h.
References F, llvm::find_if_not(), and substr().
unsigned StringRef::edit_distance | ( | llvm::StringRef | Other, |
bool | AllowReplacements = true , |
||
unsigned | MaxEditDistance = 0 |
||
) | const |
Determine the edit distance between this string and another string.
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 . |
AllowReplacements
is true
) replacements needed to transform one of the given strings into the other. If zero, the strings are identical. Definition at line 92 of file StringRef.cpp.
References llvm::ComputeEditDistance(), data(), llvm::makeArrayRef(), Other, and size().
Referenced by llvm::opt::OptTable::findNearest(), and LookupNearestOption().
unsigned llvm::StringRef::edit_distance_insensitive | ( | StringRef | Other, |
bool | AllowReplacements = true , |
||
unsigned | MaxEditDistance = 0 |
||
) | const |
Definition at line 101 of file StringRef.cpp.
References llvm::ComputeMappedEditDistance(), data(), llvm::makeArrayRef(), Other, and size().
|
inlineconstexpr |
empty - Check if the string is empty.
Definition at line 153 of file StringRef.h.
Referenced by llvm::CodeViewContext::addFile(), llvm::InstrProfSymtab::addFuncName(), llvm::analyzeImportedModule(), llvm::Annotations::Annotations(), llvm::objcopy::elf::OwnedDataSection::appendHexData(), llvm::DwarfUnit::applySubprogramAttributes(), llvm::DwarfUnit::applySubprogramDefinitionAttributes(), buildDWODescription(), llvm::DICompositeType::buildODRType(), llvm::caseFoldingDjbHash(), checkChars(), llvm::checkDebugInfoMetadata(), chopOneUTF32(), llvm::pdb::PDBFileBuilder::commit(), llvm::DIEHash::computeCUSignature(), computeDefaultCPU(), llvm::ARM::computeDefaultTargetABI(), llvm::RISCVABI::computeTargetABI(), computeTargetABI(), llvm::DwarfUnit::constructTypeDIE(), llvm::formatv_object_base::consumeFieldLayout(), llvm::consumeUnsignedInteger(), llvm::detail::IEEEFloat::convertFromString(), llvm::convertUTF8ToUTF16String(), llvm::memprof::RawMemProfReader::create(), llvm::vfs::RedirectingFileSystem::create(), llvm::sys::fs::create_directories(), createAArch64MCSubtargetInfo(), llvm::sampleprof::SampleContext::createCtxVectorFromStr(), createLoongArchMCSubtargetInfo(), createProfileFileNameVar(), llvm::createProfileFileNameVar(), createRISCVMCSubtargetInfo(), llvm::createSanitizerCtorAndInitFunctions(), createSparcMCSubtargetInfo(), llvm::sys::fs::createTemporaryFile(), createVEMCSubtargetInfo(), llvm::X86_MC::createX86MCSubtargetInfo(), llvm::declareSanitizerInitFunction(), llvm::DWARFUnit::determineStringOffsetsTableContributionDWO(), llvm::gsym::GsymReader::dump(), emitComments(), EmitGenDwarfAbbrev(), llvm::TargetLoweringObjectFileMachO::emitModuleMetadata(), llvm::ARMTargetStreamer::emitTargetAttributes(), llvm::cl::Option::error(), ExpandBasePaths(), llvm::sampleprof::FunctionSamples::findFunctionSamplesAt(), llvm::opt::OptTable::findNearest(), finishBuildOpDecorate(), llvm::JITSymbolFlags::fromGlobalValue(), llvm::Attribute::get(), llvm::get_threadpool_strategy(), getARClassRegisterMask(), llvm::Triple::getARMCPUForArch(), llvm::ContextTrieNode::getChildContext(), llvm::DeclContextTree::getChildDeclContext(), llvm::objcopy::ConfigManager::getCOFFConfig(), llvm::MCContext::getCOFFSection(), getCommonClassOptions(), llvm::getCPU(), llvm::Function::getDenormalMode(), llvm::MCContext::getELFSection(), llvm::json::Path::Root::getError(), getExtensionVersion(), getFeatures(), llvm::coverage::CovMapFunctionRecordV1< IntPtrT >::getFuncName(), llvm::getFuncNameWithoutPrefix(), llvm::object::AbstractArchiveMemberHeader::getGID(), llvm::GlobalValue::getGlobalIdentifier(), getGPUOrDefault(), llvm::X86TargetLowering::getIRStackGuard(), llvm::TargetLibraryInfoImpl::getLibFunc(), llvm::object::MachOObjectFile::getLibraryShortNameByIndex(), llvm::objcopy::ConfigManager::getMachOConfig(), llvm::DICompositeType::getODRTypeIfExists(), getOpEnabled(), getOpRefinementSteps(), llvm::DwarfCompileUnit::getOrCreateCommonBlock(), llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(), llvm::getOrCreateSanitizerCtorAndInitFunctions(), llvm::MCContext::getOrCreateSymbol(), getPassNameAndInstanceNum(), getPrettyScopeName(), llvm::MCObjectFileInfo::getPseudoProbeDescSection(), getQualifiedNameIndex(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::getRecords(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), getSearchPaths(), getStackGuard(), llvm::getSubDirectoryPath(), llvm::M68kMCInstLower::GetSymbolFromOperand(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::lto::getThinLTOOutputFile(), llvm::MCSymbolXCOFF::getUnqualifiedName(), getUUID(), llvm::yaml::Node::getVerbatimTag(), llvm::objcopy::ConfigManager::getWasmConfig(), llvm::TargetLibraryInfoImpl::getWidestVF(), llvm::objcopy::ConfigManager::getXCOFFConfig(), 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::cl::Option::hasArgStr(), llvm::IntelExpr::hasBaseReg(), llvm::SubtargetFeatures::hasFlag(), llvm::IntelExpr::hasIndexReg(), llvm::MCAsmInfo::hasLinkerPrivateGlobalPrefix(), llvm::IntelExpr::hasOffset(), llvm::MCSymbolXCOFF::hasRename(), llvm::GlobalValue::hasSection(), llvm::X86TargetLowering::hasStackProbeSymbol(), llvm::object::Archive::hasSymbolTable(), llvm::MSP430Subtarget::initializeSubtargetDependencies(), llvm::NVPTXSubtarget::initializeSubtargetDependencies(), llvm::CSKYSubtarget::initializeSubtargetDependencies(), llvm::MCSubtargetInfo::InitMCProcessorInfo(), llvm::X86TargetLowering::insertSSPDeclarations(), llvm::ELFAttributeParser::integerAttribute(), llvm::SubtargetFeatures::isEnabled(), llvm::TargetLibraryInfoImpl::isFunctionVectorizable(), llvm::orc::ELFNixPlatform::isInitializerSection(), llvm::sys::unicode::Node::isValid(), llvm::AMDGPU::MTBUFFormat::isValidNfmt(), llvm::LoadAndStorePromoter::LoadAndStorePromoter(), loadBinaryFormat(), llvm::loadOutputSpecs(), llvm::sampleprof::FunctionSamples::merge(), llvm::symbolize::MarkupParser::nextNode(), llvm::Triple::normalize(), llvm::gsym::operator<<(), optimizeDoubleFP(), llvm::objcopy::elf::IHexRecord::parse(), llvm::AMDGPULibFunc::parse(), llvm::PassBuilder::parseAAPipeline(), parseARMArch(), llvm::ARM_MC::ParseARMTriple(), parseCC(), llvm::parseDenormalFPAttribute(), llvm::remarks::ParsedStringTable::ParsedStringTable(), llvm::formatv_object_base::parseFormatString(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), llvm::remarks::YAMLRemarkParser::parseRemark(), llvm::formatv_object_base::parseReplacementItem(), llvm::MCSectionMachO::ParseSectionSpecifier(), parseSubArch(), llvm::MCExpr::print(), llvm::DiagnosticInfoSampleProfile::print(), llvm::MCInstPrinter::printAnnotation(), llvm::ELFAttributeParser::printAttribute(), printCFI(), PrintCFIEscape(), printFile(), llvm::AMDGPUInstPrinter::printHwreg(), llvm::cl::generic_parser_base::printOptionInfo(), llvm::AMDGPUInstPrinter::printSendMsg(), llvm::MCSectionMachO::printSwitchToSection(), printSymbolizedStackTrace(), processLoadCommands(), llvm::AttributeImpl::Profile(), llvm::SampleContextTracker::promoteMergeContextSamplesTree(), llvm::SymbolRemappingReader::read(), llvm::irsymtab::readBitcode(), llvm::GCOVFile::readGCNO(), llvm::TextInstrProfReader::readNextRecord(), llvm::sampleprof::SampleProfileReaderExtBinaryBase::readStringFromTable(), llvm::LessRecordRegister::RecordParts::RecordParts(), registerPartialPipelineCallback(), llvm::sys::path::remove_dots(), llvm::sys::path::replace_path_prefix(), llvm::ThinLTOCodeGenerator::run(), runOnFunction(), llvm::sampleprof::SampleContext::SampleContext(), sanitizeFunctionName(), llvm::Hexagon_MC::selectHexagonCPU(), selectM68kCPU(), llvm::MIPS_MC::selectMipsCPU(), llvm::EngineBuilder::selectTarget(), llvm::codegen::setFunctionAttributes(), llvm::MCContext::setGenDwarfRootFile(), llvm::lto::setupStatsFile(), llvm::VFABI::setVectorVariantNames(), shouldAlwaysEmitCompleteClassType(), shouldPrintOption(), llvm::AMDGPU::SIModeRegisterDefaults::SIModeRegisterDefaults(), llvm::formatv_object_base::splitLiteralAndReplacement(), llvm::sys::unicode::startsWith(), llvm::ELFAttributeParser::stringAttribute(), StripTypeNames(), llvm::Regex::sub(), llvm::InlineAdvisorAnalysis::Result::tryCreate(), llvm::VFABI::tryDemangleForVFABI(), llvm::MCDwarfLineTableHeader::tryGetFile(), updateAndRemoveSymbols(), llvm::UpgradeAttributes(), UsesVectorABI(), llvm::InlineAsm::verify(), and llvm::ThinLTOCodeGenerator::writeGeneratedObject().
|
inline |
Definition at line 130 of file StringRef.h.
References llvm::Data.
Referenced by chopOneUTF32(), llvm::convertUTF8ToUTF16String(), llvm::MDString::end(), endswith_insensitive(), llvm::sys::detail::getHostCPUNameForPowerPC(), getHostID(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::getRecords(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::object::WasmObjectFile::getRelocationTypeName(), llvm::object::MachOObjectFile::getRelocationTypeName(), llvm::object::XCOFFObjectFile::getRelocationTypeName(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::Timer::init(), llvm::AsmLexer::LexToken(), llvm::AsmLexer::LexUntilEndOfStatement(), llvm::pdb::NamedStreamMap::load(), lower(), llvm::sys::fs::make_absolute(), mangleCoveragePath(), llvm::symbolize::MarkupParser::nextNode(), llvm::RISCVISAInfo::parseArchString(), llvm::InlineAsm::ParseConstraints(), parseMaybeMangledName(), parseRD(), parseRegisterNumber(), readInteger(), readStruct(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::reconstituteName(), llvm::Regex::Regex(), llvm::sys::path::replace_extension(), llvm::EngineBuilder::setMArch(), llvm::EngineBuilder::setMCPU(), llvm::TimerGroup::setName(), and upper().
|
inline |
Check if this string ends with the given Suffix
.
Definition at line 301 of file StringRef.h.
References llvm::sys::path::end().
Referenced by llvm::DWARFTypePrinter::appendTypeTagName(), llvm::SmallString< 256 >::endswith(), llvm::sys::detail::getHostCPUNameForARM(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::object::BigArchiveMemberHeader::getRawName(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::AMDGPU::IsaInfo::getTargetIDSettingFromFeatureString(), isDWOSection(), llvm::vfs::RedirectingFileSystem::makeAbsolute(), llvm::parseAnalysisUtilityPasses(), llvm::ARM::parseArchEndian(), and parseSubArch().
bool StringRef::endswith_insensitive | ( | StringRef | Suffix | ) | const |
Check if this string ends with the given Suffix
, ignoring case.
Definition at line 50 of file StringRef.cpp.
References ascii_strncasecmp(), and end().
|
inline |
equals - Check for string equality, this is more efficient than compare() when the relative ordering of inequal strings isn't needed.
Definition at line 187 of file StringRef.h.
References llvm::Data, and RHS.
Referenced by count(), llvm::Hexagon_MC::createHexagonMCSubtargetInfo(), llvm::SmallString< 256 >::equals(), llvm::Triple::getARMCPUForArch(), llvm::BasicBlock::getIrrLoopHeaderWeight(), getSummaryFromMD(), getValMD(), isKeyValuePair(), isSmallDataSection(), llvm::AMDGPULegalizerInfo::legalizeGlobalValue(), llvm::AMDGPUTargetLowering::LowerGlobalAddress(), makeStatepointExplicitImpl(), llvm::CodeGenCoverage::parse(), parseBPFArch(), llvm::MIRParserImpl::parseRegisterInfo(), llvm::json::Path::Root::printErrorContext(), and rfind().
|
inline |
Check for string equality, ignoring case.
Definition at line 194 of file StringRef.h.
References RHS.
Referenced by llvm::AArch64FunctionInfo::AArch64FunctionInfo(), llvm::SmallString< 256 >::equals_insensitive(), llvm::findVCToolChainViaEnvironment(), GetBranchTargetEnforcement(), llvm::HexagonMCInstrInfo::isOrderedDuplexPair(), and rfind_insensitive().
|
inline |
Search for the first character C
in the string.
C
, or npos if not found. Definition at line 319 of file StringRef.h.
References llvm::Data, From, llvm::min(), and P.
Referenced by checkLinkerOptCommand(), CommaSeparateAndAddOccurrence(), llvm::Hexagon_MC::createHexagonMCSubtargetInfo(), emitComments(), llvm::RuntimeDyldCheckerExprEval::evaluate(), ExpandBasePaths(), llvm::SmallString< 256 >::find(), llvm::TernOpInit::Fold(), llvm::memprof::IndexedMemProfRecord::getGUID(), getProbeFNameForGUID(), llvm::object::ArchiveMemberHeader::getRawName(), llvm::yaml::ScalarNode::getValue(), llvm::isSpecialPass(), ParseLine(), llvm::Pattern::parseNumericSubstitutionBlock(), printSourceLine(), printSymbolizedStackTrace(), and singleLetterExtensionRank().
size_t StringRef::find | ( | StringRef | Str, |
size_t | From = 0 |
||
) | const |
Search for the first string Str
in the string.
find - Search for the first string
Str
, or npos if not found.Definition at line 131 of file StringRef.cpp.
StringRef::size_type StringRef::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.
find_first_not_of - Find the first character in the string that is not
Definition at line 248 of file StringRef.cpp.
References llvm::numbers::e, From, i, llvm::min(), and npos.
Referenced by llvm::SmallString< 256 >::find_first_not_of(), ParseLine(), and llvm::Regex::sub().
StringRef::size_type StringRef::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.
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 259 of file StringRef.cpp.
References llvm::numbers::e, From, i, llvm::min(), and npos.
|
inline |
Find the first character in the string that is C
, or npos if not found.
Same as find.
Definition at line 414 of file StringRef.h.
References llvm::find(), and From.
Referenced by llvm::SmallString< 256 >::find_first_of(), llvm::InstrProfSymtab::getOrigFuncName(), llvm::yaml::ScalarNode::getValue(), llvm::RISCVISAInfo::parseArchString(), ParseLine(), llvm::sys::path::remove_dots(), and llvm::formatv_object_base::splitLiteralAndReplacement().
StringRef::size_type StringRef::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.
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 234 of file StringRef.cpp.
References llvm::numbers::e, From, i, llvm::min(), and npos.
|
inline |
Search for the first character satisfying the predicate F
.
F
starting from From
, or npos if not found. Definition at line 341 of file StringRef.h.
References F, From, S, and llvm::size().
Referenced by find_insensitive().
|
inline |
Search for the first character not satisfying the predicate F
.
F
starting from From
, or npos if not found. Definition at line 356 of file StringRef.h.
References c, F, llvm::find_if(), and From.
size_t StringRef::find_insensitive | ( | char | C, |
size_t | From = 0 |
||
) | const |
Search for the first character C
in the string, ignoring case.
C
, or npos if not found. Definition at line 55 of file StringRef.cpp.
size_t StringRef::find_insensitive | ( | StringRef | Str, |
size_t | From = 0 |
||
) | const |
StringRef::size_type StringRef::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.
find_last_not_of - Find the last character in the string that is not
Definition at line 289 of file StringRef.cpp.
References llvm::numbers::e, From, i, llvm::min(), and npos.
StringRef::size_type StringRef::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.
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 300 of file StringRef.cpp.
References llvm::numbers::e, From, i, llvm::min(), and npos.
|
inline |
Find the last character in the string that is C
, or npos if not found.
Definition at line 440 of file StringRef.h.
References From.
Referenced by llvm::sys::path::extension(), llvm::SmallString< 256 >::find_last_of(), llvm::SourceMgr::getLineAndColumn(), llvm::yaml::Node::getVerbatimTag(), ParseLine(), and llvm::sys::path::stem().
StringRef::size_type StringRef::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.
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 275 of file StringRef.cpp.
References llvm::numbers::e, From, i, llvm::min(), and npos.
|
inline |
front - Get the first character in the string.
Definition at line 161 of file StringRef.h.
References assert(), llvm::Data, and llvm::empty().
Referenced by llvm::Annotations::Annotations(), llvm::JITSymbolFlags::fromGlobalValue(), getQualifiedNameIndex(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::PassBuilder::parsePassPipeline(), llvm::formatv_object_base::parseReplacementItem(), llvm::sys::path::remove_dots(), llvm::MCContext::setGenDwarfRootFile(), and llvm::formatv_object_base::splitLiteralAndReplacement().
Parse the current string as an IEEE double-precision floating point value.
The string must be a well-formed double.
If AllowInexact
is false, the function will fail if the string cannot be represented exactly. Otherwise, the function only fails in case of an overflow or underflow, or an invalid floating point representation.
Definition at line 587 of file StringRef.cpp.
References llvm::errorToBool(), F, llvm::APFloatBase::opInexact, llvm::APFloatBase::opOK, and llvm::APFloatBase::rmNearestTiesToEven.
bool StringRef::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.
The current value in Result
is discarded, and the storage is changed to be wide enough to store the parsed integer.
APInt::fromString is superficially similar but assumes the string is well-formed in the given radix.
Definition at line 512 of file StringRef.cpp.
References assert(), llvm::BitWidth, and GetAutoSenseRadix().
|
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 514 of file StringRef.h.
References llvm::getAsSignedInteger(), and T.
Referenced by adjustCallerStackProbeSize(), adjustMinLegalVectorWidth(), llvm::get_threadpool_strategy(), getArchiveMemberDecField(), getArchiveMemberOctField(), getExtensionVersion(), getPassNameAndInstanceNum(), llvm::SystemZTargetLowering::getStackProbeSize(), llvm::PPCTargetLowering::getStackProbeSize(), llvm::X86TargetLowering::getStackProbeSize(), llvm::getStringFnAttrAsInt(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::AMDGPU::Exp::getTgtId(), llvm::yaml::isInteger(), llvm::vfs::RedirectingFileSystemParser::parse(), llvm::parseCachePruningPolicy(), parseDuration(), ParseLine(), parseMetadata(), parseRegisterNumber(), parseSectionFlags(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::parseStatepointDirectivesFromAttrs(), llvm::StackProtector::runOnFunction(), llvm::AttributeFuncs::updateMinLegalVectorWidthAttr(), and llvm::writeArchiveToStream().
|
inline |
Definition at line 525 of file StringRef.h.
References llvm::getAsUnsignedInteger(), and T.
std::string StringRef::lower | ( | ) | const |
Definition at line 112 of file StringRef.cpp.
References begin(), end(), and llvm::map_iterator().
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::RISCVTargetLowering::getRegForInlineAsmConstraint(), getRegisterName(), llvm::ELFAttributeParser::parseSubsection(), llvm::MIPrinter::print(), llvm::MipsAsmPrinter::printOperand(), llvm::printRegClassOrBank(), llvm::SparcInstPrinter::printRegName(), llvm::ARCInstPrinter::printRegName(), llvm::XCoreInstPrinter::printRegName(), llvm::LanaiInstPrinter::printRegName(), and llvm::MipsInstPrinter::printRegName().
|
inline |
Return string with consecutive Char
characters starting from the the left removed.
Definition at line 846 of file StringRef.h.
References llvm::min().
Referenced by llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::SymbolRemappingReader::read(), and llvm::VFABI::tryDemangleForVFABI().
|
inline |
Return string with consecutive characters in Chars
starting from the left removed.
Definition at line 853 of file StringRef.h.
References llvm::min().
|
inlineexplicit |
Definition at line 276 of file StringRef.h.
|
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.
|
inline |
Definition at line 259 of file StringRef.h.
References assert(), and llvm::Data.
|
inline |
Search for the last character C
in the string.
C
, or npos if not found. Definition at line 379 of file StringRef.h.
References llvm::Data, From, i, and llvm::min().
Referenced by llvm::sampleprof::FunctionSamples::getCanonicalFnName(), llvm::object::MachOObjectFile::guessLibraryShortName(), and llvm::SmallString< 256 >::rfind().
size_t StringRef::rfind | ( | StringRef | Str | ) | const |
Search for the last string Str
in the string.
rfind - Search for the last string
Str
, or npos if not found.Definition at line 206 of file StringRef.cpp.
References llvm::numbers::e, equals(), i, N, npos, and substr().
size_t StringRef::rfind_insensitive | ( | char | C, |
size_t | From = npos |
||
) | const |
Search for the last character C
in the string, ignoring case.
C
, or npos if not found. Definition at line 191 of file StringRef.cpp.
References From, i, llvm::min(), and npos.
size_t StringRef::rfind_insensitive | ( | StringRef | Str | ) | const |
Search for the last string Str
in the string, ignoring case.
Str
, or npos if not found. Definition at line 218 of file StringRef.cpp.
References llvm::numbers::e, equals_insensitive(), i, N, npos, and substr().
|
inline |
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 == "").
Separator | - The character to split on. |
Definition at line 839 of file StringRef.h.
|
inline |
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 == "").
Separator | - The string to split on. |
Definition at line 786 of file StringRef.h.
References size().
|
inline |
Return string with consecutive Char
characters starting from the right removed.
Definition at line 860 of file StringRef.h.
References llvm::min().
Referenced by llvm::RuntimeDyldCheckerExprEval::evaluate(), getFieldRawString(), getPayloadString(), llvm::Pattern::parseNumericSubstitutionBlock(), and trim().
|
inline |
Return string with consecutive characters in Chars
starting from the right removed.
Definition at line 867 of file StringRef.h.
References llvm::min().
|
inlineconstexpr |
size - Get the string size.
Definition at line 157 of file StringRef.h.
Referenced by llvm::Hexagon_MC::addArchSubtarget(), addSection(), angleBracketString(), llvm::Annotations::Annotations(), llvm::objcopy::elf::OwnedDataSection::appendHexData(), llvm::DWARFTypePrinter::appendTypeTagName(), argPlusPrefixesSize(), argPrefix(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), checkArchVersion(), checkChars(), llvm::FunctionComparator::cmpMem(), llvm::sys::unicode::columnWidthUTF8(), computeStringTable(), constructSegment(), constructSymbolEntry(), consume_back(), consume_back_insensitive(), llvm::formatv_object_base::consumeFieldLayout(), llvm::consumeUnsignedInteger(), llvm::detail::IEEEFloat::convertFromString(), llvm::convertUTF8ToUTF16String(), llvm::StringMapEntry< llvm::Comdat >::Create(), llvm::sampleprof::SampleContext::createCtxVectorFromStr(), llvm::objcopy::coff::createGnuDebugLinkSectionContents(), llvm::jitlink::createLinkGraphFromELFObject(), llvm::DWARFUnit::determineStringOffsetsTableContributionDWO(), dumpSectionToFile(), dumpStringOffsetsSection(), edit_distance(), edit_distance_insensitive(), llvm::BitstreamWriter::emitBlob(), llvm::DwarfStreamer::emitCIE(), llvm::DWARFYAML::emitDebugAbbrev(), llvm::DWARFYAML::emitDebugLine(), llvm::AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectISAV2(), llvm::DwarfStreamer::emitFDE(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), llvm::DwarfStreamer::emitLineTableForUnit(), llvm::emitSourceFileHeader(), llvm::CodeViewContext::encodeDefRange(), llvm::sys::path::end(), llvm::sys::path::extension(), llvm::opt::OptTable::findNearest(), llvm::sys::unicode::findSyllable(), llvm::TernOpInit::Fold(), for(), formatPax(), llvm::DWARFUnit::getAddrOffsetSectionItem(), llvm::APInt::getBitsNeeded(), llvm::object::ELFFile< ELFT >::getBufSize(), llvm::sampleprof::FunctionSamples::getCanonicalFnName(), llvm::BPFTargetLowering::getConstraintType(), llvm::SparcTargetLowering::getConstraintType(), llvm::MSP430TargetLowering::getConstraintType(), llvm::AVRTargetLowering::getConstraintType(), llvm::M68kTargetLowering::getConstraintType(), llvm::VETargetLowering::getConstraintType(), llvm::HexagonTargetLowering::getConstraintType(), llvm::RISCVTargetLowering::getConstraintType(), llvm::SITargetLowering::getConstraintType(), llvm::SystemZTargetLowering::getConstraintType(), llvm::NVPTXTargetLowering::getConstraintType(), llvm::ARMTargetLowering::getConstraintType(), llvm::PPCTargetLowering::getConstraintType(), llvm::X86TargetLowering::getConstraintType(), llvm::TargetLowering::getConstraintType(), llvm::AsmToken::getEndLoc(), llvm::Triple::getEnvironmentVersion(), getExtensionVersion(), llvm::getFuncNameWithoutPrefix(), getHexUint(), llvm::HexagonInstrInfo::getInlineAsmLength(), llvm::RISCVTargetLowering::getInlineAsmMemConstraint(), llvm::SystemZTargetLowering::getInlineAsmMemConstraint(), llvm::ARMTargetLowering::getInlineAsmMemConstraint(), llvm::MDString::getLength(), llvm::DWARFContext::getLineTableForUnit(), getMemBufferCopyImpl(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::Elf_Sym_Impl< ELFT >::getName(), llvm::WritableMemoryBuffer::getNewUninitMemBuffer(), getOptionPrefixesSize(), llvm::cl::generic_parser_base::getOptionWidth(), llvm::cl::basic_parser_impl::getOptionWidth(), llvm::OpenMPIRBuilder::getOrCreateSrcLocStr(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::Triple::getOSVersion(), getQualifiedNameIndex(), llvm::object::BigArchiveMemberHeader::getRawName(), llvm::BPFTargetLowering::getRegForInlineAsmConstraint(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::LanaiTargetLowering::getRegForInlineAsmConstraint(), llvm::MSP430TargetLowering::getRegForInlineAsmConstraint(), llvm::AVRTargetLowering::getRegForInlineAsmConstraint(), llvm::M68kTargetLowering::getRegForInlineAsmConstraint(), llvm::VETargetLowering::getRegForInlineAsmConstraint(), llvm::HexagonTargetLowering::getRegForInlineAsmConstraint(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::RISCVTargetLowering::getRegForInlineAsmConstraint(), llvm::SystemZTargetLowering::getRegForInlineAsmConstraint(), llvm::NVPTXTargetLowering::getRegForInlineAsmConstraint(), llvm::ARMTargetLowering::getRegForInlineAsmConstraint(), llvm::PPCTargetLowering::getRegForInlineAsmConstraint(), llvm::X86TargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::object::ELFFile< ELFT >::getSectionName(), llvm::object::MachOObjectFile::getSectionSize(), llvm::gsym::StringTable::getString(), llvm::DWARFUnit::getStringOffsetSectionItem(), llvm::AMDGPU::Exp::getTgtId(), getUUID(), llvm::yaml::ScalarNode::getValue(), getVarName(), gsiRecordCmp(), llvm::object::MachOObjectFile::guessLibraryShortName(), isAsmComment(), llvm::TrigramIndex::isDefinitelyOut(), isImmConstraint(), LLVMGetNamedMetadataName(), llvm::gsym::FunctionInfo::lookup(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::InlineAsmLowering::lowerAsmOperandForConstraint(), llvm::opt::DerivedArgList::MakeJoinedArg(), mapNameAndUniqueName(), matchOption(), maybeLexIndex(), maybeLexIndexAndName(), maybeLexIRBlock(), maybeLexIRValue(), maybeLexMCSymbol(), maybeLexSubRegisterIndex(), llvm::symbolize::MarkupParser::nextNode(), operator new(), llvm::jitlink::CompactUnwindSplitter::operator()(), llvm::DWARFExpression::iterator::operator++(), llvm::gsym::operator<<(), llvm::remarks::ParsedStringTable::operator[](), optimizeDoubleFP(), optimizeMemCmpVarSize(), optionMatches(), llvm::objcopy::elf::IHexRecord::parse(), llvm::parseAnalysisUtilityPasses(), llvm::RISCVISAInfo::parseArchString(), llvm::RISCVISAInfo::parseFeatures(), ParseLine(), parseMagic(), llvm::Pattern::parsePattern(), parseRefinementStep(), parseRegisterNumber(), parseStrTab(), parseStrTabSize(), parseVersion(), printCFI(), PrintCFIEscape(), llvm::cl::Option::printEnumValHelpStr(), llvm::cl::generic_parser_base::printGenericOptionDiff(), PrintHelpOptionList(), printLine(), llvm::cl::generic_parser_base::printOptionInfo(), printSourceLine(), llvm::irsymtab::readBitcode(), readCoverageMappingData(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::reconstituteName(), llvm::LessRecordRegister::RecordParts::RecordParts(), llvm::sys::path::relative_path(), llvm::sys::path::remove_dots(), llvm::sys::path::replace_extension(), llvm::sys::path::replace_path_prefix(), llvm::report_fatal_error(), rsplit(), llvm::cl::Option::setArgStr(), singleLetterExtensionRank(), llvm::DIEInlineString::sizeOf(), split(), llvm::formatv_object_base::splitLiteralAndReplacement(), llvm::sys::unicode::startsWith(), llvm::sys::path::stem(), llvm::Regex::sub(), llvm::StringAttributeImpl::totalSizeToAlloc(), llvm::DwarfStreamer::translateLineTable(), llvm::codeview::TypeServer2Record::TypeServer2Record(), updateSection(), upgradeLoopTag(), llvm::writeFileAtomically(), and llvm::yaml::yaml2archive().
|
inline |
Return a reference to the substring from [Start, End).
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 736 of file StringRef.h.
Referenced by llvm::object::ObjectFile::createMachOObjectFile(), llvm::object::MachOObjectFile::guessLibraryShortName(), parseRegisterNumber(), printSourceLine(), llvm::formatv_object_base::splitLiteralAndReplacement(), llvm::Regex::sub(), and llvm::DwarfStreamer::translateLineTable().
|
inline |
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 == "").
Separator | The character to split on. |
Definition at line 753 of file StringRef.h.
References split().
Referenced by addSection(), llvm::MachO::Target::create(), llvm::sampleprof::SampleContext::createCtxVectorFromStr(), llvm::sampleprof::SampleContext::decodeContextString(), llvm::AMDGPU::HSAMD::MetadataStreamerV3::emitKernelArg(), findSection(), llvm::findVCToolChainViaEnvironment(), forceAttributes(), llvm::Triple::getArchName(), llvm::codeview::getBytesAsCString(), llvm::sampleprof::FunctionSamples::getCanonicalFnName(), llvm::getDefaultDebuginfodUrls(), llvm::Triple::getEnvironmentName(), llvm::sys::detail::getHostCPUNameForARM(), llvm::sys::detail::getHostCPUNameForRISCV(), llvm::sys::detail::getHostCPUNameForS390x(), getIntOperandFromRegisterString(), getIntOperandsFromRegisterString(), getOpEnabled(), getOpRefinementSteps(), llvm::Triple::getOSAndEnvironmentName(), llvm::Triple::getOSName(), getSearchPaths(), llvm::object::COFFObjectFile::getSectionName(), llvm::GCOVBuffer::getString(), llvm::codeview::getSymbolName(), llvm::Triple::getVendorName(), llvm::handleExecNameEncodedBEOpts(), llvm::handleExecNameEncodedOptimizerOpts(), isThumbFunction(), llvm::SpecialCaseList::parse(), llvm::PassBuilder::parseAAPipeline(), llvm::RISCVISAInfo::parseArchString(), parseCHRFilterFiles(), llvm::remarks::ParsedStringTable::ParsedStringTable(), parseNamePrefix(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::cl::Option::printEnumValHelpStr(), llvm::cl::Option::printHelpStr(), llvm::DebugCounter::push_back(), llvm::SymbolRemappingReader::read(), llvm::readPGOFuncNameStrings(), llvm::GCOVBuffer::readString(), llvm::ReplayInlineAdvisor::ReplayInlineAdvisor(), llvm::Hexagon_MC::selectHexagonCPU(), llvm::AMDGPU::IsaInfo::AMDGPUTargetID::setTargetIDFromTargetIDStream(), llvm::Regex::sub(), llvm::opt::OptTable::suggestValueCompletions(), and llvm::Triple::Triple().
void StringRef::split | ( | SmallVectorImpl< StringRef > & | A, |
char | Separator, | ||
int | MaxSplit = -1 , |
||
bool | KeepEmpty = true |
||
) | const |
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
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 339 of file StringRef.cpp.
void StringRef::split | ( | SmallVectorImpl< StringRef > & | A, |
StringRef | Separator, | ||
int | MaxSplit = -1 , |
||
bool | KeepEmpty = true |
||
) | const |
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
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 312 of file StringRef.cpp.
|
inline |
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 == "").
Separator | - The string to split on. |
Definition at line 768 of file StringRef.h.
References llvm::find(), and size().
|
inline |
Check if this string starts with the given Prefix
.
Definition at line 290 of file StringRef.h.
References llvm::Data, and llvm::cl::Prefix.
Referenced by llvm::DWARFTypePrinter::appendTypeTagName(), llvm::AsmLexer::AsmLexer(), llvm::ELFAttrs::attrTypeFromString(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), llvm::RISCVABI::computeTargetABI(), computeTargetABI(), llvm::coverage::BinaryCoverageReader::create(), llvm::remarks::createYAMLParserFromMeta(), doesIgnoreDataTypeSuffix(), llvm::Attributor::emitRemark(), llvm::ARMTargetStreamer::emitTargetAttributes(), llvm::JITSymbolFlags::fromGlobalValue(), llvm::AArch64::getArchExtFeature(), llvm::Triple::getEnvironmentVersion(), llvm::getFuncNameWithoutPrefix(), llvm::GCOVFunction::getName(), llvm::object::getNameType(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::Triple::getOSVersion(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::yaml::Node::getVerbatimTag(), llvm::object::MachOObjectFile::guessLibraryShortName(), llvm::HexagonSubtarget::initializeSubtargetDependencies(), llvm::LTOModule::isBitcodeForTarget(), isCompressable(), llvm::objcopy::wasm::isDebugSection(), llvm::objcopy::coff::isDebugSection(), isDebugSection(), llvm::object::isDecorated(), llvm::MCSectionCOFF::isImplicitlyDiscardable(), llvm::objcopy::wasm::isLinkerSection(), llvm::objcopy::macho::SymbolEntry::isSwiftSymbol(), llvm::makeFollowupLoopID(), llvm::yaml::MappingTraits< std::unique_ptr< ELFYAML::Chunk > >::mapping(), matchOption(), llvm::Triple::normalize(), optimizeDoubleFP(), llvm::parseAnalysisUtilityPasses(), parseArch(), llvm::ARM::parseArchEndian(), llvm::RISCVISAInfo::parseArchString(), parseARMArch(), llvm::Pattern::parsePattern(), parseSubArch(), printSymbolizedStackTrace(), processGlobal(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFAArch64::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::pruneCache(), llvm::SymbolRemappingReader::read(), llvm::TextInstrProfReader::readHeader(), llvm::TextInstrProfReader::readNextRecord(), llvm::object::replace(), replaceAndRemoveSections(), llvm::ThunkInserter< Derived >::run(), llvm::sampleprof::SampleContext::SampleContext(), llvm::pdb::NativeSession::searchForPdb(), llvm::HexagonTargetObjectFile::SelectSectionForGlobal(), llvm::SmallString< 256 >::startswith(), StripSymtab(), StripTypeNames(), updateAndRemoveSymbols(), upgradeLoopTag(), and usesTriple().
bool StringRef::startswith_insensitive | ( | StringRef | Prefix | ) | const |
Check if this string starts with the given Prefix
, ignoring case.
Definition at line 45 of file StringRef.cpp.
References ascii_strncasecmp(), and llvm::cl::Prefix.
Referenced by matchOption().
|
inline |
str - Get the contents as an std::string.
Definition at line 249 of file StringRef.h.
References llvm::Data.
Referenced by llvm::DwarfCompileUnit::addGlobalType(), llvm::DwarfCompileUnit::addGlobalTypeUnitType(), llvm::vfs::InMemoryFileSystem::addHardLink(), llvm::InstrProfCorrelatorImpl< IntPtrT >::addProbe(), llvm::DCData::addSuccessorLabel(), buildFrameDebugInfo(), llvm::cacheAnnotationFromMD(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), checkOperandCount(), constructPointer(), constructSymbolEntry(), llvm::sys::path::convert_to_slash(), llvm::Hexagon_MC::createHexagonMCSubtargetInfo(), llvm::MachO::Symbol::dump(), llvm::objcopy::wasm::dumpSectionToFile(), dumpSectionToFile(), llvm::AMDGPUAsmPrinter::emitFunctionEntryLabel(), llvm::objcopy::macho::executeObjcopyOnBinary(), llvm::objcopy::macho::executeObjcopyOnMachOUniversalBinary(), llvm::MCJIT::finalizeLoadedModules(), llvm::object::MachOObjectFile::findDsymObjectMembers(), findSection(), llvm::findVCToolChainViaCommandLine(), llvm::DiagnosticLocation::getAbsolutePath(), llvm::DWARFFormValue::getAsCString(), llvm::Attribute::getAsString(), llvm::FieldInit::getAsString(), llvm::sampleprof::FunctionSamples::getCallSiteHash(), llvm::pdb::NativeSourceFile::getChecksum(), getExtensionVersion(), llvm::GlobalValue::getGlobalIdentifier(), llvm::DOTGraphTraits< DOTFuncInfo * >::getGraphName(), llvm::DOTGraphTraits< DOTFuncMSSAInfo * >::getGraphName(), getHighestNumericTupleInDirectory(), llvm::sys::fs::getMainExecutable(), llvm::vfs::File::getName(), llvm::SDNode::getOperationName(), getQualifiedNameIndex(), llvm::pdb::PDBSymbolCompiland::getSourceFileName(), llvm::LoongArchTargetMachine::getSubtargetImpl(), llvm::RISCVTargetMachine::getSubtargetImpl(), llvm::CSKYTargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::SystemZTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::M68kTargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), llvm::CompileUnit::getSysRoot(), llvm::Record::getValueAsBitOrUnset(), getWindowsSDKDirViaCommandLine(), llvm::objcopy::coff::handleArgs(), llvm::M68kSubtarget::initializeSubtargetDependencies(), LiveDebugValues::MLocTracker::LocIdxToName(), llvm::LockFileManager::LockFileManager(), mangleCoveragePath(), llvm::yaml::MappingTraits< const InterfaceFile * >::NormalizedTBD::NormalizedTBD(), llvm::vfs::RedirectingFileSystem::openFileForRead(), llvm::objcopy::elf::OwnedDataSection::OwnedDataSection(), llvm::RISCVISAInfo::parseArchString(), llvm::RISCVISAInfo::parseFeatures(), parseIRConstant(), llvm::MCDecodedPseudoProbe::print(), llvm::DivergencePropagator::printDefs(), processLoadCommands(), replaceWithCallToVeclib(), llvm::PseudoProbeVerifier::runAfterPass(), llvm::IRSimilarity::IRInstructionData::setCalleeName(), llvm::vfs::RedirectingFileSystem::setExternalContentsPrefixDir(), llvm::vfs::YAMLVFSWriter::setOverlayDir(), smallData(), llvm::OutlinableRegion::splitCandidate(), llvm::Twine::str(), llvm::json::ObjectKey::str(), suffixed_name_or(), llvm::timeTraceProfilerWrite(), llvm::symbolize::toJSON(), llvm::AMDGPU::IsaInfo::AMDGPUTargetID::toString(), llvm::sampleprof::SampleContextFrame::toString(), llvm::sampleprof::SampleContext::toString(), and writeTimestampFile().
|
inline |
Return a reference to the substring from [Start, Start + N).
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 615 of file StringRef.h.
References llvm::Data, llvm::min(), and N.
Referenced by llvm::Hexagon_MC::addArchSubtarget(), llvm::DWARFTypePrinter::appendTypeTagName(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), CommaSeparateAndAddOccurrence(), llvm::consumeUnsignedInteger(), count(), llvm::sampleprof::SampleContext::createCtxVectorFromStr(), emitComments(), llvm::DwarfStreamer::emitLocationsForUnit(), llvm::emitSourceFileHeader(), llvm::RuntimeDyldCheckerExprEval::evaluate(), ExpandBasePaths(), llvm::sys::path::extension(), find_insensitive(), llvm::MCJIT::findModuleForSymbol(), llvm::TernOpInit::Fold(), for(), llvm::JITSymbolFlags::fromGlobalValue(), llvm::AArch64::getArchExtFeature(), llvm::object::MachOUniversalBinary::ObjectForArch::getAsArchive(), llvm::object::MachOUniversalBinary::ObjectForArch::getAsIRObject(), llvm::object::MachOUniversalBinary::ObjectForArch::getAsObjectFile(), llvm::sampleprof::FunctionSamples::getCanonicalFnName(), llvm::TargetLowering::getConstraintType(), llvm::Triple::getEnvironmentVersion(), getOpEnabled(), getOpRefinementSteps(), llvm::Triple::getOSVersion(), getQualifiedNameIndex(), llvm::object::MachOObjectFile::getStringTableData(), llvm::yaml::ScalarNode::getValue(), getVarName(), llvm::yaml::Node::getVerbatimTag(), HandlePrefixedOrGroupedOption(), llvm::isSpecialPass(), llvm::sys::path::parent_path(), llvm::objcopy::elf::IHexRecord::parse(), llvm::parseAnalysisUtilityPasses(), llvm::RISCVISAInfo::parseArchString(), llvm::yaml::Document::parseBlockNode(), ParseLine(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parsePattern(), llvm::GCOVBuffer::readGCDAFormat(), llvm::GCOVBuffer::readGCNOFormat(), llvm::TextInstrProfReader::readHeader(), llvm::sys::path::relative_path(), llvm::object::replace(), llvm::sys::path::replace_path_prefix(), rfind(), rfind_insensitive(), llvm::sys::path::root_path(), llvm::formatv_object_base::splitLiteralAndReplacement(), llvm::sys::path::stem(), llvm::SubtargetFeatures::StripFlag(), llvm::Regex::sub(), llvm::SmallString< 256 >::substr(), and llvm::UpgradeSectionAttributes().
|
inline |
Return a StringRef equal to 'this' but with only the last N
elements remaining.
If N
is greater than the length of the string, the entire string is returned.
Definition at line 634 of file StringRef.h.
References N, and llvm::size().
Referenced by llvm::DWARFLinker::link().
|
inline |
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 624 of file StringRef.h.
References N, and llvm::size().
Referenced by llvm::objcopy::elf::OwnedDataSection::appendHexData(), llvm::memprof::IndexedMemProfRecord::getGUID(), mapNameAndUniqueName(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::sys::path::remove_dots(), and llvm::formatv_object_base::splitLiteralAndReplacement().
|
inline |
Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicate.
Definition at line 650 of file StringRef.h.
References F, llvm::find_if(), and substr().
|
inline |
Return the longest prefix of 'this' such that every character in the prefix satisfies the given predicate.
Definition at line 643 of file StringRef.h.
References F, llvm::find_if_not(), and substr().
Referenced by llvm::Annotations::Annotations(), llvm::formatv_object_base::splitLiteralAndReplacement(), and llvm::VFABI::tryDemangleForVFABI().
|
inline |
Return string with consecutive Char
characters starting from the left and right removed.
Definition at line 874 of file StringRef.h.
References rtrim().
Referenced by llvm::RuntimeDyldCheckerImpl::check(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::DataExtractor::getFixedLengthString(), llvm::Pattern::parseNumericSubstitutionBlock(), llvm::formatv_object_base::parseReplacementItem(), and usesTriple().
|
inline |
Return string with consecutive characters in Chars
starting from the left and right removed.
Definition at line 881 of file StringRef.h.
References rtrim().
std::string StringRef::upper | ( | ) | const |
Convert the given ASCII string to uppercase.
Definition at line 117 of file StringRef.cpp.
References begin(), end(), and llvm::map_iterator().
Definition at line 60 of file StringRef.h.
Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), buildFixItLine(), CommaSeparateAndAddOccurrence(), llvm::sys::fs::createTemporaryFile(), ExpandBasePaths(), llvm::sys::path::extension(), find(), find_first_not_of(), find_first_of(), find_insensitive(), find_last_not_of(), find_last_of(), llvm::SourceMgr::FindLocForLineAndColumn(), llvm::symbolize::SourceCode::format(), llvm::format_provider< T, std::enable_if_t< detail::use_string_formatter< T >::value > >::format(), llvm::ARM::getCanonicalArchName(), llvm::sampleprof::FunctionSamples::getCanonicalFnName(), llvm::sys::detail::getHostCPUNameForS390x(), llvm::SourceMgr::getLineAndColumn(), llvm::InstrProfSymtab::getOrigFuncName(), llvm::object::ArchiveMemberHeader::getRawName(), llvm::getTypeName(), getTypeNamePrefix(), llvm::yaml::ScalarNode::getValue(), llvm::object::MachOObjectFile::guessLibraryShortName(), hasWildcard(), llvm::Regex::isLiteralERE(), llvm::isSpecialPass(), locateCStrings(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::sys::path::reverse_iterator::operator++(), llvm::sys::path::parent_path(), llvm::RISCVISAInfo::parseArchString(), ParseLine(), llvm::Pattern::parseNumericSubstitutionBlock(), parseRefinementStep(), llvm::sys::printArg(), printSourceLine(), llvm::BinaryStreamReader::readCString(), llvm::sys::path::remove_dots(), llvm::sys::path::remove_filename(), llvm::object::replace(), llvm::sys::path::replace_extension(), rfind(), rfind_insensitive(), singleLetterExtensionRank(), split(), llvm::formatv_object_base::splitLiteralAndReplacement(), splitUstar(), llvm::sys::path::stem(), llvm::ifs::terminatedSubstr(), and llvm::UpgradeDataLayoutString().