LLVM  8.0.1
Public Types | Static Public Attributes | List of all members
llvm::StringRef Class Reference

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

#include "llvm/ADT/StringRef.h"

Inheritance diagram for llvm::StringRef:
Inheritance graph
[legend]
Collaboration diagram for llvm::StringRef:
Collaboration graph
[legend]

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 charbytes_begin () const
 
const unsigned charbytes_end () const
 
iterator_range< const unsigned char * > bytes () const
 
String Operations
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const chardata () 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 >::typeoperator= (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, StringRefsplit (char Separator) const
 Split into two substrings around the first occurrence of a separator character. More...
 
LLVM_NODISCARD std::pair< StringRef, StringRefsplit (StringRef Separator) const
 Split into two substrings around the first occurrence of a separator string. More...
 
LLVM_NODISCARD std::pair< StringRef, StringRefrsplit (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, StringRefrsplit (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)
 

Detailed Description

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.

Member Typedef Documentation

◆ const_iterator

Definition at line 54 of file StringRef.h.

◆ iterator

Definition at line 53 of file StringRef.h.

◆ size_type

Definition at line 55 of file StringRef.h.

Constructor & Destructor Documentation

◆ StringRef() [1/5]

llvm::StringRef::StringRef ( )
default

Construct an empty string ref.

Referenced by copy(), rsplit(), split(), and withNullAsEmpty().

◆ StringRef() [2/5]

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

Disable conversion from nullptr.

This prevents things like if (S == nullptr)

◆ StringRef() [3/5]

LLVM_ATTRIBUTE_ALWAYS_INLINE llvm::StringRef::StringRef ( const char Str)
inline

Construct a string ref from a cstring.

Definition at line 85 of file StringRef.h.

References LLVM_ATTRIBUTE_ALWAYS_INLINE.

◆ StringRef() [4/5]

LLVM_ATTRIBUTE_ALWAYS_INLINE constexpr llvm::StringRef::StringRef ( const char data,
size_t  length 
)
inline

Construct a string ref from a pointer and length.

Definition at line 90 of file StringRef.h.

References LLVM_ATTRIBUTE_ALWAYS_INLINE.

◆ StringRef() [5/5]

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

Construct a string ref from an std::string.

Definition at line 95 of file StringRef.h.

Member Function Documentation

◆ back()

LLVM_NODISCARD char llvm::StringRef::back ( ) const
inline

◆ begin()

iterator llvm::StringRef::begin ( ) const
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().

◆ bytes()

iterator_range<const unsigned char *> llvm::StringRef::bytes ( ) const
inline

◆ bytes_begin()

const unsigned char* llvm::StringRef::bytes_begin ( ) const
inline

◆ bytes_end()

const unsigned char* llvm::StringRef::bytes_end ( ) const
inline

◆ compare()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE int llvm::StringRef::compare ( StringRef  RHS) const
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().

◆ compare_lower()

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().

◆ compare_numeric()

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().

◆ consume_back()

LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::consume_back ( StringRef  Suffix)
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().

◆ consume_front()

LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::consume_front ( StringRef  Prefix)
inline

◆ consumeInteger() [1/2]

template<typename T >
std::enable_if<std::numeric_limits<T>::is_signed, bool>::type llvm::StringRef::consumeInteger ( unsigned  Radix,
T Result 
)
inline

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

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

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

Definition at line 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().

◆ consumeInteger() [2/2]

template<typename T >
std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type llvm::StringRef::consumeInteger ( unsigned  Radix,
T Result 
)
inline

◆ contains() [1/2]

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::contains ( StringRef  Other) const
inline

◆ contains() [2/2]

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::contains ( char  C) const
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.

◆ contains_lower() [1/2]

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::contains_lower ( StringRef  Other) const
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.

◆ contains_lower() [2/2]

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::contains_lower ( char  C) const
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.

◆ copy()

template<typename Allocator >
LLVM_NODISCARD StringRef llvm::StringRef::copy ( Allocator A) const
inline

◆ count() [1/2]

LLVM_NODISCARD size_t llvm::StringRef::count ( char  C) const
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().

◆ count() [2/2]

size_t StringRef::count ( StringRef  Str) const

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

count - Return the number of non-overlapped occurrences of

  • Str in the string.

Definition at line 373 of file StringRef.cpp.

References equals(), N, size(), and substr().

◆ data()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char* llvm::StringRef::data ( ) 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().

◆ drop_back()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::drop_back ( size_t  N = 1) const
inline

◆ drop_front()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::drop_front ( size_t  N = 1) const
inline

◆ drop_until()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::drop_until ( function_ref< bool(char)>  F) const
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().

◆ drop_while()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::drop_while ( function_ref< bool(char)>  F) const
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().

◆ edit_distance()

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

Determine the edit distance between this string and another string.

Parameters
Otherthe string to compare this string against.
AllowReplacementswhether to allow character replacements (change one character into another) as a single operation, rather than as two operations (an insertion and a removal).
MaxEditDistanceIf non-zero, the maximum edit distance that this routine is allowed to compute. If the edit distance will exceed that maximum, returns MaxEditDistance+1.
Returns
the minimum number of character insertions, removals, or (if AllowReplacements is true) replacements needed to transform one of the given strings into the other. If zero, the strings are identical.

Definition at line 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().

◆ empty()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::empty ( ) const
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().

◆ end()

iterator llvm::StringRef::end ( ) const
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().

◆ endswith()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::endswith ( StringRef  Suffix) const
inline

◆ endswith_lower()

bool StringRef::endswith_lower ( StringRef  Suffix) const

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().

◆ equals()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::equals ( StringRef  RHS) const
inline

◆ equals_lower()

LLVM_NODISCARD bool llvm::StringRef::equals_lower ( StringRef  RHS) const
inline

◆ find() [1/2]

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t llvm::StringRef::find ( char  C,
size_t  From = 0 
) const
inline

Search for the first character C in the string.

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

Definition at line 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().

◆ find() [2/2]

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

Returns
The index of the first occurrence of Str, or npos if not found.
  • Str in the string.
Returns
- The index of the first occurrence of
  • Str, or npos if not found.

Definition at line 133 of file StringRef.cpp.

References npos.

◆ find_first_not_of() [1/2]

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

  • C or npos if not found.

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().

◆ find_first_not_of() [2/2]

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())

  • Chars, or npos if not found.

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

Definition at line 261 of file StringRef.cpp.

References npos, and size().

◆ find_first_of() [1/2]

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

◆ find_first_of() [2/2]

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())

  • Chars, or npos if not found.

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

