LLVM
8.0.1
|
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 | |
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 | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * | data () const |
data - Get a pointer to the start of the string (which may not be null terminated). More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | empty () const |
empty - Check if the string is empty. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE 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 LLVM_ATTRIBUTE_ALWAYS_INLINE 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_lower (StringRef RHS) const |
equals_lower - Check for string equality, ignoring case. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE 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_lower (StringRef RHS) const |
compare_lower - 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 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< std::is_same< T, std::string >::value, StringRef >::type & | operator= (T &&Str)=delete |
Disallow accidental assignment from a temporary std::string. More... | |
Type Conversions | |
operator std::string () const | |
String Predicates | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | startswith (StringRef Prefix) const |
Check if this string starts with the given Prefix . More... | |
LLVM_NODISCARD bool | startswith_lower (StringRef Prefix) const |
Check if this string starts with the given Prefix , ignoring case. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | endswith (StringRef Suffix) const |
Check if this string ends with the given Suffix . More... | |
LLVM_NODISCARD bool | endswith_lower (StringRef Suffix) const |
Check if this string ends with the given Suffix , ignoring case. More... | |
String Searching | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE 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_lower (char C, size_t From=0) const |
Search for the first character C in the string, ignoring case. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE 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 LLVM_ATTRIBUTE_ALWAYS_INLINE 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_lower (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_lower (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_lower (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 LLVM_ATTRIBUTE_ALWAYS_INLINE bool | contains (StringRef Other) const |
Return true if the given string is a substring of *this, and false otherwise. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | contains (char C) const |
Return true if the given character is contained in *this, and false otherwise. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | contains_lower (StringRef Other) const |
Return true if the given string is a substring of *this, and false otherwise. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | contains_lower (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< std::numeric_limits< T >::is_signed, bool >::type | getAsInteger (unsigned Radix, T &Result) const |
Parse the current string as an integer of the specified radix. More... | |
template<typename T > | |
std::enable_if<!std::numeric_limits< T >::is_signed, bool >::type | getAsInteger (unsigned Radix, T &Result) const |
template<typename T > | |
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type | consumeInteger (unsigned Radix, T &Result) |
Parse the current string as an integer of the specified radix. More... | |
template<typename T > | |
std::enable_if<!std::numeric_limits< T >::is_signed, bool >::type | 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 LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | substr (size_t Start, size_t N=npos) const |
Return a reference to the substring from [Start, Start + N). More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE 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 LLVM_ATTRIBUTE_ALWAYS_INLINE 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 LLVM_ATTRIBUTE_ALWAYS_INLINE 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 LLVM_ATTRIBUTE_ALWAYS_INLINE 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 LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | drop_front (size_t N=1) const |
Return a StringRef equal to 'this' but with the first N elements dropped. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | drop_back (size_t N=1) const |
Return a StringRef equal to 'this' but with the last N elements dropped. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE 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 LLVM_ATTRIBUTE_ALWAYS_INLINE 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... | |
LLVM_ATTRIBUTE_ALWAYS_INLINE bool | consume_front (StringRef Prefix) |
Returns true if this StringRef has the given prefix and removes that prefix. More... | |
LLVM_ATTRIBUTE_ALWAYS_INLINE bool | consume_back (StringRef Suffix) |
Returns true if this StringRef has the given suffix and removes that suffix. More... | |
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE 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=" \\\) 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=" \\\) 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=" \\\) const |
Return string with consecutive characters in Chars starting from the left and right removed. More... | |
Static Public Attributes | |
static const size_t | npos = ~size_t(0) |
Constructors | |
StringRef ()=default | |
Construct an empty string ref. More... | |
StringRef (std::nullptr_t)=delete | |
Disable conversion from nullptr. More... | |
LLVM_ATTRIBUTE_ALWAYS_INLINE | StringRef (const char *Str) |
Construct a string ref from a cstring. More... | |
LLVM_ATTRIBUTE_ALWAYS_INLINE constexpr | StringRef (const char *data, size_t length) |
Construct a string ref from a pointer and length. More... | |
LLVM_ATTRIBUTE_ALWAYS_INLINE | StringRef (const std::string &Str) |
Construct a string ref from an std::string. More... | |
static StringRef | withNullAsEmpty (const char *data) |
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 49 of file StringRef.h.
using llvm::StringRef::const_iterator = const char * |
Definition at line 54 of file StringRef.h.
using llvm::StringRef::iterator = const char * |
Definition at line 53 of file StringRef.h.
using llvm::StringRef::size_type = size_t |
Definition at line 55 of file StringRef.h.
|
default |
Construct an empty string ref.
Referenced by copy(), rsplit(), split(), and withNullAsEmpty().
|
delete |
Disable conversion from nullptr.
This prevents things like if (S == nullptr)
|
inline |
Construct a string ref from a cstring.
Definition at line 85 of file StringRef.h.
References LLVM_ATTRIBUTE_ALWAYS_INLINE.
|
inline |
Construct a string ref from a pointer and length.
Definition at line 90 of file StringRef.h.
References LLVM_ATTRIBUTE_ALWAYS_INLINE.
|
inline |
Construct a string ref from an std::string.
Definition at line 95 of file StringRef.h.
|
inline |
back - Get the last character in the string.
Definition at line 149 of file StringRef.h.
References assert(), and empty().
Referenced by llvm::vfs::YAMLVFSWriter::addFileMapping(), llvm::CodeViewDebug::CodeViewDebug(), FindFirstMatchingPrefix(), llvm::opt::OptTable::findNearest(), getTypeNamePrefix(), llvm::ConstantDataSequential::isCString(), optimizeDoubleFP(), llvm::parseCachePruningPolicy(), parseDuration(), llvm::FileCheckPattern::ParsePattern(), parsePhysicalReg(), PrintCFIEscape(), PrintQuotedString(), srcMgrDiagHandler(), truncateToSize(), and unescapeQuotedString().
|
inline |
Definition at line 106 of file StringRef.h.
Referenced by llvm::SmallString< 256 >::append(), llvm::sys::path::append(), llvm::pdb::NamedStreamMap::appendStringData(), llvm::SmallString< 256 >::assign(), llvm::MDString::begin(), bytes_begin(), llvm::ItaniumManglingCanonicalizer::canonicalize(), canTransformToMemCmp(), chopOneUTF32(), llvm::detail::IEEEFloat::convertFromString(), llvm::detail::IEEEFloat::convertFromZeroExtendedInteger(), llvm::convertUTF8ToUTF16String(), llvm::ConvertUTF8toWide(), copy(), CountNumNewlinesBetween(), llvm::sys::fs::createTemporaryFile(), decodeUTF8(), llvm::MCObjectStreamer::EmitBytes(), emitSignedInt64(), llvm::yaml::escape(), getAttrKindEncoding(), llvm::APInt::getBitsNeeded(), llvm::MemoryBufferRef::getBufferStart(), llvm::sys::detail::getHostCPUNameForPowerPC(), getHostID(), llvm::TGLexer::getLoc(), llvm::object::Archive::Symbol::getName(), llvm::object::Archive::getNumberOfSymbols(), llvm::StringToOffsetTable::GetOrAddStringOffset(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::getRecords(), llvm::object::ELFFile< ELFT >::getRelocationTypeName(), llvm::object::WasmObjectFile::getRelocationTypeName(), llvm::object::MachOObjectFile::getRelocationTypeName(), llvm::object::COFFObjectFile::getRelocationTypeName(), llvm::ConstantDataArray::getString(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::yaml::ScalarNode::getValue(), llvm::TextInstrProfReader::hasFormat(), llvm::hash_value(), llvm::pdb::hashStringV2(), llvm::detail::IEEEFloat::IEEEFloat(), llvm::Timer::init(), llvm::TGLexer::Lex(), llvm::pdb::NamedStreamMap::load(), llvm::MIToken::location(), llvm::ItaniumManglingCanonicalizer::lookup(), llvm::sys::fs::make_absolute(), mangleCoveragePath(), llvm::object::MachOUniversalBinary::ObjectForArch::ObjectForArch(), llvm::SmallString< 256 >::operator+=(), llvm::sys::path::const_iterator::operator==(), llvm::sys::path::reverse_iterator::operator==(), llvm::object::Archive::Child::operator==(), llvm::opt::OptTable::OptTable(), llvm::InlineAsm::ConstraintInfo::Parse(), llvm::InlineAsm::ParseConstraints(), parsePhysicalReg(), printName(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::reconstituteName(), llvm::sys::path::replace_extension(), llvm::AsmLexer::setBuffer(), llvm::EngineBuilder::setMArch(), llvm::EngineBuilder::setMCPU(), llvm::TimerGroup::setName(), llvm::yaml::Document::skip(), llvm::Regex::sub(), llvm::object::Archive::symbol_begin(), llvm::TGLexer::TGLexer(), llvm::cl::tokenizeConfigFile(), llvm::APInt::usub_sat(), and llvm::ValueSymbolTable::~ValueSymbolTable().
|
inline |
Definition at line 116 of file StringRef.h.
References bytes_begin(), bytes_end(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and llvm::make_range().
Referenced by llvm::ConstantFoldLoadFromConstPtr(), llvm::djbHash(), llvm::MCTargetStreamer::emitRawBytes(), and PrintQuotedString().
Definition at line 110 of file StringRef.h.
References begin().
Referenced by llvm::arrayRefFromStringRef(), bytes(), llvm::MDString::bytes_begin(), llvm::codeview::consume(), llvm::NVPTXTargetStreamer::emitRawBytes(), promoteToConstantPool(), llvm::xray::readBinaryFormatHeader(), rotateSign(), and llvm::xxHash64().
Definition at line 113 of file StringRef.h.
References end().
Referenced by llvm::arrayRefFromStringRef(), bytes(), llvm::MDString::bytes_end(), llvm::codeview::consume(), promoteToConstantPool(), rotateSign(), and llvm::xxHash64().
|
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 184 of file StringRef.h.
References compare_lower(), compare_numeric(), edit_distance(), LLVM_NODISCARD, and Other.
Referenced by canTransformToMemCmp(), llvm::FunctionComparator::cmpMem(), llvm::SmallString< 256 >::compare(), compareNames(), llvm::operator<(), llvm::operator<=(), llvm::operator>(), llvm::operator>=(), and llvm::opt::OptTable::suggestValueCompletions().
int StringRef::compare_lower | ( | StringRef | RHS | ) | const |
compare_lower - Compare two strings, ignoring case.
compare_lower - Compare strings, ignoring case.
Definition at line 38 of file StringRef.cpp.
References ascii_strncasecmp().
Referenced by compare(), llvm::SmallString< 256 >::compare_lower(), equals_lower(), gsiRecordLess(), parseHexOcta(), and llvm::DetectRoundChange::runOnMachineFunction().
int StringRef::compare_numeric | ( | StringRef | RHS | ) | const |
compare_numeric - Compare two strings, treating sequences of digits as numbers.
compare_numeric - Compare strings, handle embedded numbers.
Definition at line 64 of file StringRef.cpp.
References E, I, and llvm::isDigit().
Referenced by compare(), and llvm::SmallString< 256 >::compare_numeric().
|
inline |
Returns true if this StringRef has the given suffix and removes that suffix.
Definition at line 689 of file StringRef.h.
References drop_back(), endswith(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and size().
Referenced by checkParametrizedPassName(), parseDevirtPassName(), and parseRepeatPassName().
|
inline |
Returns true if this StringRef has the given prefix and removes that prefix.
Definition at line 678 of file StringRef.h.
References drop_front(), LLVM_ATTRIBUTE_ALWAYS_INLINE, size(), and startswith().
Referenced by checkParametrizedPassName(), llvm::detail::HelperFunctions::consumeHexStyle(), llvm::format_provider< T, typename std::enable_if< detail::use_integral_formatter< T >::value >::type >::format(), llvm::format_provider< T, typename std::enable_if< detail::use_double_formatter< T >::value >::type >::format(), llvm::Triple::getOSVersion(), isLoopPassName(), parseDevirtPassName(), and parseRepeatPassName().
|
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 531 of file StringRef.h.
References llvm::consumeSignedInteger().
Referenced by llvm::formatv_object_base::consumeFieldLayout(), llvm::detail::HelperFunctions::consumeNumHexDigits(), llvm::format_provider< T, typename std::enable_if< detail::use_integral_formatter< T >::value >::type >::format(), llvm::formatv_object_base::parseReplacementItem(), and llvm::SIMachineFunctionInfo::SIMachineFunctionInfo().
|
inline |
Definition at line 542 of file StringRef.h.
References llvm::consumeUnsignedInteger(), getAsDouble(), getAsInteger(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, lower(), and upper().
|
inline |
Return true if the given string is a substring of *this, and false otherwise.
Definition at line 448 of file StringRef.h.
References find(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and npos.
Referenced by llvm::object::getNameType(), llvm::GCNSubtarget::initializeSubtargetDependencies(), instrumentMaskedLoadOrStore(), llvm::object::isDecorated(), llvm::PassArgFilter< Args >::operator()(), llvm::WholeProgramDevirtPass::run(), useStringTable(), llvm::Function::viewCFG(), llvm::Function::viewCFGOnly(), writeCFGToDotFile(), and llvm::PrintIRInstrumentation::~PrintIRInstrumentation().
|
inline |
Return true if the given character is contained in *this, and false otherwise.
Definition at line 454 of file StringRef.h.
References find_first_of(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and npos.
|
inline |
Return true if the given string is a substring of *this, and false otherwise.
Definition at line 460 of file StringRef.h.
References find_lower(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and npos.
|
inline |
Return true if the given character is contained in *this, and false otherwise.
Definition at line 468 of file StringRef.h.
References find_lower(), LLVM_NODISCARD, and npos.
|
inline |
Definition at line 156 of file StringRef.h.
References begin(), llvm::copy(), empty(), end(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and StringRef().
Referenced by llvm::yaml::Document::parseBlockNode().
|
inline |
Return the number of occurrences of C
in the string.
Definition at line 476 of file StringRef.h.
Referenced by llvm::SmallString< 256 >::count(), FindFirstMatchingPrefix(), llvm::HexagonInstrInfo::getInlineAsmLength(), and llvm::InlineAsm::ConstraintInfo::Parse().
size_t StringRef::count | ( | StringRef | Str | ) | const |
|
inline |
data - Get a pointer to the start of the string (which may not be null terminated).
Definition at line 128 of file StringRef.h.
References LLVM_ATTRIBUTE_ALWAYS_INLINE, and LLVM_NODISCARD.
Referenced by llvm::SourceMgr::AddIncludeFile(), llvm::FoldingSetNodeID::AddString(), annotateAllFunctions(), llvm::object::ELFFile< ELFT >::base(), llvm::CachedHashString::CachedHashString(), canTransformToMemCmp(), llvm::FileCheckString::CheckNext(), llvm::FileCheckString::CheckSame(), llvm::zlib::compress(), llvm::ConvertUTF8toWide(), CopyStringRef(), llvm::zlib::crc32(), llvm::StringMapEntry< llvm::Comdat >::Create(), llvm::X86Operand::CreateToken(), llvm::NVPTXAsmPrinter::doFinalization(), llvm::DWARFDebugPubTable::dump(), llvm::DWARFListTableHeader::dump(), llvm::DWARFDebugLine::Prologue::dump(), edit_distance(), llvm::BitstreamWriter::emitBlob(), EmitFileEntry(), llvm::InstrProfRecordWriterTrait::EmitKey(), llvm::DWARFYAML::EmitPubSection(), llvm::RuntimeDyldImpl::emitSection(), encodeCnt(), llvm::cl::Option::error(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::BitstreamWriter::ExitBlock(), llvm::DWARFFormValue::extractValue(), llvm::AccelTableBase::finalize(), FindFirstMatchingPrefix(), llvm::pdb::DIASession::findSourceFiles(), llvm::json::fixUTF8(), llvm::RuntimeDyldCOFFX86_64::generateRelocationStub(), llvm::irsymtab::storage::Str::get(), llvm::object::ArchiveMemberHeader::getAccessMode(), llvm::object::Archive::Child::getBuffer(), llvm::object::Archive::Child::getChildOffset(), llvm::DataExtractor::getCStr(), getFilename(), llvm::object::ArchiveMemberHeader::getGID(), llvm::sampleprof::FunctionSamples::getGUID(), llvm::DenseMapInfo< StringRef >::getHashValue(), getID(), llvm::HexagonInstrInfo::getInlineAsmLength(), llvm::object::ArchiveMemberHeader::getLastModified(), getMemBufferCopyImpl(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::Elf_Sym_Impl< ELFT >::getName(), llvm::sampleprof::FunctionSamples::getNameInModule(), llvm::object::Archive::Child::getNext(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::object::ArchiveMemberHeader::getRawName(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::RuntimeDyldMachO::getRelocationValueRef(), llvm::object::ELFFile< ELFT >::getSectionName(), llvm::object::ArchiveMemberHeader::getSize(), llvm::ConstantDataArray::getString(), llvm::DataExtractor::getU16(), llvm::DataExtractor::getU24(), llvm::DataExtractor::getU32(), llvm::DataExtractor::getU64(), llvm::DataExtractor::getU8(), llvm::object::ArchiveMemberHeader::getUID(), getUnderlyingArgReg(), llvm::AMDGPUMangledLibFunc::getUnmangledName(), gsiRecordLess(), llvm::SHA1::hash(), llvm::pdb::hashStringV1(), llvm::MIRParserImpl::initializeJumpTableInfo(), llvm::ExecutionEngine::InitializeMemory(), llvm::yaml::ScalarTraits< char_16 >::input(), isAsmComment(), llvm::DenseMapInfo< StringRef >::isEqual(), llvm::json::isUTF8(), LLVMDITypeGetName(), LLVMGetAsString(), LLVMGetDebugLocDirectory(), LLVMGetDebugLocFilename(), LLVMGetNamedMetadataName(), LLVMGetSectionContents(), LLVMGetSectionName(), LLVMGetStructName(), LLVMTargetMachineEmitToMemoryBuffer(), loadTestingFormat(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::TargetIntrinsicInfo::lookupName(), llvm::LTOModule::makeBuffer(), llvm::Regex::match(), llvm::FileCheckPattern::Match(), matchPair(), llvm::sys::path::native(), llvm::MCJIT::notifyFreeingObject(), llvm::MCJIT::notifyObjectLoaded(), llvm::operator+=(), llvm::raw_ostream::operator<<(), llvm::cl::ParseEnvironmentOptions(), llvm::FileCheckPattern::ParsePattern(), parseTypeIdSummaryRecord(), parseV2DirFileTables(), parseWholeProgramDevirtResolution(), llvm::PassNameParser::passRegistered(), llvm::AsmLexer::peekTokens(), llvm::X86Operand::print(), llvm::ScopedPrinter::printBinary(), llvm::ScopedPrinter::printBinaryBlock(), llvm::FileCheckPattern::PrintFuzzyMatch(), llvm::FileCheckPattern::PrintVariableUses(), llvm::RuntimeDyldELF::processRelocationRef(), ProvideOption(), llvm::irsymtab::readBitcode(), llvm::FileCheck::ReadCheckFile(), readCoverageMappingData(), llvm::GCOVBuffer::readInt(), llvm::readPGOFuncNameStrings(), llvm::Regex::Regex(), llvm::report_fatal_error(), llvm::StringSaver::save(), llvm::X86Operand::setTokenValue(), StackMallocSizeClass(), llvm::cl::TokenizeGNUCommandLine(), llvm::cl::TokenizeWindowsCommandLine(), llvm::codeview::TypeServer2Record::TypeServer2Record(), llvm::zlib::uncompress(), llvm::SHA1::update(), llvm::MD5::update(), llvm::yaml::MappingTraits< ELFYAML::Symbol >::validate(), llvm::StringTableBuilder::write(), writeIdentificationBlock(), and writeUstarHeader().
|
inline |
Return a StringRef equal to 'this' but with the last N
elements dropped.
Definition at line 654 of file StringRef.h.
References assert(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, N, size(), and substr().
Referenced by consume_back(), llvm::GlobPattern::create(), encodeCnt(), hasPrefix(), intToken(), llvm::ConstantDataSequential::isCString(), isReportingError(), makeCombineInst(), mapNameAndUniqueName(), llvm::yaml::Document::parseBlockNode(), llvm::parseCachePruningPolicy(), rtrim(), smallData(), and take_front().
|
inline |
Return a StringRef equal to 'this' but with the first N
elements dropped.
Definition at line 645 of file StringRef.h.
References assert(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, N, size(), and substr().
Referenced by llvm::caseFoldingDjbHash(), chopOneUTF32(), consume_front(), llvm::formatv_object_base::consumeFieldLayout(), llvm::consumeSignedInteger(), llvm::GlobPattern::create(), llvm::DWARFGdbIndex::dump(), dumpLoclistsSection(), emitNullTerminatedSymbolName(), encodeCnt(), ExpandResponseFile(), find_if(), find_lower(), FindCheckType(), FindFirstMatchingPrefix(), llvm::opt::OptTable::findNearest(), findTargetSubtable(), llvm::fromHex(), llvm::getFuncNameWithoutPrefix(), llvm::InstrProfSymtab::getOrigFuncName(), llvm::getTypeName(), isWeak(), lexName(), ltrim(), MatchCoprocessorOperandName(), matchSVEPredicateVectorRegName(), llvm::PassInfoMixin< PromotePass >::name(), llvm::formatv_object_base::parseReplacementItem(), printSourceLine(), llvm::FileCheck::ReadCheckFile(), RefineErrorLoc(), llvm::formatv_object_base::splitLiteralAndReplacement(), take_back(), 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 671 of file StringRef.h.
References F(), find_if(), LLVM_ATTRIBUTE_ALWAYS_INLINE, 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 663 of file StringRef.h.
References F(), find_if_not(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, 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 95 of file StringRef.cpp.
References llvm::ComputeEditDistance(), data(), llvm::makeArrayRef(), and size().
Referenced by compare(), llvm::opt::OptTable::findNearest(), LookupNearestOption(), and llvm::FileCheckPattern::Match().
|
inline |
empty - Check if the string is empty.
Definition at line 133 of file StringRef.h.
References LLVM_ATTRIBUTE_ALWAYS_INLINE, and LLVM_NODISCARD.
Referenced by llvm::SubtargetFeatures::AddFeature(), llvm::CodeViewContext::addFile(), llvm::vfs::YAMLVFSWriter::addFileMapping(), llvm::InstrProfSymtab::addFuncName(), llvm::ExecutionEngine::addGlobalMapping(), llvm::DwarfUnit::addLinkageName(), llvm::DIEHash::addSLEB128(), llvm::CodeViewContext::addToStringTable(), llvm::cl::basic_parser_impl::anchor(), llvm::DwarfCompileUnit::applyLabelAttributes(), llvm::DwarfUnit::applySubprogramAttributes(), llvm::DwarfUnit::applySubprogramDefinitionAttributes(), llvm::DwarfCompileUnit::applyVariableAttributes(), llvm::APSInt::APSInt(), back(), llvm::BinaryStreamError::BinaryStreamError(), branchDiv(), llvm::DICompositeType::buildODRType(), llvm::canRenameComdatFunc(), canTransformToMemCmp(), llvm::caseFoldingDjbHash(), checkFeature(), checkFunctionsAttributeConsistency(), checkParametrizedPassName(), chopOneUTF32(), CloneInstructionInExitBlock(), llvm::pdb::PDBFileBuilder::commit(), llvm::DIEHash::computeCUSignature(), llvm::ARM::computeDefaultTargetABI(), llvm::MipsABIInfo::computeTargetABI(), computeTargetABI(), llvm::ConstantFoldLoadFromConstPtr(), llvm::DwarfCompileUnit::constructImportedEntityDIE(), llvm::DwarfUnit::constructTypeDIE(), llvm::formatv_object_base::consumeFieldLayout(), llvm::consumeSignedInteger(), llvm::consumeUnsignedInteger(), llvm::detail::IEEEFloat::convertFromString(), llvm::convertUTF8ToUTF16String(), copy(), copyFeaturesToFunction(), CopyStringRef(), CountNumNewlinesBetween(), llvm::GlobPattern::create(), llvm::StructType::create(), llvm::vfs::RedirectingFileSystem::create(), llvm::sys::fs::create_directories(), createAArch64MCSubtargetInfo(), llvm::MDBuilder::createAnonymousAARoot(), llvm::ARM_MC::createARMMCSubtargetInfo(), llvm::DIBuilder::createBasicType(), llvm::DIBuilder::createEnumerator(), llvm::DIBuilder::createMacro(), llvm::createSanitizerCtorAndInitFunctions(), createSparcMCSubtargetInfo(), llvm::sys::fs::createTemporaryFile(), llvm::DIBuilder::createUnspecifiedType(), llvm::X86_MC::createX86MCSubtargetInfo(), llvm::declareSanitizerInitFunction(), decodeBase64StringEntry(), llvm::DelimitedScope< Open, Close >::DelimitedScope(), llvm::GlobalValue::dropLLVMManglingEscape(), llvm::MCInst::dump_pretty(), dumpAttribute(), dumpLocation(), EatNumber(), llvm::CodeGenCoverage::emit(), emitComments(), emitDebugLabelComment(), emitDebugRangesImpl(), emitDebugValueComment(), emitDirectiveRelocJalr(), EmitGenDwarfAbbrev(), llvm::TargetLoweringObjectFileELF::emitModuleMetadata(), llvm::TargetLoweringObjectFileMachO::emitModuleMetadata(), llvm::TargetLoweringObjectFileCOFF::emitModuleMetadata(), emitOneV5FileEntry(), llvm::X86FrameLowering::emitPrologue(), llvm::ARMTargetStreamer::emitTargetAttributes(), llvm::WithColor::error(), llvm::cl::Option::error(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::coverage::CounterMappingContext::evaluate(), ExpandCryptoAEK(), llvm::DWARFFormValue::extractValue(), llvm::RuntimeDyldImpl::finalizeAsync(), find_if(), FindFirstMatchingPrefix(), FindFirstNonCommonLetter(), llvm::CodeExtractor::findInputsOutputs(), llvm::opt::OptTable::findNearest(), llvm::pdb::DIASession::findSourceFiles(), llvm::symbolize::LLVMSymbolizer::flush(), llvm::foldBlockIntoPredecessor(), llvm::format_provider< T, typename std::enable_if< detail::use_integral_formatter< T >::value >::type >::format(), llvm::format_provider< std::chrono::duration< Rep, Period > >::format(), llvm::format_provider< T, typename std::enable_if< detail::use_string_formatter< T >::value >::type >::format(), llvm::format_provider< T, typename std::enable_if< detail::use_char_formatter< T >::value >::type >::format(), llvm::format_provider< Enum, typename std::enable_if< dwarf::EnumTraits< Enum >::value >::type >::format(), llvm::format_provider< llvm::json::Value >::format(), llvm::fromHex(), front(), FunctionNumber(), llvm::Attribute::get(), getAddrSpace(), GetAEABIUnwindPersonalityName(), getARClassRegisterMask(), llvm::Triple::getARMCPUForArch(), getAsInteger(), llvm::getAsSignedInteger(), llvm::getAsUnsignedInteger(), getAttrKindEncoding(), GetAutoSenseRadix(), llvm::getBitcodeFileContents(), llvm::APInt::getBitsNeeded(), llvm::ARM::getCanonicalArchName(), llvm::DINode::getCanonicalMDString(), llvm::DIMacroNode::getCanonicalMDString(), getChompedLineBreaks(), llvm::MCContext::getCOFFSection(), getCommonClassOptions(), llvm::getCPU(), getELFKindForNamedSection(), llvm::SubtargetFeatures::getFeatureBits(), getFilename(), llvm::InstrProfSymtab::getFuncNameOrExternalSymbol(), llvm::getFuncNameWithoutPrefix(), llvm::object::ArchiveMemberHeader::getGID(), llvm::GlobalValue::getGlobalIdentifier(), getGNUBinOpPrecedence(), getGPUOrDefault(), getItineraryLatency(), llvm::object::MachOObjectFile::getLibraryShortNameByIndex(), getLinkageNameWithSpace(), llvm::getMemOPSizeRangeFromOption(), llvm::Value::getName(), getNameWithPrefixImpl(), getNodeVisualName(), llvm::DICompositeType::getODRTypeIfExists(), getOpEnabled(), getOpRefinementSteps(), llvm::getOrCreateInitFunction(), llvm::DwarfUnit::getOrCreateModule(), llvm::DwarfUnit::getOrCreateNameSpace(), llvm::getOrCreateSanitizerCtorAndInitFunctions(), llvm::MCContext::getOrCreateSymbol(), llvm::DwarfUnit::getParentContextString(), getPassInfo(), getPassNameAndInstanceNum(), getPrettyScopeName(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::getRecords(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::sampleprof::getRepInFormat(), llvm::TargetLibraryInfoImpl::getScalarizedFunction(), getSearchPaths(), llvm::DataExtractor::getSLEB128(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), GetSymbolFromOperand(), getSymbolKindName(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::lto::getThinLTOOutputFile(), llvm::getTypeName(), llvm::object::ArchiveMemberHeader::getUID(), llvm::DataExtractor::getULEB128(), getUnderlyingArgReg(), getUnicodeEncoding(), llvm::yaml::ScalarNode::getValue(), getValueStr(), llvm::TargetLibraryInfoImpl::getVectorizedFunction(), llvm::yaml::Node::getVerbatimTag(), llvm::DWARFVerifier::handleAccelTables(), llvm::DWARFVerifier::handleDebugAbbrev(), 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(), hasConflictingReferenceFlags(), hasFlag(), hasPrefix(), llvm::object::Archive::hasSymbolTable(), llvm::HexagonGetLastSlot(), llvm::PassNameParser::ignorablePass(), llvm::vfs::VFSFromYamlDirIterImpl::increment(), incrementLoc(), initializeRecordStreamer(), llvm::NVPTXSubtarget::initializeSubtargetDependencies(), llvm::MCSubtargetInfo::InitMCProcessorInfo(), llvm::StringSet< AllocatorTy >::insert(), llvm::MachineRegisterInfo::insertVRegByName(), instrumentMaskedLoadOrStore(), isCanonical(), isEnabled(), llvm::TargetLibraryInfoImpl::isFunctionVectorizable(), isIdentifierChar(), isInSymtab(), isLoopPassName(), isOperator(), isRepeatedByteSequence(), isReportingError(), isSDKVersionToken(), isValidEncoding(), llvm::MCAsmInfo::isValidUnquotedName(), isXor1OfSetCC(), llvm::ARMSubtarget::isXRaySupported(), llvm::LoadAndStorePromoter::LoadAndStorePromoter(), loadBinaryFormat(), loadTestingFormat(), LookupNearestOption(), llvm::yaml::MappingTraits< DWARFYAML::FormValue >::mapping(), llvm::yaml::MappingTraits< DWARFYAML::LineTableOpcode >::mapping(), llvm::codeview::CodeViewRecordIO::mapStringZVectorZ(), llvm::GlobPattern::match(), llvm::FileCheckPattern::Match(), matchAsm(), maybePrintComdat(), needsRuntimeRegistrationOfSectionRange(), llvm::Triple::normalize(), llvm::WithColor::note(), llvm::cl::SubCommand::operator bool(), llvm::operator<<(), llvm::DWARFGdbIndex::parse(), llvm::DWARFDebugFrame::parse(), llvm::AMDGPULibFunc::parse(), llvm::PassBuilder::parseAAPipeline(), parseARMArch(), llvm::ARM_MC::ParseARMTriple(), parseDuration(), llvm::formatv_object_base::parseFormatString(), parseHexOcta(), parseInt(), parseNamePrefix(), llvm::detail::HelperFunctions::parseNumericPrecision(), llvm::FileCheckPattern::ParsePattern(), llvm::formatv_object_base::parseReplacementItem(), llvm::MCSectionMachO::ParseSectionSpecifier(), parseSubArch(), parseV2DirFileTables(), parseVersionFromName(), pathHasTraversal(), previousIsLoop(), llvm::MCExpr::print(), llvm::DWARFExpression::Operation::print(), llvm::MachineOperand::print(), llvm::MCInstPrinter::printAnnotation(), llvm::AArch64InstPrinter::printBarrierOption(), printCFI(), PrintCFIEscape(), printDwarfFileDirective(), printExtendedName(), printFile(), llvm::FileCheckPattern::PrintFuzzyMatch(), PrintLLVMName(), llvm::printLLVMNameWithoutPrefix(), printMetadataIdentifier(), llvm::cl::generic_parser_base::printOptionInfo(), PrintQuotedString(), llvm::MachineOperand::printStackObjectReference(), llvm::MCSectionMachO::PrintSwitchToSection(), printSymbolizedStackTrace(), llvm::codeview::printTypeIndex(), llvm::AttributeImpl::Profile(), llvm::pruneCache(), llvm::SymbolRemappingReader::read(), llvm::GCOVBuffer::readArcTag(), llvm::AppleAcceleratorTable::readAtoms(), llvm::irsymtab::readBitcode(), llvm::GCOVBuffer::readBlockTag(), llvm::FileCheck::ReadCheckFile(), llvm::GCOVBuffer::readEdgeTag(), llvm::GCOVBuffer::readFunctionTag(), llvm::GCOVBuffer::readLineTag(), llvm::GCOVBuffer::readObjectTag(), llvm::GCOVBuffer::readProgramTag(), llvm::LessRecordRegister::RecordParts::RecordParts(), RefineErrorLoc(), llvm::WithColor::remark(), llvm::sys::path::replace_path_prefix(), llvm::HexagonMCChecker::reportBranchErrors(), llvm::cl::ResetAllOptionOccurrences(), llvm::RuntimeDyldImpl::resolveExternalSymbols(), resolveFwdRef(), rewritesSort(), runOnFunction(), sanitizeFunctionName(), llvm::StringSaver::save(), llvm::Hexagon_MC::selectHexagonCPU(), llvm::MIPS_MC::selectMipsCPU(), llvm::EngineBuilder::selectTarget(), llvm::cl::Option::setArgStr(), llvm::StructType::setName(), setRequiredFeatureString(), llvm::GlobalObject::setSection(), llvm::lto::setupOptimizationRemarks(), llvm::DwarfDebug::shareAcrossDWOCUs(), shouldAlwaysEmitCompleteClassType(), shouldEmitUdt(), llvm::SIMachineFunctionInfo::SIMachineFunctionInfo(), sortSubCommands(), split(), split(), llvm::DISubprogram::splitFlags(), srcMgrDiagHandler(), llvm::StripDebugInfo(), StripTypeNames(), llvm::Regex::sub(), llvm::to_hexString(), truncateToSize(), llvm::MCDwarfLineTableHeader::tryGetFile(), llvm::VersionTuple::tryParse(), llvm::DwarfUnit::updateAcceleratorTables(), llvm::ExecutionEngine::updateGlobalMapping(), UsesVectorABI(), llvm::APInt::usub_sat(), llvm::InlineAsm::Verify(), llvm::WithColor::warning(), llvm::InnerLoopVectorizer::widenInstruction(), llvm::StringTableBuilder::write(), writeGeneratedObject(), and writeSymbolTable().
|
inline |
Definition at line 108 of file StringRef.h.
Referenced by llvm::SmallString< 256 >::append(), llvm::sys::path::append(), llvm::pdb::NamedStreamMap::appendStringData(), llvm::SmallString< 256 >::assign(), bytes_end(), llvm::ItaniumManglingCanonicalizer::canonicalize(), canTransformToMemCmp(), llvm::FileCheckString::CheckNext(), llvm::FileCheckString::CheckSame(), chopOneUTF32(), llvm::detail::IEEEFloat::convertFromZeroExtendedInteger(), llvm::convertUTF8ToUTF16String(), llvm::ConvertUTF8toWide(), copy(), llvm::MCObjectStreamer::EmitBytes(), emitSignedInt64(), llvm::MDString::end(), endswith(), endswith_lower(), llvm::yaml::escape(), getAttrKindEncoding(), llvm::MemoryBufferRef::getBufferEnd(), llvm::sys::detail::getHostCPUNameForPowerPC(), getHostID(), llvm::TGLexer::getLoc(), llvm::StringToOffsetTable::GetOrAddStringOffset(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::getRecords(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::object::ELFFile< ELFT >::getRelocationTypeName(), llvm::object::WasmObjectFile::getRelocationTypeName(), llvm::object::MachOObjectFile::getRelocationTypeName(), llvm::object::COFFObjectFile::getRelocationTypeName(), llvm::ConstantDataArray::getString(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::yaml::ScalarNode::getValue(), llvm::hash_value(), llvm::pdb::hashStringV2(), llvm::detail::IEEEFloat::IEEEFloat(), llvm::Timer::init(), IsIdentifierChar(), llvm::AsmLexer::LexToken(), llvm::AsmLexer::LexUntilEndOfStatement(), llvm::line_iterator::line_iterator(), llvm::pdb::NamedStreamMap::load(), llvm::ItaniumManglingCanonicalizer::lookup(), llvm::sys::fs::make_absolute(), mangleCoveragePath(), llvm::SmallString< 256 >::operator+=(), llvm::opt::OptTable::OptTable(), llvm::InlineAsm::ConstraintInfo::Parse(), llvm::InlineAsm::ParseConstraints(), parsePhysicalReg(), parseRegisterNumber(), printName(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::reconstituteName(), llvm::Regex::Regex(), llvm::sys::path::replace_extension(), llvm::AsmLexer::setBuffer(), llvm::EngineBuilder::setMArch(), llvm::EngineBuilder::setMCPU(), llvm::TimerGroup::setName(), llvm::Regex::sub(), llvm::cl::tokenizeConfigFile(), llvm::APInt::usub_sat(), and llvm::ValueSymbolTable::~ValueSymbolTable().
|
inline |
Check if this string ends with the given Suffix
.
Definition at line 279 of file StringRef.h.
References end(), endswith_lower(), LLVM_ATTRIBUTE_ALWAYS_INLINE, and LLVM_NODISCARD.
Referenced by checkParametrizedPassName(), consume_back(), llvm::GlobPattern::create(), dumpTypeTagName(), encodeCnt(), llvm::StringSwitch< T, R >::EndsWith(), llvm::SmallString< 256 >::endswith(), llvm::StringTableBuilder::finalizeInOrder(), llvm::ARM::getCanonicalArchName(), llvm::sys::detail::getHostCPUNameForARM(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), getVarName(), isAnonymous(), llvm::GlobPattern::match(), llvm::matchPassManager(), llvm::parseAnalysisUtilityPasses(), llvm::ARM::parseArchEndian(), parseSubArch(), shouldBeSls(), and shouldInstrumentReadWriteFromAddress().
Check if this string ends with the given Suffix
, ignoring case.
Definition at line 53 of file StringRef.cpp.
References ascii_strncasecmp(), and end().
Referenced by endswith(), and llvm::StringSwitch< T, R >::EndsWithLower().
|
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 169 of file StringRef.h.
References LLVM_NODISCARD.
Referenced by llvm::TargetPassConfig::addMachinePasses(), llvm::MachineBlockFrequencyInfo::calculate(), llvm::BlockFrequencyInfo::calculate(), llvm::BranchProbabilityInfo::calculate(), llvm::detail::IEEEFloat::convertFromZeroExtendedInteger(), count(), llvm::createBlockExtractorPass(), llvm::SmallString< 256 >::equals(), llvm::findOptionMDForLoopID(), foldFPToIntToFP(), llvm::Triple::getARMCPUForArch(), llvm::FileInfo::getCoveragePath(), llvm::BasicBlock::getIrrLoopHeaderWeight(), getLayoutSuccessorProbThreshold(), getSummaryFromMD(), llvm::GetUnrollMetadata(), getVal(), llvm::getValueProfDataFromInst(), isGCSafepointPoll(), isKeyValuePair(), isSmallDataSection(), isTraversalComponent(), isUnconditionalBranch(), llvm::RuntimeDyldELF::loadObject(), llvm::log2(), makeStatepointExplicitImpl(), llvm::operator==(), llvm::CodeGenCoverage::parse(), llvm::SymbolRewriter::RewriteMapParser::parse(), parseBPFArch(), llvm::MIRParserImpl::parseRegisterInfo(), replaceShuffleOfInsert(), rfind(), llvm::runFuzzerOnInputs(), ShouldSignReturnAddress(), and truncateToSize().
|
inline |
equals_lower - Check for string equality, ignoring case.
Definition at line 176 of file StringRef.h.
References compare_lower(), LLVM_ATTRIBUTE_ALWAYS_INLINE, and LLVM_NODISCARD.
Referenced by addNegOperand(), asmClobbersCTR(), llvm::StringSwitch< T, R >::CaseLower(), llvm::SmallString< 256 >::equals_lower(), getEstimate(), getNextRegister(), llvm::ARMTargetLowering::getRegForInlineAsmConstraint(), llvm::PPCTargetLowering::getRegForInlineAsmConstraint(), llvm::HexagonMCInstrInfo::isOrderedDuplexPair(), matchSVEPredicateVectorRegName(), llvm::TextInstrProfReader::readHeader(), rfind_lower(), ShouldSignWithAKey(), and llvm::StrInStrNoCase().
|
inline |
Search for the first character C
in the string.
C
, or npos if not found. Definition at line 298 of file StringRef.h.
References C, find_lower(), From, LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, npos, and P.
Referenced by addNegOperand(), llvm::X86FrameLowering::adjustForHiPEPrologue(), canTransformToMemCmp(), checkLinkerOptCommand(), llvm::AnalysisManager< IRUnitT, ExtraArgTs >::clear(), CommaSeparateAndAddOccurrence(), contains(), llvm::createSampleProfileLoaderPass(), emitComments(), llvm::AMDGPU::HSAMD::MetadataStreamerV2::emitKernel(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::SmallString< 256 >::find(), find_first_of(), find_if_not(), llvm::ARM::getCanonicalArchName(), llvm::getConstantStringInfo(), llvm::DataExtractor::getCStr(), llvm::HexagonTargetObjectFile::getExplicitSectionGlobal(), llvm::getMemOPSizeRangeFromOption(), getObjCClassCategory(), getObjCMethodName(), llvm::object::ArchiveMemberHeader::getRawName(), llvm::getTypeName(), llvm::yaml::ScalarNode::getValue(), llvm::object::MachOObjectFile::guessLibraryShortName(), llvm::sampleprof::FunctionSamples::GUIDToFuncNameMapper::GUIDToFuncNameMapper(), hasObjCCategory(), llvm::MIRParserImpl::initializeJumpTableInfo(), instrumentMaskedLoadOrStore(), llvm::ConstantDataSequential::isCString(), llvm::objcarc::IsObjCIdentifiedObject(), isReportingError(), isSmallDataSection(), isWeak(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::FileCheckPattern::Match(), llvm::matchPassManager(), MCAttrForString(), llvm::cl::SubCommand::operator bool(), ParseLine(), llvm::FileCheckPattern::ParsePattern(), parseRefinementStep(), printSourceLine(), printSymbolizedStackTrace(), llvm::object::replace(), sanitizeFunctionName(), setRequiredFeatureString(), shouldBeSls(), shouldInstrumentBlock(), split(), UpgradeIntrinsicFunction1(), and llvm::sroa::AllocaSliceRewriter::visit().
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 133 of file StringRef.cpp.
References npos.
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 250 of file StringRef.cpp.
References npos.
Referenced by canTransformToMemCmp(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::SmallString< 256 >::find_first_not_of(), find_first_of(), llvm::symbolize::LLVMSymbolizer::flush(), ltrim(), matchAsm(), ParseLine(), printName(), PrintNoMatch(), llvm::FileCheck::ReadCheckFile(), llvm::Regex::sub(), and llvm::sroa::AllocaSliceRewriter::visit().
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 261 of file StringRef.cpp.
|
inline |
Find the first character in the string that is C
, or npos if not found.
Same as find.
Definition at line 395 of file StringRef.h.
References find(), find_first_not_of(), From, and LLVM_NODISCARD.
Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), canTransformToMemCmp(), contains(), CountNumNewlinesBetween(), llvm::sys::fs::createTemporaryFile(), llvm::SmallString< 256 >::find_first_of(), llvm::Value::getName(), llvm::InstrProfSymtab::getOrigFuncName(), llvm::yaml::ScalarNode::getValue(), hasWildcard(), llvm::Regex::isLiteralERE(), isLoopPassName(), llvm::yaml::Document::parseBlockNode(), ParseLine(), llvm::FileCheck::ReadCheckFile(), llvm::BinaryStreamReader::readCString(), llvm::formatv_object_base::splitLiteralAndReplacement(), and truncateToSize().
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 236 of file StringRef.cpp.
|
inline |
Search for the first character satisfying the predicate F
.
F
starting from From
, or npos if not found. Definition at line 321 of file StringRef.h.
References drop_front(), empty(), F(), From, front(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, npos, and size().
Referenced by drop_until(), find_if_not(), find_lower(), and take_until().
|
inline |
Search for the first character not satisfying the predicate F
.
F
starting from From
, or npos if not found. Definition at line 337 of file StringRef.h.
References F(), find(), find_if(), find_lower(), From, and LLVM_NODISCARD.
Referenced by drop_while(), and take_while().
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 291 of file StringRef.cpp.
References npos.
Referenced by find_last_of(), and rtrim().
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 302 of file StringRef.cpp.
|
inline |
Find the last character in the string that is C
, or npos if not found.
Definition at line 421 of file StringRef.h.
References find_last_not_of(), From, LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and rfind().
Referenced by llvm::sys::path::extension(), llvm::SmallString< 256 >::find_last_of(), llvm::SourceMgr::getLineAndColumn(), llvm::yaml::Node::getVerbatimTag(), ParseLine(), llvm::sys::path::replace_extension(), 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 277 of file StringRef.cpp.
size_t StringRef::find_lower | ( | 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 58 of file StringRef.cpp.
References D, find_if(), From, and llvm::toLower().
Referenced by contains_lower(), find(), and find_if_not().
size_t StringRef::find_lower | ( | StringRef | Str, |
size_t | From = 0 |
||
) | const |
Search for the first string Str
in the string, ignoring case.
Str
, or npos if not found. Definition at line 182 of file StringRef.cpp.
References drop_front(), From, npos, size(), startswith_lower(), and substr().
|
inline |
front - Get the first character in the string.
Definition at line 142 of file StringRef.h.
References assert(), empty(), and LLVM_NODISCARD.
Referenced by llvm::FileCheck::buildCheckPrefixRegex(), llvm::caseFoldingDjbHash(), llvm::consumeSignedInteger(), ExpandResponseFile(), find_if(), llvm::formLCSSAForInstructions(), llvm::fromHex(), getAddrSpace(), getAsInteger(), parseNamePrefix(), parsePhysicalReg(), llvm::formatv_object_base::parseReplacementItem(), RefineErrorLoc(), rewritePHIs(), SimplifyCondBranchToCondBranch(), truncateToSize(), and unescapeQuotedString().
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.
Definition at line 584 of file StringRef.cpp.
References llvm::APFloat::convertFromString(), llvm::APFloat::convertToDouble(), F(), llvm::APFloatBase::opInexact, llvm::APFloatBase::opOK, and llvm::APFloatBase::rmNearestTiesToEven.
Referenced by consumeInteger().
|
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 497 of file StringRef.h.
References llvm::getAsSignedInteger().
Referenced by addNegOperand(), adjustCallerStackProbeSize(), adjustMinLegalVectorWidth(), consumeInteger(), EmitGCCInlineAsmStr(), EmitMSInlineAsmStr(), llvm::X86FrameLowering::emitPrologue(), encodeCnt(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::format_provider< T, typename std::enable_if< detail::use_string_formatter< T >::value >::type >::format(), llvm::format_provider< llvm::json::Value >::format(), llvm::object::ArchiveMemberHeader::getAccessMode(), getEstimate(), llvm::object::ArchiveMemberHeader::getGID(), getInt(), llvm::AMDGPU::getIntegerAttribute(), llvm::object::ArchiveMemberHeader::getLastModified(), llvm::getMemOPSizeRangeFromOption(), llvm::object::ArchiveMemberHeader::getName(), getPassNameAndInstanceNum(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::object::COFFObjectFile::getSectionName(), llvm::object::ArchiveMemberHeader::getSize(), getSpecialRegForName(), getSubOpcode(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::object::ArchiveMemberHeader::getUID(), llvm::yaml::ScalarNode::getValue(), hasPrefix(), llvm::yaml::CustomMappingTraits< std::map< uint64_t, WholeProgramDevirtResolution > >::inputOne(), llvm::yaml::CustomMappingTraits< GlobalValueSummaryMapTy >::inputOne(), intToken(), matchSVEPredicateVectorRegName(), llvm::vfs::RedirectingFileSystemParser::parse(), llvm::parseCachePruningPolicy(), parseDevirtPassName(), parseDuration(), ParseHead(), ParseLine(), llvm::detail::HelperFunctions::parseNumericPrecision(), parseRepeatPassName(), parseSectionFlags(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::parseStatepointDirectivesFromAttrs(), printMCExpr(), llvm::cl::basic_parser_impl::printOptionName(), RefineErrorLoc(), llvm::StackProtector::runOnFunction(), llvm::Regex::sub(), llvm::to_integer(), WindowsRequiresStackProbe(), windowsRequiresStackProbe(), llvm::writeArchive(), and llvm::yaml::BinaryRef::writeAsBinary().
|
inline |
Definition at line 508 of file StringRef.h.
References llvm::getAsUnsignedInteger().
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 509 of file StringRef.cpp.
References assert(), empty(), front(), GetAutoSenseRadix(), llvm::APInt::getBitWidth(), size(), substr(), and llvm::APInt::zext().
std::string StringRef::lower | ( | ) | const |
Definition at line 108 of file StringRef.cpp.
References size(), and llvm::toLower().
Referenced by llvm::SubtargetFeatures::AddFeature(), llvm::pdb::PDBFileBuilder::addInjectedSource(), llvm::ARMCondCodeFromString(), CheckBaseRegAndIndexRegAndScale(), consumeInteger(), llvm::MipsTargetAsmStreamer::emitDirectiveCpLoad(), llvm::MipsTargetAsmStreamer::emitDirectiveCpsetup(), llvm::MipsTargetAsmStreamer::emitFrame(), EmitHiLo(), llvm::SparcTargetAsmStreamer::emitSparcRegisterIgnore(), llvm::SparcTargetAsmStreamer::emitSparcRegisterScratch(), GetAEABIUnwindPersonalityName(), getBankedRegisterMask(), getGNUBinOpPrecedence(), getNextRegister(), incrementLoc(), llvm::IsCPSRDead< MCInst >(), isMatchingOrAlias(), makeCombineInst(), matchSVEPredicateVectorRegName(), llvm::SymbolRewriter::RewriteMapParser::parse(), llvm::MipsAsmPrinter::printOperand(), llvm::printRegClassOrBank(), llvm::SparcInstPrinter::printRegName(), llvm::ARCInstPrinter::printRegName(), llvm::XCoreInstPrinter::printRegName(), llvm::LanaiInstPrinter::printRegName(), llvm::MipsInstPrinter::printRegName(), and setRequiredFeatureString().
|
inline |
Return string with consecutive Char
characters starting from the the left removed.
Definition at line 820 of file StringRef.h.
References drop_front(), find_first_not_of(), and LLVM_NODISCARD.
Referenced by llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::yaml::Document::parseBlockNode(), llvm::SymbolRemappingReader::read(), and trim().
|
inline |
Return string with consecutive characters in Chars
starting from the left removed.
Definition at line 827 of file StringRef.h.
References drop_front(), find_first_not_of(), and LLVM_NODISCARD.
|
inline |
Definition at line 256 of file StringRef.h.
References LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and 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.
Referenced by operator[]().
|
inline |
Definition at line 238 of file StringRef.h.
References assert(), and operator=().
|
inline |
Search for the last character C
in the string.
C
, or npos if not found. Definition at line 360 of file StringRef.h.
References From, LLVM_NODISCARD, npos, and rfind_lower().
Referenced by canTransformToMemCmp(), find_last_of(), llvm::getTypeName(), getTypeNamePrefix(), llvm::object::MachOObjectFile::guessLibraryShortName(), ParseHead(), llvm::SmallString< 256 >::rfind(), rsplit(), shouldBeSls(), splitUstar(), and llvm::sroa::AllocaSliceRewriter::visit().
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 208 of file StringRef.cpp.
Search for the last character C
in the string, ignoring case.
C
, or npos if not found. Definition at line 193 of file StringRef.cpp.
References From, npos, and llvm::toLower().
Referenced by rfind().
size_t StringRef::rfind_lower | ( | StringRef | Str | ) | const |
Search for the last string Str
in the string, ignoring case.
Str
, or npos if not found. Definition at line 220 of file StringRef.cpp.
References equals_lower(), N, npos, size(), and substr().
|
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 760 of file StringRef.h.
References LLVM_NODISCARD, npos, rfind(), size(), slice(), split(), and StringRef().
Referenced by getARClassRegisterMask(), llvm::HexagonGetLastSlot(), and rsplit().
|
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 813 of file StringRef.h.
References LLVM_NODISCARD, rsplit(), and StringRef().
|
inline |
Return string with consecutive Char
characters starting from the right removed.
Definition at line 834 of file StringRef.h.
References drop_back(), find_last_not_of(), and LLVM_NODISCARD.
Referenced by llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::object::ArchiveMemberHeader::getAccessMode(), llvm::object::ArchiveMemberHeader::getGID(), llvm::object::ArchiveMemberHeader::getLastModified(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::ArchiveMemberHeader::getRawLastModified(), llvm::object::ArchiveMemberHeader::getSize(), llvm::object::ArchiveMemberHeader::getUID(), and trim().
|
inline |
Return string with consecutive characters in Chars
starting from the right removed.
Definition at line 841 of file StringRef.h.
References drop_back(), find_last_not_of(), and LLVM_NODISCARD.
|
inline |
size - Get the string size.
Definition at line 138 of file StringRef.h.
References LLVM_NODISCARD.
Referenced by llvm::vfs::YAMLVFSWriter::addFileMapping(), llvm::pdb::PDBFileBuilder::addNamedStream(), llvm::BTFStringTable::addString(), llvm::FoldingSetNodeID::AddString(), altMacroString(), llvm::TarWriter::append(), llvm::RuntimeDyldImpl::applyExternalSymbolRelocations(), llvm::APSInt::APSInt(), llvm::CachedHashString::CachedHashString(), llvm::CachedHashStringRef::CachedHashStringRef(), llvm::canConstantFoldCallTo(), canTransformToMemCmp(), charTailAt(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), checkArchVersion(), CheckBaseRegAndIndexRegAndScale(), llvm::FunctionComparator::cmpMem(), llvm::sys::unicode::columnWidthUTF8(), llvm::zlib::compress(), computeMemberData(), computeStringTable(), llvm::ConstantFoldLoadFromConstPtr(), consume_back(), consume_front(), llvm::formatv_object_base::consumeFieldLayout(), llvm::consumeUnsignedInteger(), llvm::detail::IEEEFloat::convertFromString(), llvm::convertUTF8ToUTF16String(), llvm::ConvertUTF8toWide(), llvm::ConvertUTF8toWideInternal(), CopyStringRef(), count(), CountNumNewlinesBetween(), llvm::zlib::crc32(), llvm::object::ELFFile< ELFT >::create(), llvm::StringMapEntry< llvm::Comdat >::Create(), llvm::MachineFunction::createExternalSymbolName(), llvm::X86Operand::CreateToken(), decodeBase64StringEntry(), llvm::DWARFUnit::determineStringOffsetsTableContributionDWO(), drop_back(), drop_front(), llvm::DWARFListTableBase< DWARFDebugRnglist >::dump(), dumpDWARFv5StringOffsetsSection(), dumpStringOffsetsSection(), dumpTypeTagName(), llvm::DWARFDebugPubTable::DWARFDebugPubTable(), llvm::DwarfStringPool::DwarfStringPool(), edit_distance(), llvm::BitstreamWriter::emitBlob(), EmitDebugSectionImpl(), llvm::AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectISA(), EmitFileEntry(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), llvm::DWARFYAML::EmitPubSection(), llvm::NVPTXTargetStreamer::emitRawBytes(), llvm::emitSourceFileHeader(), encodeBitmaskPerm(), llvm::CodeViewContext::encodeDefRange(), llvm::sys::path::end(), llvm::Regex::escape(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::BitstreamWriter::ExitBlock(), expand(), llvm::sys::path::extension(), llvm::StringTableBuilder::finalizeInOrder(), find_first_not_of(), find_first_of(), find_if(), find_last_not_of(), find_last_of(), find_lower(), FindCheckType(), FindFirstMatchingPrefix(), llvm::opt::OptTable::findNearest(), llvm::json::fixUTF8(), formatPax(), llvm::fromHex(), llvm::ConstantDataArray::get(), llvm::DWARFUnit::getAddrOffsetSectionItem(), getAddrSpace(), llvm::ConstantDataSequential::getAsCString(), getAsInteger(), GetAutoSenseRadix(), llvm::APInt::getBitsNeeded(), llvm::MemoryBufferRef::getBufferSize(), llvm::object::ELFFile< ELFT >::getBufSize(), llvm::ARM::getCanonicalArchName(), llvm::DWARFUnit::getCompilationDir(), llvm::SparcTargetLowering::getConstraintType(), llvm::MSP430TargetLowering::getConstraintType(), llvm::AVRTargetLowering::getConstraintType(), llvm::HexagonTargetLowering::getConstraintType(), llvm::SITargetLowering::getConstraintType(), llvm::ARMTargetLowering::getConstraintType(), llvm::SystemZTargetLowering::getConstraintType(), llvm::NVPTXTargetLowering::getConstraintType(), llvm::PPCTargetLowering::getConstraintType(), llvm::X86TargetLowering::getConstraintType(), llvm::TargetLowering::getConstraintType(), llvm::object::getElfArchType(), getEncodedUnnamedAddr(), llvm::object::ELFFile< ELFT >::getEntry(), llvm::Triple::getEnvironmentVersion(), getEstimate(), getFilename(), llvm::getFuncNameWithoutPrefix(), getGNUBinOpPrecedence(), llvm::object::MachOObjectFile::getIndirectName(), llvm::HexagonInstrInfo::getInlineAsmLength(), llvm::ARMTargetLowering::getInlineAsmMemConstraint(), llvm::SystemZTargetLowering::getInlineAsmMemConstraint(), getItaniumTypeName(), llvm::MDString::getLength(), llvm::object::MachOObjectFile::getLibraryShortNameByIndex(), llvm::DWARFContext::getLineTableForUnit(), llvm::ThinLTOBuffer::getMemBuffer(), getMemBufferCopyImpl(), llvm::getMemOPSizeRangeFromOption(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::Elf_Sym_Impl< ELFT >::getName(), llvm::Value::getName(), llvm::WritableMemoryBuffer::getNewUninitMemBuffer(), llvm::object::Archive::Child::getNext(), getNextRegister(), getOptionPred(), llvm::cl::generic_parser_base::getOptionWidth(), llvm::cl::basic_parser_impl::getOptionWidth(), llvm::StringToOffsetTable::GetOrAddStringOffset(), llvm::MCContext::getOrCreateLSDASymbol(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::Triple::getOSVersion(), llvm::BPFTargetLowering::getRegForInlineAsmConstraint(), llvm::RISCVTargetLowering::getRegForInlineAsmConstraint(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::LanaiTargetLowering::getRegForInlineAsmConstraint(), llvm::MSP430TargetLowering::getRegForInlineAsmConstraint(), llvm::AVRTargetLowering::getRegForInlineAsmConstraint(), llvm::HexagonTargetLowering::getRegForInlineAsmConstraint(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::ARMTargetLowering::getRegForInlineAsmConstraint(), llvm::SystemZTargetLowering::getRegForInlineAsmConstraint(), llvm::NVPTXTargetLowering::getRegForInlineAsmConstraint(), llvm::PPCTargetLowering::getRegForInlineAsmConstraint(), llvm::X86TargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::object::ELFFile< ELFT >::getSectionContentsAsArray(), llvm::object::ELFFile< ELFT >::getSectionName(), llvm::X86TargetLowering::getSingleConstraintMatchWeight(), llvm::object::Archive::Child::getSize(), getSpecialRegForName(), llvm::AMDGPUTargetELFStreamer::getStreamer(), llvm::ConstantDataArray::getString(), llvm::AsmToken::getStringContents(), llvm::DWARFUnit::getStringOffsetSectionItem(), llvm::X86TargetMachine::getSubtargetImpl(), getTime(), llvm::MipsTargetLowering::getTypeForExtReturn(), llvm::getTypeName(), getUnicodeEncoding(), llvm::AMDGPUMangledLibFunc::getUnmangledName(), llvm::yaml::ScalarNode::getValue(), getValueStr(), getVarName(), llvm::CodeViewYAML::GlobalHash::GlobalHash(), gsiRecordLess(), llvm::object::MachOObjectFile::guessLibraryShortName(), llvm::DWARFVerifier::handleDebugInfo(), HandlePrefixedOrGroupedOption(), llvm::IntelExpr::hasBaseReg(), llvm::SHA1::hash(), llvm::pdb::hashStringV1(), llvm::IntelExpr::hasIndexReg(), llvm::identify_magic(), incrementLoc(), INITIALIZE_PASS(), llvm::ExecutionEngine::InitializeMemory(), llvm::yaml::ScalarTraits< char_16 >::input(), llvm::yaml::ScalarTraits< uuid_t >::input(), llvm::codeview::DebugStringTableSubsection::insert(), isAsmComment(), llvm::TrigramIndex::isDefinitelyOut(), llvm::XCoreTargetLowering::isLegalAddressingMode(), isOperator(), isRepeatedByteSequence(), isReportingError(), llvm::json::isUTF8(), llvm::DataExtractor::isValidOffset(), isWeak(), LLVMDITypeGetName(), LLVMGetAsString(), LLVMGetDebugLocDirectory(), LLVMGetDebugLocFilename(), LLVMGetNamedMetadataName(), LLVMTargetMachineEmitToMemoryBuffer(), loadTestingFormat(), llvm::Function::lookupIntrinsicID(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::AMDGPUIntrinsicInfo::lookupName(), llvm::TargetIntrinsicInfo::lookupName(), lower(), LowerFPToInt(), llvm::MCGenDwarfLabelEntry::Make(), llvm::LTOModule::makeBuffer(), llvm::opt::DerivedArgList::MakeJoinedArg(), mapNameAndUniqueName(), llvm::GlobPattern::match(), llvm::Regex::match(), llvm::FileCheckPattern::Match(), MatchCoprocessorOperandName(), matchOption(), maybeLexHexadecimalLiteral(), maybeLexIndex(), maybeLexIndexAndName(), maybeLexIRBlock(), maybeLexIRValue(), maybeLexMachineBasicBlock(), maybeLexSubRegisterIndex(), MCAttrForString(), llvm::DWARFExpression::iterator::operator++(), llvm::operator+=(), llvm::operator<<(), llvm::raw_ostream::operator<<(), optimizeDoubleFP(), llvm::DWARFDebugFrame::parse(), llvm::parseAnalysisUtilityPasses(), parseBackslash(), parseDuration(), ParseLine(), llvm::DWARFDebugLoc::parseOneLocationList(), llvm::DWARFDebugLoclists::parseOneLocationList(), llvm::FileCheckPattern::ParsePattern(), parseRefinementStep(), parseRegisterNumber(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::AsmLexer::peekTokens(), llvm::ScopedPrinter::printBinary(), llvm::ScopedPrinter::printBinaryBlock(), printBSDMemberHeader(), printCFI(), PrintCFIEscape(), llvm::printEscapedString(), llvm::FileCheckPattern::PrintFuzzyMatch(), llvm::cl::generic_parser_base::printGenericOptionDiff(), PrintHelpOptionList(), printLine(), llvm::printLLVMNameWithoutPrefix(), printMCExpr(), printMetadataIdentifier(), PrintNoMatch(), llvm::cl::generic_parser_base::printOptionInfo(), llvm::cl::basic_parser_impl::printOptionName(), PrintQuotedString(), printSourceLine(), promoteToConstantPool(), llvm::sys::path::rbegin(), llvm::irsymtab::readBitcode(), llvm::FileCheck::ReadCheckFile(), llvm::readPGOFuncNameStrings(), llvm::sampleprof::SampleProfileReaderBinary::readString(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::reconstituteName(), llvm::sys::path::relative_path(), llvm::sys::path::remove_leading_dotslash(), llvm::object::replace(), llvm::sys::path::replace_extension(), llvm::sys::path::replace_path_prefix(), llvm::report_fatal_error(), rfind(), rfind_lower(), rsplit(), llvm::StringSaver::save(), llvm::object::ELFFile< ELFT >::sections(), llvm::StructType::setName(), llvm::X86Operand::setTokenValue(), shouldBeSls(), llvm::DWARFDataExtractor::size(), SkipWord(), split(), llvm::formatv_object_base::splitLiteralAndReplacement(), splitUstar(), srcMgrDiagHandler(), llvm::sys::path::stem(), llvm::StrInStrNoCase(), llvm::Regex::sub(), take_back(), take_front(), llvm::toHex(), llvm::cl::TokenizeGNUCommandLine(), llvm::cl::TokenizeWindowsCommandLine(), truncateToSize(), llvm::codeview::TypeServer2Record::TypeServer2Record(), llvm::zlib::uncompress(), unescapeQuotedString(), UnpackFromArgumentSlot(), llvm::SHA1::update(), llvm::MD5::update(), UpgradeIntrinsicFunction1(), upgradeLoopTag(), upper(), useStringTable(), llvm::APInt::usub_sat(), llvm::StringTableBuilder::write(), llvm::msgpack::Writer::write(), llvm::WriteIndexToFile(), writeStringRecord(), writeSymbolTable(), writeUstarHeader(), and llvm::xxHash64().
|
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 710 of file StringRef.h.
Referenced by llvm::vfs::YAMLVFSWriter::addFileMapping(), addNegOperand(), llvm::object::ObjectFile::createMachOObjectFile(), getEstimate(), getNextRegister(), getObjCClassCategory(), getObjCMethodName(), llvm::AsmToken::getStringContents(), llvm::object::MachOObjectFile::guessLibraryShortName(), llvm::yaml::ScalarTraits< uuid_t >::input(), llvm::dwarf::CFIProgram::parse(), llvm::DWARFDebugFrame::parse(), parseDuration(), parseRegisterNumber(), printSourceLine(), llvm::GCOVBuffer::readGCOVVersion(), llvm::GCOVBuffer::readInt(), llvm::GCOVBuffer::readString(), rsplit(), shouldBeSls(), split(), llvm::formatv_object_base::splitLiteralAndReplacement(), llvm::Regex::sub(), and truncateToSize().
|
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 727 of file StringRef.h.
References LLVM_NODISCARD, and StringRef().
Referenced by addForcedAttributes(), branchDiv(), checkParametrizedPassName(), ExecGraphViewer(), ExpandCryptoAEK(), llvm::InstrProfReaderItaniumRemapper< HashTableImpl >::extractName(), FindFirstNonCommonLetter(), llvm::opt::OptTable::findNearest(), findTargetSubtable(), llvm::Triple::getArchName(), llvm::codeview::getBytesAsCString(), llvm::Triple::getEnvironmentName(), getFilename(), getFullyQualifiedName(), llvm::object::COFFObjectFile::getHintName(), llvm::sys::detail::getHostCPUNameForARM(), llvm::sys::detail::getHostCPUNameForS390x(), llvm::AMDGPU::getIntegerPairAttribute(), getIntOperandFromRegisterString(), getIntOperandsFromRegisterString(), getOpEnabled(), getOpRefinementSteps(), llvm::ModuleSummaryIndex::getOriginalNameBeforePromote(), llvm::Triple::getOSAndEnvironmentName(), llvm::Triple::getOSName(), getPassNameAndInstanceNum(), llvm::sampleprof::SampleProfileReader::getSamplesFor(), getSearchPaths(), llvm::codeview::getSymbolName(), llvm::Triple::getVendorName(), llvm::handleExecNameEncodedBEOpts(), llvm::handleExecNameEncodedOptimizerOpts(), llvm::HexagonGetLastSlot(), incrementLoc(), llvm::yaml::CustomMappingTraits< std::map< std::vector< uint64_t >, WholeProgramDevirtResolution::ByArg > >::inputOne(), isThumbFunction(), LookupNearestOption(), llvm::FileCheckPattern::Match(), llvm::Triple::normalize(), llvm::SpecialCaseList::parse(), llvm::PassBuilder::parseAAPipeline(), llvm::parseCachePruningPolicy(), parseCHRFilterFiles(), parseNamePrefix(), llvm::MCSectionMachO::ParseSectionSpecifier(), previousIsLoop(), llvm::cl::Option::printHelpStr(), printSymbolizedStackTrace(), llvm::DebugCounter::push_back(), llvm::SymbolRemappingReader::read(), llvm::readPGOFuncNameStrings(), llvm::GCOVBuffer::readString(), rsplit(), llvm::setCurrentDebugTypes(), Split(), split(), llvm::Regex::sub(), llvm::opt::OptTable::suggestValueCompletions(), llvm::Triple::Triple(), llvm::UpgradeRetainReleaseMarker(), and UsesVectorABI().
|
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 742 of file StringRef.h.
References find(), LLVM_NODISCARD, npos, size(), slice(), and StringRef().
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 314 of file StringRef.cpp.
References empty(), find(), npos, llvm::SmallVectorTemplateBase< T, bool >::push_back(), size(), and slice().
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 341 of file StringRef.cpp.
References empty(), find(), npos, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and slice().
|
inline |
Check if this string starts with the given Prefix
.
Definition at line 267 of file StringRef.h.
References LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, llvm::cl::Prefix, and startswith_lower().
Referenced by llvm::analyzeBuiltinArguments(), llvm::ARMBuildAttrs::AttrTypeFromString(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), CheckBaseRegAndIndexRegAndScale(), checkParametrizedPassName(), llvm::CodeViewDebug::CodeViewDebug(), computeAddrSpace(), llvm::MipsABIInfo::computeTargetABI(), computeTargetABI(), consume_front(), llvm::GlobPattern::create(), llvm::createX86RetpolineThunksPass(), doesIgnoreDataTypeSuffix(), llvm::NVPTXAsmPrinter::doFinalization(), llvm::AsmPrinter::doFinalization(), dumpTypeTagName(), llvm::AMDGPU::HSAMD::MetadataStreamerV2::emitKernel(), llvm::ARMTargetStreamer::emitTargetAttributes(), encodeCnt(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::opt::OptTable::findNearest(), findTargetSubtable(), forEachUser(), llvm::AArch64::getArchExtFeature(), llvm::ARM::getArchExtFeature(), GetAutoSenseRadix(), llvm::ARM::getCanonicalArchName(), getELFKindForNamedSection(), getELFSectionType(), llvm::Triple::getEnvironmentVersion(), llvm::XCoreTargetObjectFile::getExplicitSectionGlobal(), llvm::AMDGPUTargetObjectFile::getExplicitSectionGlobal(), llvm::getFuncNameWithoutPrefix(), getGNUBinOpPrecedence(), getName(), llvm::object::getNameType(), llvm::Mangler::getNameWithPrefix(), llvm::MCContext::getOrCreateLSDASymbol(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::Triple::getOSVersion(), getPrefixes(), llvm::object::COFFObjectFile::getSectionName(), getSignature(), getSpecialRegForName(), getSqrtCall(), getSuccPad(), llvm::object::ELFObjectFile< ELFT >::getSymbolFlags(), llvm::MipsTargetLowering::getTypeForExtReturn(), llvm::yaml::Node::getVerbatimTag(), GlobalWasGeneratedByCompiler(), llvm::object::MachOObjectFile::guessLibraryShortName(), HasAnyUnrollPragma(), hasPrefix(), INITIALIZE_PASS(), instrumentMaskedLoadOrStore(), intToken(), llvm::LTOModule::isBitcodeForTarget(), llvm::object::isDecorated(), llvm::object::Decompressor::isGnuStyle(), llvm::MCSectionCOFF::isImplicitlyDiscardable(), isInput(), isInSymtab(), isObjCClass(), llvm::objcarc::IsObjCIdentifiedObject(), isWeak(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::AMDGPUIntrinsicInfo::lookupName(), llvm::lto::LTO::LTO(), llvm::MCGenDwarfLabelEntry::Make(), llvm::LTOModule::makeBuffer(), llvm::makeFollowupLoopID(), llvm::GlobPattern::match(), matchAsm(), matchOption(), matchSVEPredicateVectorRegName(), llvm::mayBeOldLoopAttachmentTag(), MaybePredicatedInst(), llvm::PassInfoMixin< PromotePass >::name(), llvm::Triple::normalize(), optimizeDoubleFP(), llvm::parseAnalysisUtilityPasses(), parseArch(), llvm::ARM::parseArchEndian(), parseARMArch(), llvm::FileCheckPattern::ParsePattern(), parseSubArch(), parseVersionFromName(), llvm::FileCheckPattern::PrintFuzzyMatch(), printSymbolizedStackTrace(), processGlobal(), PushArgMD(), llvm::SymbolRemappingReader::read(), llvm::Function::recalculateIntrinsicID(), RefineErrorLoc(), llvm::MCContext::RemapDebugPaths(), llvm::object::replace(), llvm::XCoreTargetLowering::ReplaceNodeResults(), llvm::runFuzzerOnInputs(), llvm::HexagonTargetObjectFile::SelectSectionForGlobal(), llvm::Loop::setLoopAlreadyUnrolled(), shouldAlwaysEmitCompleteClassType(), shouldBeSls(), shouldInstrumentBlock(), ShouldUpgradeX86Intrinsic(), startswith(), llvm::StringSwitch< T, R >::StartsWith(), llvm::SmallString< 256 >::startswith(), startsWithDefaultPipelineAliasPrefix(), llvm::StripDebugInfo(), StripSymtab(), StripTypeNames(), truncateToSize(), upgradeAVX512MaskToSelect(), llvm::UpgradeIntrinsicCall(), UpgradeIntrinsicFunction1(), upgradeLoopTag(), llvm::UpgradeSectionAttributes(), UpgradeX86IntrinsicFunction(), llvm::LoopVectorizeHints::vectorizeAnalysisPassName(), and llvm::PrintIRInstrumentation::~PrintIRInstrumentation().
Check if this string starts with the given Prefix
, ignoring case.
Definition at line 47 of file StringRef.cpp.
References ascii_strncasecmp().
Referenced by addNegOperand(), llvm::detail::HelperFunctions::consumeHexStyle(), ExpandCryptoAEK(), find_lower(), incrementLoc(), matchOption(), startswith(), and llvm::StringSwitch< T, R >::StartsWithLower().
|
inline |
str - Get the contents as an std::string.
Definition at line 228 of file StringRef.h.
References LLVM_NODISCARD.
Referenced by addData(), llvm::DwarfCompileUnit::addGlobalName(), llvm::DwarfCompileUnit::addGlobalNameForTypeUnit(), llvm::DwarfCompileUnit::addGlobalType(), llvm::DwarfCompileUnit::addGlobalTypeUnitType(), llvm::cacheAnnotationFromMD(), llvm::sys::path::convert_to_slash(), llvm::Hexagon_MC::createHexagonMCSubtargetInfo(), llvm::FunctionImportGlobalProcessing::doImportAsDefinition(), llvm::vfs::RedirectingFileSystem::dumpEntry(), llvm::AMDGPUAsmPrinter::EmitFunctionEntryLabel(), llvm::PMDataManager::emitInstrCountChangedRemark(), llvm::AMDGPU::HSAMD::MetadataStreamerV2::emitKernel(), findInputFile(), llvm::CodeExtractor::findInputsOutputs(), llvm::DiagnosticLocation::getAbsolutePath(), llvm::StringInit::getAsString(), llvm::CodeInit::getAsString(), llvm::FieldInit::getAsString(), llvm::bfi_detail::getBlockName(), getDescription(), llvm::Check::FileCheckType::getDescription(), llvm::GlobalValue::getGlobalIdentifier(), llvm::DOTGraphTraits< const Function * >::getGraphName(), llvm::AMDGPUIntrinsicInfo::getName(), llvm::vfs::File::getName(), getNodeVisualName(), llvm::getPGOFuncName(), llvm::pdb::PDBSymbolCompiland::getSourceFileName(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), llvm::Record::getValueAsBitOrUnset(), llvm::PerFunctionMIParsingState::getVRegInfoNamed(), llvm::yaml::ScalarTraits< StringValue >::input(), llvm::yaml::CustomMappingTraits< std::map< std::vector< uint64_t >, WholeProgramDevirtResolution::ByArg > >::inputOne(), llvm::yaml::CustomMappingTraits< std::map< uint64_t, WholeProgramDevirtResolution > >::inputOne(), llvm::yaml::CustomMappingTraits< std::set< ELFSymbol > >::inputOne(), llvm::yaml::CustomMappingTraits< GlobalValueSummaryMapTy >::inputOne(), llvm::yaml::CustomMappingTraits< TypeIdSummaryMapTy >::inputOne(), llvm::yaml::CustomMappingTraits< msgpack::MapNode >::inputOne(), llvm::MachineRegisterInfo::insertVRegByName(), isImplicitOperandIn(), LLVMGetFunctionAddress(), llvm::LockFileManager::LockFileManager(), mangleCoveragePath(), normalizePBQPSpillWeight(), operator std::string(), llvm::cl::parser< std::string >::parse(), pathHasTraversal(), RetagMask(), rewriteComdat(), llvm::DOTGraphTraitsViewer< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >::runOnFunction(), llvm::DOTGraphTraitsPrinter< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >::runOnFunction(), llvm::MCContext::setCompilationDir(), llvm::MCParsedAsmOperand::setConstraint(), llvm::vfs::RedirectingFileSystem::setExternalContentsPrefixDir(), llvm::vfs::YAMLVFSWriter::setOverlayDir(), llvm::DwarfDebug::shareAcrossDWOCUs(), smallData(), llvm::Twine::str(), suffixed_name_or(), truncateToSize(), llvm::LTOCodeGenerator::writeMergedModules(), 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 598 of file StringRef.h.
Referenced by llvm::vfs::YAMLVFSWriter::addFileMapping(), addNegOperand(), canTransformToMemCmp(), llvm::FileCheckString::Check(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), llvm::FileCheck::CheckInput(), CommaSeparateAndAddOccurrence(), llvm::consumeUnsignedInteger(), count(), CountNumNewlinesBetween(), llvm::createSampleProfileLoaderPass(), decodeBase64StringEntry(), drop_back(), drop_front(), drop_until(), drop_while(), llvm::GlobalValue::dropLLVMManglingEscape(), dumpTypeTagName(), llvm::DWARFUnit::DWARFUnit(), EatNumber(), emitComments(), llvm::emitSourceFileHeader(), llvm::RuntimeDyldCheckerExprEval::evaluate(), ExpandCryptoAEK(), llvm::sys::path::extension(), llvm::DWARFFormValue::extractValue(), find_lower(), FindFirstMatchingPrefix(), llvm::MCJIT::findModuleForSymbol(), llvm::symbolize::LLVMSymbolizer::flush(), llvm::format_provider< T, typename std::enable_if< detail::use_string_formatter< T >::value >::type >::format(), getAddrSpace(), llvm::AArch64::getArchExtFeature(), llvm::ARM::getArchExtFeature(), llvm::object::MachOUniversalBinary::ObjectForArch::getAsArchive(), llvm::ConstantDataSequential::getAsCString(), getAsInteger(), llvm::object::MachOUniversalBinary::ObjectForArch::getAsObjectFile(), GetAutoSenseRadix(), llvm::ARM::getCanonicalArchName(), llvm::getConstantStringInfo(), llvm::TargetLowering::getConstraintType(), llvm::Triple::getEnvironmentVersion(), llvm::GlobalValue::getGlobalIdentifier(), getGNUBinOpPrecedence(), llvm::getMemOPSizeRangeFromOption(), getName(), llvm::object::ArchiveMemberHeader::getName(), llvm::Value::getName(), getNameWithPrefixImpl(), getNextRegister(), getOpEnabled(), getOpRefinementSteps(), getOptionPred(), llvm::Triple::getOSVersion(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::object::MachOObjectFile::getSectionContents(), llvm::object::COFFObjectFile::getSectionName(), getSpecialRegForName(), llvm::getTypeName(), getTypeNamePrefix(), llvm::yaml::ScalarNode::getValue(), getVarName(), llvm::yaml::Node::getVerbatimTag(), llvm::sampleprof::FunctionSamples::GUIDToFuncNameMapper::GUIDToFuncNameMapper(), HandlePrefixedOrGroupedOption(), incrementLoc(), INITIALIZE_PASS(), intToken(), isLoopPassName(), isWeak(), llvm::LibCallSimplifier::LibCallSimplifier(), loadTestingFormat(), llvm::lto::LTO::LTO(), llvm::MCGenDwarfLabelEntry::Make(), llvm::GlobPattern::match(), llvm::FileCheckPattern::Match(), matchAsm(), matchOption(), llvm::matchPassManager(), llvm::cl::SubCommand::operator bool(), llvm::sys::path::parent_path(), llvm::parseAnalysisUtilityPasses(), llvm::yaml::Document::parseBlockNode(), ParseHead(), parseInt(), ParseLine(), llvm::DWARFDebugLoc::parseOneLocationList(), llvm::DWARFDebugLoclists::parseOneLocationList(), llvm::FileCheckPattern::ParsePattern(), parseRefinementStep(), parseVersionFromName(), previousIsLoop(), PrintCFIEscape(), llvm::FileCheckPattern::PrintFuzzyMatch(), printMCExpr(), PrintNoMatch(), PrintQuotedString(), llvm::FileCheck::ReadCheckFile(), RefineErrorLoc(), llvm::sys::path::relative_path(), llvm::sys::path::remove_leading_dotslash(), llvm::sys::path::rend(), llvm::object::replace(), llvm::sys::path::replace_path_prefix(), llvm::cl::ResetAllOptionOccurrences(), rfind(), rfind_lower(), llvm::sys::path::root_path(), scan(), shouldBeSls(), llvm::formatv_object_base::splitLiteralAndReplacement(), splitUstar(), srcMgrDiagHandler(), llvm::sys::path::stem(), llvm::StrInStrNoCase(), StripFlag(), llvm::Regex::sub(), take_until(), take_while(), llvm::VersionTuple::tryParse(), unescapeQuotedString(), upgradeAVX512MaskToSelect(), llvm::UpgradeIntrinsicCall(), UpgradeIntrinsicFunction1(), llvm::UpgradeSectionAttributes(), UpgradeX86IntrinsicFunction(), llvm::LoopVectorizeHints::vectorizeAnalysisPassName(), and llvm::sroa::AllocaSliceRewriter::visit().
|
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 619 of file StringRef.h.
References drop_front(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, N, and size().
Referenced by llvm::codeview::consume(), encodeCnt(), and llvm::codeview::GloballyHashedType::hashType().
|
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 608 of file StringRef.h.
References drop_back(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, N, and size().
Referenced by emitNullTerminatedSymbolName(), mapNameAndUniqueName(), and llvm::codeview::CodeViewRecordIO::mapStringZ().
|
inline |
Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicate.
Definition at line 637 of file StringRef.h.
References F(), find_if(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and substr().
|
inline |
Return the longest prefix of 'this' such that every character in the prefix satisfies the given predicate.
Definition at line 629 of file StringRef.h.
References F(), find_if_not(), LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and substr().
Referenced by llvm::formatv_object_base::splitLiteralAndReplacement().
|
inline |
Return string with consecutive Char
characters starting from the left and right removed.
Definition at line 848 of file StringRef.h.
References LLVM_NODISCARD, ltrim(), and rtrim().
Referenced by llvm::RuntimeDyldCheckerImpl::check(), llvm::RuntimeDyldCheckerExprEval::evaluate(), ExpandCryptoAEK(), incrementLoc(), llvm::IsCPSRDead< MCInst >(), and llvm::formatv_object_base::parseReplacementItem().
|
inline |
Return string with consecutive characters in Chars
starting from the left and right removed.
Definition at line 855 of file StringRef.h.
std::string StringRef::upper | ( | ) | const |
Convert the given ASCII string to uppercase.
Definition at line 116 of file StringRef.cpp.
References size(), and llvm::toUpper().
Referenced by consumeInteger(), makeCombineInst(), and llvm::AArch64SysReg::parseGenericRegister().
Definition at line 98 of file StringRef.h.
References StringRef().
Definition at line 51 of file StringRef.h.
Referenced by llvm::vfs::YAMLVFSWriter::addFileMapping(), addNegOperand(), llvm::X86FrameLowering::adjustForHiPEPrologue(), buildFixItLine(), canTransformToMemCmp(), llvm::FileCheckString::Check(), llvm::FileCheck::CheckInput(), llvm::FileCheckString::CheckNot(), CommaSeparateAndAddOccurrence(), contains(), contains_lower(), llvm::createSampleProfileLoaderPass(), llvm::sys::fs::createTemporaryFile(), llvm::AMDGPU::HSAMD::MetadataStreamerV2::emitKernel(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::sys::path::extension(), find(), find_first_not_of(), find_first_of(), find_if(), find_last_not_of(), find_last_of(), find_lower(), llvm::format_provider< T, typename std::enable_if< detail::use_string_formatter< T >::value >::type >::format(), llvm::ARM::getCanonicalArchName(), llvm::DataExtractor::getCStr(), llvm::HexagonTargetObjectFile::getExplicitSectionGlobal(), llvm::sys::detail::getHostCPUNameForS390x(), llvm::SourceMgr::getLineAndColumn(), llvm::Value::getName(), llvm::InstrProfSymtab::getOrigFuncName(), llvm::object::ArchiveMemberHeader::getRawName(), llvm::getTypeName(), getTypeNamePrefix(), llvm::yaml::ScalarNode::getValue(), llvm::object::MachOObjectFile::guessLibraryShortName(), llvm::sampleprof::FunctionSamples::GUIDToFuncNameMapper::GUIDToFuncNameMapper(), hasConflictingReferenceFlags(), hasObjCCategory(), hasWildcard(), llvm::MIRParserImpl::initializeJumpTableInfo(), instrumentMaskedLoadOrStore(), is_ns_word_char(), llvm::ConstantDataSequential::isCString(), llvm::Regex::isLiteralERE(), isLoopPassName(), llvm::objcarc::IsObjCIdentifiedObject(), isReportingError(), isSmallDataSection(), isWeak(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::FileCheckPattern::Match(), llvm::matchPassManager(), MCAttrForString(), llvm::cl::SubCommand::operator bool(), llvm::sys::path::reverse_iterator::operator++(), llvm::sys::path::parent_path(), ParseLine(), llvm::FileCheckPattern::ParsePattern(), parseRefinementStep(), llvm::FileCheckPattern::PrintFuzzyMatch(), printName(), printSourceLine(), llvm::BinaryStreamReader::readCString(), llvm::sys::path::remove_filename(), llvm::object::replace(), llvm::sys::path::replace_extension(), rfind(), rfind_lower(), rsplit(), sanitizeFunctionName(), setRequiredFeatureString(), split(), llvm::formatv_object_base::splitLiteralAndReplacement(), splitUstar(), llvm::sys::path::stem(), llvm::StrInStrNoCase(), UpgradeIntrinsicFunction1(), llvm::LoopVectorizeHints::vectorizeAnalysisPassName(), and llvm::sroa::AllocaSliceRewriter::visit().