Definition at line 236 of file StringRef.cpp.

References npos, and size().

◆ find_if()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t llvm::StringRef::find_if ( function_ref< bool(char)>  F,
size_t  From = 0 
) const
inline

Search for the first character satisfying the predicate F.

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

Definition at line 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().

◆ find_if_not()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t llvm::StringRef::find_if_not ( function_ref< bool(char)>  F,
size_t  From = 0 
) const
inline

Search for the first character not satisfying the predicate F.

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

Definition at line 337 of file StringRef.h.

References F(), find(), find_if(), find_lower(), From, and LLVM_NODISCARD.

Referenced by drop_while(), and take_while().

◆ find_last_not_of() [1/2]

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

  • C, or npos if not found.

Definition at line 291 of file StringRef.cpp.

References npos.

Referenced by find_last_of(), and rtrim().

◆ find_last_not_of() [2/2]

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())

  • Chars, or npos if not found.

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

Definition at line 302 of file StringRef.cpp.

References npos, and size().

◆ find_last_of() [1/2]

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

◆ find_last_of() [2/2]

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())

  • C, or npos if not found.

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

Definition at line 277 of file StringRef.cpp.

References npos, and size().

◆ find_lower() [1/2]

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

Search for the first character C in the string, ignoring case.

Returns
The index of the first occurrence of 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().

◆ find_lower() [2/2]

size_t StringRef::find_lower ( StringRef  Str,
size_t  From = 0 
) const

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

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

Definition at line 182 of file StringRef.cpp.

References drop_front(), From, npos, size(), startswith_lower(), and substr().

◆ front()

LLVM_NODISCARD char llvm::StringRef::front ( ) const
inline

◆ getAsDouble()

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

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().

◆ getAsInteger() [1/3]

template<typename T >
std::enable_if<std::numeric_limits<T>::is_signed, bool>::type llvm::StringRef::getAsInteger ( unsigned  Radix,
T Result 
) const
inline

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

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

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

Definition at line 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().

◆ getAsInteger() [2/3]

template<typename T >
std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type llvm::StringRef::getAsInteger ( unsigned  Radix,
T Result 
) const
inline

Definition at line 508 of file StringRef.h.

References llvm::getAsUnsignedInteger().

◆ getAsInteger() [3/3]

bool StringRef::getAsInteger ( unsigned  Radix,
APInt Result 
) const

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

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

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

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

Definition at line 509 of file StringRef.cpp.

References assert(), empty(), front(), GetAutoSenseRadix(), llvm::APInt::getBitWidth(), size(), substr(), and llvm::APInt::zext().

◆ lower()

std::string StringRef::lower ( ) const

◆ ltrim() [1/2]

LLVM_NODISCARD StringRef llvm::StringRef::ltrim ( char  Char) const
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().

◆ ltrim() [2/2]

LLVM_NODISCARD StringRef llvm::StringRef::ltrim ( StringRef  Chars = " \t\n\v\f\r") const
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.

◆ operator std::string()

llvm::StringRef::operator std::string ( ) const
inline

Definition at line 256 of file StringRef.h.

References LLVM_ATTRIBUTE_ALWAYS_INLINE, LLVM_NODISCARD, and str().

◆ operator=()

template<typename T >
std::enable_if<std::is_same<T, std::string>::value, StringRef>::type& llvm::StringRef::operator= ( T &&  Str)
delete

Disallow accidental assignment from a temporary std::string.

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

Referenced by operator[]().

◆ operator[]()

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

Definition at line 238 of file StringRef.h.

References assert(), and operator=().

◆ rfind() [1/2]

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

Search for the last character C in the string.

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

Definition at line 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().

◆ rfind() [2/2]

size_t StringRef::rfind ( StringRef  Str) const

Search for the last string Str in the string.

rfind - Search for the last string

Returns
The index of the last occurrence of Str, or npos if not found.
  • Str in the string.
Returns
- The index of the last occurrence of
  • Str, or npos if not found.

Definition at line 208 of file StringRef.cpp.

References equals(), N, npos, size(), and substr().

◆ rfind_lower() [1/2]

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

Search for the last character C in the string, ignoring case.

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

Definition at line 193 of file StringRef.cpp.

References From, npos, and llvm::toLower().

Referenced by rfind().

◆ rfind_lower() [2/2]

size_t StringRef::rfind_lower ( StringRef  Str) const

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

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

Definition at line 220 of file StringRef.cpp.

References equals_lower(), N, npos, size(), and substr().

◆ rsplit() [1/2]

LLVM_NODISCARD std::pair<StringRef, StringRef> llvm::StringRef::rsplit ( StringRef  Separator) const
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 == "").

Parameters
Separator- The string to split on.
Returns
- The split substrings.

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().

◆ rsplit() [2/2]

LLVM_NODISCARD std::pair<StringRef, StringRef> llvm::StringRef::rsplit ( char  Separator) const
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 == "").

Parameters
Separator- The character to split on.
Returns
- The split substrings.

Definition at line 813 of file StringRef.h.

References LLVM_NODISCARD, rsplit(), and StringRef().

◆ rtrim() [1/2]

LLVM_NODISCARD StringRef llvm::StringRef::rtrim ( char  Char) const
inline

◆ rtrim() [2/2]

LLVM_NODISCARD StringRef llvm::StringRef::rtrim ( StringRef  Chars = " \t\n\v\f\r") const
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.

◆ size()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t llvm::StringRef::size ( ) const
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().

◆ slice()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::slice ( size_t  Start,
size_t  End 
) const
inline

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

Parameters
StartThe 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.
EndThe 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().

◆ split() [1/4]

LLVM_NODISCARD std::pair<StringRef, StringRef> llvm::StringRef::split ( char  Separator) const
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 == "").

Parameters
SeparatorThe character to split on.
Returns
The split substrings.

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().

◆ split() [2/4]

LLVM_NODISCARD std::pair<StringRef, StringRef> llvm::StringRef::split ( StringRef  Separator) const
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 == "").

Parameters
Separator- The string to split on.
Returns
- The split substrings.

Definition at line 742 of file StringRef.h.

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

◆ split() [3/4]

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

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

Definition at line 314 of file StringRef.cpp.

References empty(), find(), npos, llvm::SmallVectorTemplateBase< T, bool >::push_back(), size(), and slice().

◆ split() [4/4]

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

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

Definition at line 341 of file StringRef.cpp.

References empty(), find(), npos, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and slice().

◆ startswith()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool llvm::StringRef::startswith ( StringRef  Prefix) const
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().

◆ startswith_lower()

bool StringRef::startswith_lower ( StringRef  Prefix) const

◆ str()

LLVM_NODISCARD std::string llvm::StringRef::str ( ) const
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().

◆ substr()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::substr ( size_t  Start,
size_t  N = npos 
) const
inline

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

Parameters
StartThe 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.
NThe 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().

◆ take_back()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::take_back ( size_t  N = 1) const
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().

◆ take_front()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::take_front ( size_t  N = 1) const
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().

◆ take_until()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::take_until ( function_ref< bool(char)>  F) const
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().

◆ take_while()

LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef llvm::StringRef::take_while ( function_ref< bool(char)>  F) const
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().

◆ trim() [1/2]

LLVM_NODISCARD StringRef llvm::StringRef::trim ( char  Char) const
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().

◆ trim() [2/2]

LLVM_NODISCARD StringRef llvm::StringRef::trim ( StringRef  Chars = " \t\n\v\f\r") const
inline

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

Definition at line 855 of file StringRef.h.

References ltrim(), and rtrim().

◆ upper()

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().

◆ withNullAsEmpty()

static StringRef llvm::StringRef::withNullAsEmpty ( const char data)
inlinestatic

Definition at line 98 of file StringRef.h.

References StringRef().

Member Data Documentation

◆ npos

const size_t StringRef::npos = ~size_t(0)
static

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().


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