|
LLVM
4.0.0
|
StringRef - Represent a constant reference to a string, i.e. More...
#include <StringRef.h>
Public Types | |
| typedef const char * | iterator |
| typedef const char * | const_iterator |
| typedef size_t | size_type |
Public Member Functions | |
Iterators | |
| iterator | begin () const |
| iterator | end () const |
| const unsigned char * | bytes_begin () const |
| const unsigned char * | bytes_end () const |
| iterator_range< const unsigned char * > | bytes () const |
String Operations | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * | data () const |
| data - Get a pointer to the start of the string (which may not be null terminated). More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | empty () const |
| empty - Check if the string is empty. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t | size () const |
| size - Get the string size. More... | |
| LLVM_NODISCARD char | front () const |
| front - Get the first character in the string. More... | |
| LLVM_NODISCARD char | back () const |
| back - Get the last character in the string. More... | |
| template<typename Allocator > | |
| LLVM_NODISCARD StringRef | copy (Allocator &A) const |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | equals (StringRef RHS) const |
| equals - Check for string equality, this is more efficient than compare() when the relative ordering of inequal strings isn't needed. More... | |
| LLVM_NODISCARD bool | equals_lower (StringRef RHS) const |
| equals_lower - Check for string equality, ignoring case. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE int | compare (StringRef RHS) const |
compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than, equal to, or greater than the RHS. More... | |
| LLVM_NODISCARD int | compare_lower (StringRef RHS) const |
| compare_lower - Compare two strings, ignoring case. More... | |
| LLVM_NODISCARD int | compare_numeric (StringRef RHS) const |
| compare_numeric - Compare two strings, treating sequences of digits as numbers. More... | |
| LLVM_NODISCARD unsigned | edit_distance (StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const |
| Determine the edit distance between this string and another string. More... | |
| LLVM_NODISCARD std::string | str () const |
| str - Get the contents as an std::string. More... | |
| LLVM_NODISCARD std::string | lower () const |
| LLVM_NODISCARD std::string | upper () const |
| Convert the given ASCII string to uppercase. More... | |
Operator Overloads | |
| LLVM_NODISCARD char | operator[] (size_t Index) const |
| template<typename T > | |
| std::enable_if< std::is_same < T, std::string >::value, StringRef >::type & | operator= (T &&Str)=delete |
| Disallow accidental assignment from a temporary std::string. More... | |
Type Conversions | |
| operator std::string () const | |
String Predicates | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | startswith (StringRef Prefix) const |
Check if this string starts with the given Prefix. More... | |
| LLVM_NODISCARD bool | startswith_lower (StringRef Prefix) const |
Check if this string starts with the given Prefix, ignoring case. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | endswith (StringRef Suffix) const |
Check if this string ends with the given Suffix. More... | |
| LLVM_NODISCARD bool | endswith_lower (StringRef Suffix) const |
Check if this string ends with the given Suffix, ignoring case. More... | |
String Searching | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t | find (char C, size_t From=0) const |
Search for the first character C in the string. More... | |
| LLVM_NODISCARD size_t | find_lower (char C, size_t From=0) const |
Search for the first character C in the string, ignoring case. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t | find_if (function_ref< bool(char)> F, size_t From=0) const |
Search for the first character satisfying the predicate F. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t | find_if_not (function_ref< bool(char)> F, size_t From=0) const |
Search for the first character not satisfying the predicate F. More... | |
| LLVM_NODISCARD size_t | find (StringRef Str, size_t From=0) const |
Search for the first string Str in the string. More... | |
| LLVM_NODISCARD size_t | find_lower (StringRef Str, size_t From=0) const |
Search for the first string Str in the string, ignoring case. More... | |
| LLVM_NODISCARD size_t | rfind (char C, size_t From=npos) const |
Search for the last character C in the string. More... | |
| LLVM_NODISCARD size_t | rfind_lower (char C, size_t From=npos) const |
Search for the last character C in the string, ignoring case. More... | |
| LLVM_NODISCARD size_t | rfind (StringRef Str) const |
Search for the last string Str in the string. More... | |
| LLVM_NODISCARD size_t | rfind_lower (StringRef Str) const |
Search for the last string Str in the string, ignoring case. More... | |
| LLVM_NODISCARD size_t | find_first_of (char C, size_t From=0) const |
Find the first character in the string that is C, or npos if not found. More... | |
| LLVM_NODISCARD size_t | find_first_of (StringRef Chars, size_t From=0) const |
Find the first character in the string that is in Chars, or npos if not found. More... | |
| LLVM_NODISCARD size_t | find_first_not_of (char C, size_t From=0) const |
Find the first character in the string that is not C or npos if not found. More... | |
| LLVM_NODISCARD size_t | find_first_not_of (StringRef Chars, size_t From=0) const |
Find the first character in the string that is not in the string Chars, or npos if not found. More... | |
| LLVM_NODISCARD size_t | find_last_of (char C, size_t From=npos) const |
Find the last character in the string that is C, or npos if not found. More... | |
| LLVM_NODISCARD size_t | find_last_of (StringRef Chars, size_t From=npos) const |
Find the last character in the string that is in C, or npos if not found. More... | |
| LLVM_NODISCARD size_t | find_last_not_of (char C, size_t From=npos) const |
Find the last character in the string that is not C, or npos if not found. More... | |
| LLVM_NODISCARD size_t | find_last_not_of (StringRef Chars, size_t From=npos) const |
Find the last character in the string that is not in Chars, or npos if not found. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | contains (StringRef Other) const |
| Return true if the given string is a substring of *this, and false otherwise. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | contains (char C) const |
| Return true if the given character is contained in *this, and false otherwise. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | contains_lower (StringRef Other) const |
| Return true if the given string is a substring of *this, and false otherwise. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool | contains_lower (char C) const |
| Return true if the given character is contained in *this, and false otherwise. More... | |
Helpful Algorithms | |
| LLVM_NODISCARD size_t | count (char C) const |
Return the number of occurrences of C in the string. More... | |
| size_t | count (StringRef Str) const |
Return the number of non-overlapped occurrences of Str in the string. More... | |
| template<typename T > | |
| std::enable_if < std::numeric_limits< T > ::is_signed, bool >::type | getAsInteger (unsigned Radix, T &Result) const |
| Parse the current string as an integer of the specified radix. More... | |
| template<typename T > | |
| std::enable_if <!std::numeric_limits< T > ::is_signed, bool >::type | getAsInteger (unsigned Radix, T &Result) const |
| template<typename T > | |
| std::enable_if < std::numeric_limits< T > ::is_signed, bool >::type | consumeInteger (unsigned Radix, T &Result) |
| Parse the current string as an integer of the specified radix. More... | |
| template<typename T > | |
| std::enable_if <!std::numeric_limits< T > ::is_signed, bool >::type | consumeInteger (unsigned Radix, T &Result) |
| bool | getAsInteger (unsigned Radix, APInt &Result) const |
Parse the current string as an integer of the specified Radix, or of an autosensed radix if the Radix given is 0. More... | |
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 first N elements remaining. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | take_while (function_ref< bool(char)> F) const |
| Return the longest prefix of 'this' such that every character in the prefix satisfies the given predicate. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | take_until (function_ref< bool(char)> F) const |
| Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicate. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | drop_front (size_t N=1) const |
Return a StringRef equal to 'this' but with the first N elements dropped. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | drop_back (size_t N=1) const |
Return a StringRef equal to 'this' but with the last N elements dropped. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | drop_while (function_ref< bool(char)> F) const |
| Return a StringRef equal to 'this', but with all characters satisfying the given predicate dropped from the beginning of the string. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | drop_until (function_ref< bool(char)> F) const |
| Return a StringRef equal to 'this', but with all characters not satisfying the given predicate dropped from the beginning of the string. More... | |
| LLVM_ATTRIBUTE_ALWAYS_INLINE bool | consume_front (StringRef Prefix) |
| Returns true if this StringRef has the given prefix and removes that prefix. More... | |
| LLVM_ATTRIBUTE_ALWAYS_INLINE bool | consume_back (StringRef Suffix) |
| Returns true if this StringRef has the given suffix and removes that suffix. More... | |
| LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef | slice (size_t Start, size_t End) const |
| Return a reference to the substring from [Start, End). More... | |
| LLVM_NODISCARD std::pair < StringRef, StringRef > | split (char Separator) const |
| Split into two substrings around the first occurrence of a separator character. More... | |
| LLVM_NODISCARD std::pair < StringRef, StringRef > | split (StringRef Separator) const |
| Split into two substrings around the first occurrence of a separator string. More... | |
| void | split (SmallVectorImpl< StringRef > &A, StringRef Separator, int MaxSplit=-1, bool KeepEmpty=true) const |
| Split into substrings around the occurrences of a separator string. More... | |
| void | split (SmallVectorImpl< StringRef > &A, char Separator, int MaxSplit=-1, bool KeepEmpty=true) const |
| Split into substrings around the occurrences of a separator character. More... | |
| LLVM_NODISCARD std::pair < StringRef, StringRef > | rsplit (char Separator) const |
| Split into two substrings around the last occurrence of a separator character. More... | |
| LLVM_NODISCARD StringRef | ltrim (char Char) const |
Return string with consecutive Char characters starting from the the left removed. More... | |
| LLVM_NODISCARD StringRef | ltrim (StringRef Chars=" \t\n\v\f\r") const |
Return string with consecutive characters in Chars starting from the left removed. More... | |
| LLVM_NODISCARD StringRef | rtrim (char Char) const |
Return string with consecutive Char characters starting from the right removed. More... | |
| LLVM_NODISCARD StringRef | rtrim (StringRef Chars=" \t\n\v\f\r") const |
Return string with consecutive characters in Chars starting from the right removed. More... | |
| LLVM_NODISCARD StringRef | trim (char Char) const |
Return string with consecutive Char characters starting from the left and right removed. More... | |
| LLVM_NODISCARD StringRef | trim (StringRef Chars=" \t\n\v\f\r") const |
Return string with consecutive characters in Chars starting from the left and right removed. More... | |
Static Public Attributes | |
| static const size_t | npos = ~size_t(0) |
Constructors | |
| StringRef ()=default | |
| Construct an empty string ref. More... | |
| StringRef (std::nullptr_t)=delete | |
| Disable conversion from nullptr. More... | |
| LLVM_ATTRIBUTE_ALWAYS_INLINE | StringRef (const char *Str) |
| Construct a string ref from a cstring. More... | |
| LLVM_ATTRIBUTE_ALWAYS_INLINE constexpr | StringRef (const char *data, size_t length) |
| Construct a string ref from a pointer and length. More... | |
| LLVM_ATTRIBUTE_ALWAYS_INLINE | StringRef (const std::string &Str) |
| Construct a string ref from an std::string. More... | |
| static StringRef | withNullAsEmpty (const char *data) |
StringRef - Represent a constant reference to a string, i.e.
a character array and a length, which need not be null terminated.
This class does not own the string data, it is expected to be used in situations where the character data resides in some other buffer, whose lifetime extends past that of the StringRef. For this reason, it is not in general safe to store a StringRef.
Definition at line 47 of file StringRef.h.
| typedef const char* llvm::StringRef::const_iterator |
Definition at line 50 of file StringRef.h.
| typedef const char* llvm::StringRef::iterator |
Definition at line 49 of file StringRef.h.
| typedef size_t llvm::StringRef::size_type |
Definition at line 52 of file StringRef.h.
|
default |
|
delete |
Disable conversion from nullptr.
This prevents things like if (S == nullptr)
|
inline |
Construct a string ref from a cstring.
Definition at line 82 of file StringRef.h.
|
inline |
Construct a string ref from a pointer and length.
Definition at line 87 of file StringRef.h.
|
inline |
Construct a string ref from an std::string.
Definition at line 92 of file StringRef.h.
|
inline |
back - Get the last character in the string.
Definition at line 146 of file StringRef.h.
References assert(), and empty().
Referenced by llvm::ConstantDataSequential::isCString(), llvm::yaml::needsQuotes(), parsePhysicalReg(), and unescapeQuotedString().
|
inline |
Definition at line 103 of file StringRef.h.
Referenced by llvm::SmallString< 256 >::append(), llvm::sys::path::append(), llvm::SmallString< 256 >::assign(), llvm::MDString::begin(), llvm::yaml::BlockScalarNode::BlockScalarNode(), bytes_begin(), llvm::detail::IEEEFloat::convertFromString(), llvm::convertUTF8ToUTF16String(), llvm::ConvertUTF8toWide(), copy(), llvm::MachineFunction::createExternalSymbolName(), llvm::sys::fs::createTemporaryFile(), decodeUTF8(), llvm::MCObjectStreamer::EmitBytes(), llvm::yaml::escape(), llvm::APInt::getBitsNeeded(), llvm::MemoryBufferRef::getBufferStart(), getHostID(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::Archive::Symbol::getName(), llvm::object::Archive::getNumberOfSymbols(), llvm::StringToOffsetTable::GetOrAddStringOffset(), llvm::object::ELFFile< ELFT >::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::Timer::init(), llvm::LLLexer::LLLexer(), llvm::MIToken::location(), llvm::object::MachOUniversalBinary::MachOUniversalBinary(), llvm::sys::fs::make_absolute(), mangleCoveragePath(), llvm::ModuleSummaryIndex::mergeFrom(), 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::DWARFDebugLoc::parse(), llvm::DWARFDebugLocDWO::parse(), llvm::InlineAsm::ConstraintInfo::Parse(), llvm::InlineAsm::ParseConstraints(), parseDouble(), parsePhysicalReg(), llvm::parseType(), printName(), llvm::sys::path::replace_extension(), llvm::sys::path::replace_path_prefix(), llvm::yaml::ScalarNode::ScalarNode(), llvm::AsmLexer::setBuffer(), llvm::EngineBuilder::setMArch(), llvm::EngineBuilder::setMCPU(), llvm::TimerGroup::setName(), llvm::Regex::sub(), llvm::object::Archive::symbol_begin(), and llvm::TGLexer::TGLexer().
|
inline |
Definition at line 113 of file StringRef.h.
References bytes_begin(), bytes_end(), and llvm::make_range().
Referenced by llvm::ConstantFoldLoadFromConstPtr().
Definition at line 107 of file StringRef.h.
References begin().
Referenced by bytes(), llvm::MDString::bytes_begin(), llvm::codeview::consume(), isIntrinsicSourceOfDivergence(), promoteToConstantPool(), and llvm::msf::StreamWriter::writeFixedString().
Definition at line 110 of file StringRef.h.
References end().
Referenced by bytes(), llvm::MDString::bytes_end(), llvm::codeview::consume(), promoteToConstantPool(), and llvm::msf::StreamWriter::writeFixedString().
|
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 181 of file StringRef.h.
References fuzzer::min().
Referenced by llvm::FunctionComparator::cmpMem(), llvm::SmallString< 256 >::compare(), compareNames(), llvm::operator<(), llvm::operator<=(), llvm::operator>(), llvm::operator>=(), and SortSymbolPair().
| int StringRef::compare_lower | ( | StringRef | RHS | ) | const |
compare_lower - Compare two strings, ignoring case.
compare_lower - Compare strings, ignoring case.
Definition at line 52 of file StringRef.cpp.
References ascii_strncasecmp(), and fuzzer::min().
Referenced by llvm::SmallString< 256 >::compare_lower(), equals_lower(), and llvm::DetectRoundChange::runOnMachineFunction().
| int StringRef::compare_numeric | ( | StringRef | RHS | ) | const |
compare_numeric - Compare two strings, treating sequences of digits as numbers.
compare_numeric - Compare strings, handle embedded numbers.
Definition at line 78 of file StringRef.cpp.
References ascii_isdigit(), E, I, and fuzzer::min().
Referenced by llvm::SmallString< 256 >::compare_numeric().
|
inline |
Returns true if this StringRef has the given suffix and removes that suffix.
Definition at line 678 of file StringRef.h.
References drop_back(), endswith(), and size().
Referenced by parseDevirtPassName(), and parseRepeatPassName().
|
inline |
Returns true if this StringRef has the given prefix and removes that prefix.
Definition at line 667 of file StringRef.h.
References drop_front(), size(), and startswith().
Referenced by llvm::detail::HelperFunctions::consumeHexStyle(), llvm::format_provider< T, typename std::enable_if< detail::use_integral_formatter< T >::value >::type >::format(), llvm::format_provider< T, typename std::enable_if< detail::use_double_formatter< T >::value >::type >::format(), parseDevirtPassName(), and parseRepeatPassName().
|
inline |
Parse the current string as an integer of the specified radix.
If Radix is specified as zero, this does radix autosensing using extended C rules: 0 is octal, 0x is hex, 0b is binary.
If the string does not begin with a number of the specified radix, this returns true to signify the error. The string is considered erroneous if empty or if it overflows T. The portion of the string representing the discovered numeric value is removed from the beginning of the string.
Definition at line 528 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(), and llvm::formatv_object_base::parseReplacementItem().
|
inline |
Definition at line 539 of file StringRef.h.
References llvm::consumeUnsignedInteger().
|
inline |
Return true if the given string is a substring of *this, and false otherwise.
Definition at line 445 of file StringRef.h.
Referenced by llvm::AMDGPUSubtarget::initializeSubtargetDependencies(), and llvm::PassArgFilter< Args >::operator()().
|
inline |
Return true if the given character is contained in *this, and false otherwise.
Definition at line 451 of file StringRef.h.
References find_first_of(), and npos.
|
inline |
Return true if the given string is a substring of *this, and false otherwise.
Definition at line 457 of file StringRef.h.
References find_lower(), and npos.
|
inline |
Return true if the given character is contained in *this, and false otherwise.
Definition at line 465 of file StringRef.h.
References find_lower(), and npos.
|
inline |
Definition at line 153 of file StringRef.h.
References begin(), empty(), end(), and StringRef().
Referenced by llvm::StringInit::get(), llvm::CodeInit::get(), and llvm::yaml::Document::parseBlockNode().
|
inline |
Return the number of occurrences of C in the string.
Definition at line 473 of file StringRef.h.
References i.
Referenced by llvm::SmallString< 256 >::count(), llvm::HexagonInstrInfo::getInlineAsmLength(), and llvm::InlineAsm::ConstraintInfo::Parse().
| size_t StringRef::count | ( | StringRef | Str | ) | const |
|
inline |
data - Get a pointer to the start of the string (which may not be null terminated).
Definition at line 125 of file StringRef.h.
Referenced by llvm::SourceMgr::AddIncludeFile(), llvm::FoldingSetNodeID::AddString(), annotateAllFunctions(), llvm::object::ArchiveMemberHeader::ArchiveMemberHeader(), llvm::object::ELFFile< ELFT >::base(), llvm::CachedHashString::CachedHashString(), llvm::StringSwitch< T, R >::Case(), llvm::object::Archive::Child::Child(), llvm::sys::unicode::columnWidthUTF8(), llvm::zlib::compress(), llvm::ConvertUTF8toWide(), CopyStringRef(), llvm::zlib::crc32(), llvm::StringMapEntry< bool >::Create(), llvm::X86Operand::CreateToken(), llvm::DWARFDebugPubTable::dump(), llvm::DWARFDebugLine::Prologue::dump(), edit_distance(), llvm::BitstreamWriter::emitBlob(), llvm::InstrProfRecordWriterTrait::EmitKey(), llvm::RuntimeDyldImpl::emitSection(), llvm::StringSwitch< T, R >::EndsWith(), llvm::cl::Option::error(), ExecGraphViewer(), llvm::DWARFFormValue::extractValue(), find(), llvm::pdb::DIASession::findSourceFiles(), llvm::object::ArchiveMemberHeader::getAccessMode(), llvm::DataExtractor::getCStr(), llvm::AsmToken::getEndLoc(), llvm::object::ArchiveMemberHeader::getGID(), llvm::DenseMapInfo< StringRef >::getHashValue(), getID(), llvm::object::MachOObjectFile::getIndirectName(), llvm::Mips16InstrInfo::getInlineAsmLength(), llvm::HexagonInstrInfo::getInlineAsmLength(), llvm::TargetInstrInfo::getInlineAsmLength(), llvm::object::ArchiveMemberHeader::getLastModified(), llvm::AsmToken::getLoc(), llvm::MemoryBuffer::getMemBufferCopy(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::Elf_Sym_Impl< ELFT >::getName(), 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::ConstantDataVector::getSplatValue(), llvm::ConstantDataArray::getString(), llvm::object::MachOObjectFile::getSymbolName(), llvm::DataExtractor::getU16(), llvm::DataExtractor::getU32(), llvm::DataExtractor::getU64(), llvm::DataExtractor::getU8(), llvm::object::ArchiveMemberHeader::getUID(), llvm::SHA1::hash(), llvm::pdb::hashStringV1(), llvm::sys::fs::identify_magic(), llvm::ExecutionEngine::InitializeMemory(), llvm::yaml::ScalarTraits< char_16 >::input(), llvm::DenseMapInfo< StringRef >::isEqual(), LLVMGetAsString(), LLVMGetSectionContents(), LLVMGetSectionName(), LLVMGetStructName(), LLVMTargetMachineEmitToMemoryBuffer(), loadTestingFormat(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::TargetIntrinsicInfo::lookupName(), llvm::yaml::MappingTraits< DiagnosticInfoOptimizationBase::Argument >::mapping(), llvm::Regex::match(), llvm::sys::path::native(), llvm::raw_ostream::operator<<(), llvm::cl::ParseEnvironmentOptions(), llvm::opt::OptTable::ParseOneArg(), llvm::PassNameParser::passRegistered(), llvm::ScopedPrinter::printBinary(), llvm::ScopedPrinter::printBinaryBlock(), llvm::RuntimeDyldELF::processRelocationRef(), ProvideOption(), readCoverageMappingData(), llvm::GCOVBuffer::readInt(), llvm::readPGOFuncNameStrings(), llvm::LessRecordRegister::RecordParts::RecordParts(), llvm::Regex::Regex(), replaceSubString(), llvm::report_fatal_error(), llvm::RuntimeDyldImpl::resolveExternalSymbols(), RewriteIntelBracExpression(), llvm::StringSaver::save(), llvm::yaml::Output::scalarString(), llvm::orc::rpc::SerializationTraits< ChannelT, std::string, StringRef, typename std::enable_if< std::is_base_of< RawByteChannel, ChannelT >::value >::type >::serialize(), llvm::X86Operand::setTokenValue(), llvm::StringSwitch< T, R >::StartsWith(), llvm::cl::TokenizeGNUCommandLine(), llvm::cl::TokenizeWindowsCommandLine(), llvm::zlib::uncompress(), llvm::SHA1::update(), llvm::MD5::update(), llvm::StringTableBuilder::write(), writeUstarHeader(), and llvm::xxHash64().
|
inline |
Return a StringRef equal to 'this' but with the last N elements dropped.
Definition at line 643 of file StringRef.h.
References assert(), N, size(), and substr().
Referenced by consume_back(), llvm::GlobPattern::create(), llvm::object::ArchiveMemberHeader::getName(), llvm::codeview::TypeDatabase::getTypeName(), llvm::ConstantDataSequential::isCString(), mapNameAndUniqueName(), llvm::yaml::Document::parseBlockNode(), rtrim(), smallData(), and take_front().
|
inline |
Return a StringRef equal to 'this' but with the first N elements dropped.
Definition at line 634 of file StringRef.h.
References assert(), N, size(), and substr().
Referenced by consume_front(), llvm::formatv_object_base::consumeFieldLayout(), llvm::consumeSignedInteger(), llvm::GlobPattern::create(), ExpandResponseFile(), find_if(), find_lower(), findTargetSubtable(), llvm::getFuncNameWithoutPrefix(), llvm::InstrProfSymtab::getOrigFuncName(), llvm::getTypeName(), llvm::yaml::isNumber(), llvm::yaml::isNumeric(), lexName(), ltrim(), MatchCoprocessorOperandName(), NaiveLogLoader(), llvm::PassInfoMixin< PromotePass >::name(), llvm::formatv_object_base::parseReplacementItem(), llvm::formatv_object_base::splitLiteralAndReplacement(), take_back(), and upgradeLoopTag().
|
inline |
|
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 652 of file StringRef.h.
References F, find_if_not(), and substr().
| unsigned StringRef::edit_distance | ( | llvm::StringRef | Other, |
| bool | AllowReplacements = true, |
||
| unsigned | MaxEditDistance = 0 |
||
| ) | const |
Determine the edit distance between this string and another string.
| Other | the string to compare this string against. |
| AllowReplacements | whether to allow character replacements (change one character into another) as a single operation, rather than as two operations (an insertion and a removal). |
| MaxEditDistance | If non-zero, the maximum edit distance that this routine is allowed to compute. If the edit distance will exceed that maximum, returns MaxEditDistance+1. |
AllowReplacements is true) replacements needed to transform one of the given strings into the other. If zero, the strings are identical. Definition at line 109 of file StringRef.cpp.
References llvm::ComputeEditDistance(), data(), llvm::makeArrayRef(), and size().
Referenced by LookupNearestOption().
|
inline |
empty - Check if the string is empty.
Definition at line 130 of file StringRef.h.
Referenced by llvm::SubtargetFeatures::AddFeature(), llvm::CodeViewContext::addFile(), llvm::ExecutionEngine::addGlobalMapping(), llvm::DwarfUnit::addLinkageName(), llvm::DwarfUnit::applySubprogramAttributes(), llvm::DwarfUnit::applySubprogramDefinitionAttributes(), llvm::DwarfCompileUnit::applyVariableAttributes(), llvm::APSInt::APSInt(), back(), llvm::DICompositeType::buildODRType(), llvm::canRenameComdatFunc(), CloneInstructionInExitBlock(), llvm::ModuleSymbolTable::CollectAsmSymbols(), 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(), CopyStringRef(), llvm::GlobPattern::create(), llvm::StructType::create(), llvm::sys::fs::create_directories(), createAArch64MCSubtargetInfo(), llvm::MDBuilder::createAnonymousAARoot(), llvm::ARM_MC::createARMMCSubtargetInfo(), llvm::DIBuilder::createBasicType(), llvm::DIBuilder::createEnumerator(), llvm::DIBuilder::createExternalTypeRef(), llvm::DIBuilder::createMacro(), llvm::createSanitizerCtorAndInitFunctions(), createSparcMCSubtargetInfo(), llvm::sys::fs::createTemporaryFile(), llvm::DIBuilder::createUnspecifiedType(), llvm::X86_MC::createX86MCSubtargetInfo(), decodeBase64StringEntry(), llvm::DelimitedScope< Open, Close >::DelimitedScope(), llvm::pdb::DIAError::DIAError(), EatNumber(), emitComments(), emitDebugValueComment(), EmitGenDwarfAbbrev(), EmitGenDwarfInfo(), llvm::TargetLoweringObjectFileMachO::emitModuleFlags(), llvm::cl::Option::error(), llvm::DWARFFormValue::extractValue(), find_if(), llvm::pdb::DIASession::findSourceFiles(), foldBlockIntoPredecessor(), llvm::format_provider< T, typename std::enable_if< detail::use_integral_formatter< T >::value >::type >::format(), llvm::format_provider< T, typename std::enable_if< detail::use_string_formatter< T >::value >::type >::format(), llvm::format_provider< T, typename std::enable_if< detail::use_char_formatter< T >::value >::type >::format(), front(), llvm::pdb::GenericError::GenericError(), llvm::Attribute::get(), getARClassRegisterMask(), llvm::Triple::getARMCPUForArch(), getAsInteger(), llvm::getAsSignedInteger(), llvm::getAsUnsignedInteger(), GetAutoSenseRadix(), llvm::APInt::getBitsNeeded(), llvm::ARM::getCanonicalArchName(), llvm::DINode::getCanonicalMDString(), llvm::DIMacroNode::getCanonicalMDString(), getChompedLineBreaks(), llvm::MCContext::getCOFFSection(), getCommonClassOptions(), llvm::DOTGraphTraits< const Function * >::getCompleteNodeLabel(), llvm::getCPU(), getELFKindForNamedSection(), llvm::SubtargetFeatures::getFeatureBits(), llvm::MCDwarfLineTableHeader::getFile(), llvm::getFuncNameWithoutPrefix(), llvm::object::ArchiveMemberHeader::getGID(), llvm::GlobalValue::getGlobalIdentifier(), getGPUOrDefault(), getItineraryLatency(), llvm::TargetLibraryInfoImpl::getLibFunc(), llvm::object::MachOObjectFile::getLibraryShortNameByIndex(), getMClassFlagsMask(), getMClassRegisterMask(), getMemcpyLoadsAndStores(), getMemsetStringVal(), getNameWithPrefixImpl(), llvm::DICompositeType::getODRTypeIfExists(), getOpEnabled(), getOpRefinementSteps(), llvm::DwarfUnit::getOrCreateModule(), llvm::DwarfUnit::getOrCreateNameSpace(), llvm::MCContext::getOrCreateSymbol(), llvm::DwarfUnit::getParentContextString(), getPrettyScopeName(), llvm::GlobalValue::getRealLinkageName(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLibraryInfoImpl::getScalarizedFunction(), getSearchPaths(), llvm::DOTGraphTraits< const Function * >::getSimpleNodeLabel(), llvm::DataExtractor::getSLEB128(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), GetSymbolFromOperand(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::lto::getThinLTOOutputFile(), llvm::getTypeName(), llvm::object::ArchiveMemberHeader::getUID(), llvm::DataExtractor::getULEB128(), getValueStr(), llvm::TargetLibraryInfoImpl::getVectorizedFunction(), llvm::yaml::Node::getVerbatimTag(), 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(), hasFlag(), llvm::GlobalValue::hasSection(), llvm::object::Archive::hasSymbolTable(), llvm::PassNameParser::ignorablePass(), llvm::NVPTXSubtarget::initializeSubtargetDependencies(), llvm::MCSubtargetInfo::InitMCProcessorInfo(), llvm::StringSet< AllocatorTy >::insert(), isCanonical(), isEnabled(), llvm::TargetLibraryInfoImpl::isFunctionScalarizable(), llvm::TargetLibraryInfoImpl::isFunctionVectorizable(), isRepeatedByteSequence(), llvm::MCAsmInfo::isValidUnquotedName(), llvm::LineEditor::LineEditor(), llvm::LoadAndStorePromoter::LoadAndStorePromoter(), loadBinaryFormat(), LookupNearestOption(), llvm::yaml::MappingTraits< DWARFYAML::FormValue >::mapping(), llvm::yaml::MappingTraits< DWARFYAML::LineTableOpcode >::mapping(), llvm::codeview::CodeViewRecordIO::mapStringZVectorZ(), matchAsm(), NaiveLogLoader(), llvm::yaml::needsQuotes(), llvm::Triple::normalize(), llvm::DWARFGdbIndex::parse(), llvm::PassBuilder::parseAAPipeline(), parseARMArch(), llvm::ARM_MC::ParseARMTriple(), llvm::formatv_object_base::parseFormatString(), llvm::detail::HelperFunctions::parseNumericPrecision(), llvm::formatv_object_base::parseReplacementItem(), llvm::MCSectionMachO::ParseSectionSpecifier(), parseSubArch(), parseVersionFromName(), llvm::DiagnosticInfoSampleProfile::print(), llvm::MCInstPrinter::printAnnotation(), llvm::AArch64InstPrinter::printBarrierOption(), PrintCFIEscape(), printExtendedName(), printFile(), llvm::printLLVMNameWithoutPrefix(), printMetadataIdentifier(), llvm::cl::generic_parser_base::printOptionInfo(), llvm::MCSectionMachO::PrintSwitchToSection(), printSymbolizedStackTrace(), llvm::codeview::CVTypeDumper::printTypeIndex(), llvm::AttributeImpl::Profile(), llvm::GCOVBuffer::readArcTag(), llvm::GCOVBuffer::readBlockTag(), llvm::GCOVBuffer::readEdgeTag(), llvm::GCOVBuffer::readFunctionTag(), llvm::GCOVBuffer::readLineTag(), llvm::TextInstrProfReader::readNextRecord(), llvm::GCOVBuffer::readObjectTag(), llvm::GCOVBuffer::readProgramTag(), llvm::LessRecordRegister::RecordParts::RecordParts(), llvm::sys::path::replace_path_prefix(), llvm::ThinLTOCodeGenerator::run(), sanitizeFunctionName(), llvm::yaml::Output::scalarString(), llvm::Hexagon_MC::selectHexagonCPU(), llvm::MIPS_MC::selectMipsCPU(), llvm::EngineBuilder::selectTarget(), llvm::cl::Option::setArgStr(), setFunctionAttributes(), llvm::StructType::setName(), llvm::GlobalObject::setSection(), split(), split(), StripTypeNames(), llvm::Regex::sub(), llvm::ExecutionEngine::updateGlobalMapping(), UsesVectorABI(), llvm::InlineAsm::Verify(), llvm::StringTableBuilder::write(), writeGeneratedObject(), and llvm::yaml::yamlize().
|
inline |
Definition at line 105 of file StringRef.h.
Referenced by llvm::SmallString< 256 >::append(), llvm::sys::path::append(), llvm::SmallString< 256 >::assign(), llvm::yaml::BlockScalarNode::BlockScalarNode(), bytes_end(), llvm::convertUTF8ToUTF16String(), llvm::ConvertUTF8toWide(), copy(), llvm::MachineFunction::createExternalSymbolName(), decodeUTF8(), llvm::MCObjectStreamer::EmitBytes(), llvm::MDString::end(), endswith(), endswith_lower(), llvm::yaml::escape(), llvm::MemoryBufferRef::getBufferEnd(), getHostID(), llvm::StringToOffsetTable::GetOrAddStringOffset(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::object::ELFFile< ELFT >::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::Timer::init(), llvm::AsmLexer::LexUntilEndOfStatement(), llvm::sys::fs::make_absolute(), mangleCoveragePath(), llvm::SmallString< 256 >::operator+=(), llvm::opt::OptTable::OptTable(), llvm::DWARFDebugLoc::parse(), llvm::DWARFDebugLocDWO::parse(), llvm::InlineAsm::ConstraintInfo::Parse(), llvm::InlineAsm::ParseConstraints(), parseDouble(), parsePhysicalReg(), parseRegisterNumber(), printName(), llvm::Regex::Regex(), llvm::sys::path::replace_extension(), llvm::sys::path::replace_path_prefix(), llvm::yaml::ScalarNode::ScalarNode(), llvm::EngineBuilder::setMArch(), llvm::EngineBuilder::setMCPU(), llvm::TimerGroup::setName(), and llvm::Regex::sub().
|
inline |
Check if this string ends with the given Suffix.
Definition at line 276 of file StringRef.h.
References end().
Referenced by consume_back(), llvm::GlobPattern::create(), llvm::SmallString< 256 >::endswith(), llvm::ARM::getCanonicalArchName(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), getVarName(), isAnonymous(), llvm::GlobPattern::match(), llvm::ARM::parseArchEndian(), and shouldInstrumentReadWriteFromAddress().
Check if this string ends with the given Suffix, ignoring case.
Definition at line 67 of file StringRef.cpp.
References ascii_strncasecmp(), and end().
Referenced by llvm::StringSwitch< T, R >::EndsWithLower().
|
inline |
equals - Check for string equality, this is more efficient than compare() when the relative ordering of inequal strings isn't needed.
Definition at line 166 of file StringRef.h.
Referenced by llvm::BlockFrequencyInfo::calculate(), count(), llvm::SmallString< 256 >::equals(), llvm::findStringMetadataForLoop(), getSummaryFromMD(), llvm::GetUnrollMetadata(), getVal(), llvm::getValueProfDataFromInst(), llvm::yaml::isBool(), isGCSafepointPoll(), isKeyValuePair(), llvm::yaml::isNull(), llvm::yaml::isNumber(), llvm::yaml::isNumeric(), isSmallDataSection(), makeStatepointExplicitImpl(), llvm::operator==(), parseBPFArch(), llvm::MIRParserImpl::parseRegisterInfo(), parseSegmentLoadCommand(), rfind(), and llvm::MachineBlockFrequencyInfo::runOnMachineFunction().
|
inline |
equals_lower - Check for string equality, ignoring case.
Definition at line 173 of file StringRef.h.
References compare_lower().
Referenced by llvm::StringSwitch< T, R >::CaseLower(), llvm::SmallString< 256 >::equals_lower(), llvm::PPCTargetLowering::getRegForInlineAsmConstraint(), llvm::X86TargetLowering::getRegForInlineAsmConstraint(), llvm::TextInstrProfReader::readHeader(), rfind_lower(), and llvm::StrInStrNoCase().
|
inline |
Search for the first character C in the string.
C, or npos if not found. Definition at line 295 of file StringRef.h.
References fuzzer::min(), npos, and P.
Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), checkLinkerOptCommand(), CommaSeparateAndAddOccurrence(), contains(), emitComments(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::SmallString< 256 >::find(), find_first_of(), llvm::ARM::getCanonicalArchName(), llvm::getConstantStringInfo(), llvm::DataExtractor::getCStr(), llvm::HexagonTargetObjectFile::getExplicitSectionGlobal(), llvm::object::ArchiveMemberHeader::getName(), getObjCClassCategory(), getObjCMethodName(), llvm::object::ArchiveMemberHeader::getRawName(), llvm::getTypeName(), llvm::yaml::ScalarNode::getValue(), llvm::object::MachOObjectFile::guessLibraryShortName(), hasObjCCategory(), llvm::ConstantDataSequential::isCString(), llvm::objcarc::IsObjCIdentifiedObject(), isSmallDataSection(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), ParseLine(), parseRefinementStep(), printSymbolizedStackTrace(), sanitizeFunctionName(), scan(), split(), and UpgradeIntrinsicFunction1().
| size_t StringRef::find | ( | StringRef | Str, |
| size_t | From = 0 |
||
| ) | const |
Search for the first string Str in the string.
find - Search for the first string
Str, or npos if not found.Definition at line 147 of file StringRef.cpp.
References data(), i, LLVM_UNLIKELY, N, npos, Ptr, and size().
| StringRef::size_type StringRef::find_first_not_of | ( | char | C, |
| size_t | From = 0 |
||
| ) | const |
Find the first character in the string that is not C or npos if not found.
find_first_not_of - Find the first character in the string that is not
Definition at line 264 of file StringRef.cpp.
References i, fuzzer::min(), and npos.
Referenced by llvm::DWARFContextInMemory::DWARFContextInMemory(), llvm::SmallString< 256 >::find_first_not_of(), llvm::getToken(), llvm::yaml::isNumber(), ltrim(), matchAsm(), llvm::yaml::needsQuotes(), ParseLine(), printName(), and llvm::Regex::sub().
| StringRef::size_type StringRef::find_first_not_of | ( | StringRef | Chars, |
| size_t | From = 0 |
||
| ) | const |
Find the first character in the string that is not in the string Chars, or npos if not found.
find_first_not_of - Find the first character in the string that is not in the string
Complexity: O(size() + Chars.size())
Note: O(size() + Chars.size())
Definition at line 275 of file StringRef.cpp.
References i, fuzzer::min(), npos, and size().
|
inline |
Find the first character in the string that is C, or npos if not found.
Same as find.
Definition at line 392 of file StringRef.h.
References find().
Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), contains(), llvm::sys::fs::createTemporaryFile(), llvm::SmallString< 256 >::find_first_of(), llvm::InstrProfSymtab::getOrigFuncName(), llvm::getToken(), llvm::yaml::ScalarNode::getValue(), hasWildcard(), llvm::Regex::isLiteralERE(), and llvm::formatv_object_base::splitLiteralAndReplacement().
| StringRef::size_type StringRef::find_first_of | ( | StringRef | Chars, |
| size_t | From = 0 |
||
| ) | const |
Find the first character in the string that is in Chars, or npos if not found.
find_first_of - Find the first character in the string that is in
Complexity: O(size() + Chars.size())
Note: O(size() + Chars.size())
Definition at line 250 of file StringRef.cpp.
References i, fuzzer::min(), npos, and size().
|
inline |
Search for the first character satisfying the predicate F.
F starting from From, or npos if not found. Definition at line 318 of file StringRef.h.
References drop_front(), empty(), F, front(), npos, and size().
Referenced by drop_until(), find_if_not(), find_lower(), and take_until().
|
inline |
Search for the first character not satisfying the predicate F.
F starting from From, or npos if not found. Definition at line 334 of file StringRef.h.
Referenced by drop_while(), and take_while().
| StringRef::size_type StringRef::find_last_not_of | ( | char | C, |
| size_t | From = npos |
||
| ) | const |
Find the last character in the string that is not C, or npos if not found.
find_last_not_of - Find the last character in the string that is not
Definition at line 305 of file StringRef.cpp.
References i, fuzzer::min(), and npos.
Referenced by rtrim().
| StringRef::size_type StringRef::find_last_not_of | ( | StringRef | Chars, |
| size_t | From = npos |
||
| ) | const |
Find the last character in the string that is not in Chars, or npos if not found.
find_last_not_of - Find the last character in the string that is not in
Complexity: O(size() + Chars.size())
Note: O(size() + Chars.size())
Definition at line 316 of file StringRef.cpp.
References i, fuzzer::min(), npos, and size().
|
inline |
Find the last character in the string that is C, or npos if not found.
Definition at line 418 of file StringRef.h.
References rfind().
Referenced by llvm::sys::path::extension(), llvm::SmallString< 256 >::find_last_of(), llvm::SourceMgr::getLineAndColumn(), llvm::yaml::Node::getVerbatimTag(), ParseLine(), llvm::sys::path::replace_extension(), and llvm::sys::path::stem().
| StringRef::size_type StringRef::find_last_of | ( | StringRef | Chars, |
| size_t | From = npos |
||
| ) | const |
Find the last character in the string that is in C, or npos if not found.
find_last_of - Find the last character in the string that is in
Complexity: O(size() + Chars.size())
Note: O(size() + Chars.size())
Definition at line 291 of file StringRef.cpp.
References i, fuzzer::min(), npos, and size().
| size_t StringRef::find_lower | ( | char | C, |
| size_t | From = 0 |
||
| ) | const |
Search for the first character C in the string, ignoring case.
C, or npos if not found. Definition at line 72 of file StringRef.cpp.
References ascii_tolower(), D, find_if(), and L.
Referenced by contains_lower().
| size_t StringRef::find_lower | ( | StringRef | Str, |
| size_t | From = 0 |
||
| ) | const |
Search for the first string Str in the string, ignoring case.
Str, or npos if not found. Definition at line 196 of file StringRef.cpp.
References drop_front(), npos, size(), startswith_lower(), and substr().
|
inline |
front - Get the first character in the string.
Definition at line 139 of file StringRef.h.
References assert(), and empty().
Referenced by llvm::consumeSignedInteger(), ExpandResponseFile(), find_if(), llvm::formLCSSAForInstructions(), getAsInteger(), llvm::yaml::isNumeric(), llvm::yaml::needsQuotes(), llvm::PassBuilder::parsePassPipeline(), parsePhysicalReg(), llvm::formatv_object_base::parseReplacementItem(), rewritePHIs(), SimplifyCondBranchToCondBranch(), and unescapeQuotedString().
|
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 494 of file StringRef.h.
References llvm::getAsSignedInteger().
Referenced by llvm::object::Archive::Child::Child(), EmitGCCInlineAsmStr(), EmitMSInlineAsmStr(), llvm::X86FrameLowering::emitPrologue(), llvm::format_provider< T, typename std::enable_if< detail::use_string_formatter< T >::value >::type >::format(), llvm::object::ArchiveMemberHeader::getAccessMode(), llvm::object::ArchiveMemberHeader::getGID(), getInt(), llvm::AMDGPU::getIntegerAttribute(), llvm::object::ArchiveMemberHeader::getLastModified(), llvm::object::ArchiveMemberHeader::getName(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::object::ArchiveMemberHeader::getSize(), llvm::object::ArchiveMemberHeader::getUID(), llvm::yaml::CustomMappingTraits< GlobalValueSummaryMapTy >::inputOne(), parseDevirtPassName(), ParseHead(), ParseLine(), llvm::detail::HelperFunctions::parseNumericPrecision(), parseRepeatPassName(), parseSectionFlags(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::parseStatepointDirectivesFromAttrs(), llvm::StackProtector::runOnFunction(), llvm::Regex::sub(), WindowsRequiresStackProbe(), and llvm::yaml::BinaryRef::writeAsBinary().
|
inline |
Definition at line 505 of file StringRef.h.
References llvm::getAsUnsignedInteger().
Parse the current string as an integer of the specified Radix, or of an autosensed radix if the Radix given is 0.
The current value in Result is discarded, and the storage is changed to be wide enough to store the parsed integer.
APInt::fromString is superficially similar but assumes the string is well-formed in the given radix.
Definition at line 523 of file StringRef.cpp.
References assert(), empty(), front(), GetAutoSenseRadix(), llvm::APInt::getBitWidth(), size(), substr(), and llvm::APInt::zext().
| std::string StringRef::lower | ( | ) | const |
Definition at line 122 of file StringRef.cpp.
References ascii_tolower(), i, and size().
Referenced by llvm::SubtargetFeatures::AddFeature(), llvm::MIRPrinter::convert(), llvm::MipsTargetAsmStreamer::emitDirectiveCpLoad(), llvm::MipsTargetAsmStreamer::emitDirectiveCpsetup(), llvm::MipsTargetAsmStreamer::emitFrame(), llvm::SparcTargetAsmStreamer::emitSparcRegisterIgnore(), llvm::SparcTargetAsmStreamer::emitSparcRegisterScratch(), getBankedRegisterMask(), getMClassRegisterMask(), getMClassRegisterSYSmValueMask(), llvm::MipsAsmPrinter::printOperand(), llvm::SparcInstPrinter::printRegName(), llvm::XCoreInstPrinter::printRegName(), llvm::LanaiInstPrinter::printRegName(), and llvm::MipsInstPrinter::printRegName().
|
inline |
Return string with consecutive Char characters starting from the the left removed.
Definition at line 797 of file StringRef.h.
References drop_front(), find_first_not_of(), and fuzzer::min().
Referenced by llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::opt::OptTable::ParseOneArg(), and trim().
|
inline |
Return string with consecutive characters in Chars starting from the left removed.
Definition at line 804 of file StringRef.h.
References drop_front(), find_first_not_of(), and fuzzer::min().
|
inline |
Definition at line 253 of file StringRef.h.
References 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.
|
inline |
Definition at line 235 of file StringRef.h.
References assert().
|
inline |
Search for the last character C in the string.
C, or npos if not found. Definition at line 357 of file StringRef.h.
References i, fuzzer::min(), and npos.
Referenced by find_last_of(), llvm::getTypeName(), llvm::object::MachOObjectFile::guessLibraryShortName(), ParseHead(), llvm::SmallString< 256 >::rfind(), rsplit(), and splitPath().
| size_t StringRef::rfind | ( | StringRef | Str | ) | const |
Search for the last string Str in the string.
rfind - Search for the last string
Str, or npos if not found.Definition at line 222 of file StringRef.cpp.
| size_t StringRef::rfind_lower | ( | char | C, |
| size_t | From = npos |
||
| ) | const |
Search for the last character C in the string, ignoring case.
C, or npos if not found. Definition at line 207 of file StringRef.cpp.
References ascii_tolower(), i, fuzzer::min(), and npos.
| size_t StringRef::rfind_lower | ( | StringRef | Str | ) | const |
Search for the last string Str in the string, ignoring case.
Str, or npos if not found. Definition at line 234 of file StringRef.cpp.
References equals_lower(), i, N, npos, size(), and substr().
|
inline |
Split into two substrings around the last occurrence of a separator character.
If Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is minimal. If Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").
| Separator | - The character to split on. |
Definition at line 787 of file StringRef.h.
References npos, rfind(), slice(), and StringRef().
|
inline |
Return string with consecutive Char characters starting from the right removed.
Definition at line 811 of file StringRef.h.
References drop_back(), find_last_not_of(), and fuzzer::min().
Referenced by llvm::object::Archive::Child::Child(), llvm::RuntimeDyldCheckerExprEval::evaluate(), llvm::object::ArchiveMemberHeader::getAccessMode(), llvm::object::ArchiveMemberHeader::getGID(), llvm::object::ArchiveMemberHeader::getLastModified(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::ArchiveMemberHeader::getRawLastModified(), llvm::object::ArchiveMemberHeader::getSize(), llvm::object::ArchiveMemberHeader::getUID(), and trim().
|
inline |
Return string with consecutive characters in Chars starting from the right removed.
Definition at line 818 of file StringRef.h.
References drop_back(), find_last_not_of(), and fuzzer::min().
|
inline |
size - Get the string size.
Definition at line 135 of file StringRef.h.
Referenced by llvm::pdb::NameMapBuilder::addMapping(), llvm::FoldingSetNodeID::AddString(), llvm::TarWriter::append(), llvm::APSInt::APSInt(), llvm::CachedHashString::CachedHashString(), llvm::CachedHashStringRef::CachedHashStringRef(), llvm::StringSwitch< T, R >::Case(), charTailAt(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), llvm::FunctionComparator::cmpMem(), llvm::sys::locale::columnWidth(), llvm::sys::unicode::columnWidthUTF8(), llvm::zlib::compress(), 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(), llvm::zlib::crc32(), llvm::StringMapEntry< bool >::Create(), llvm::MachineFunction::createExternalSymbolName(), llvm::X86Operand::CreateToken(), decodeBase64StringEntry(), drop_back(), drop_front(), llvm::DWARFDebugPubTable::DWARFDebugPubTable(), edit_distance(), llvm::object::ELFFile< ELFT >::ELFFile(), llvm::BitstreamWriter::emitBlob(), llvm::AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectISA(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), llvm::emitSourceFileHeader(), llvm::CodeViewContext::encodeDefRange(), llvm::sys::path::end(), llvm::StringSwitch< T, R >::EndsWith(), llvm::Regex::escape(), expand(), llvm::sys::path::extension(), find(), find_first_not_of(), find_first_of(), find_if(), find_last_not_of(), find_last_of(), find_lower(), fitsInUstar(), formatPax(), llvm::DWARFUnit::getAddrOffsetSectionItem(), llvm::ConstantDataSequential::getAsCString(), getAsInteger(), GetAutoSenseRadix(), llvm::APInt::getBitsNeeded(), llvm::MemoryBufferRef::getBufferSize(), llvm::object::ELFFile< ELFT >::getBufSize(), llvm::ARM::getCanonicalArchName(), llvm::SparcTargetLowering::getConstraintType(), llvm::MSP430TargetLowering::getConstraintType(), llvm::AVRTargetLowering::getConstraintType(), llvm::SITargetLowering::getConstraintType(), llvm::HexagonTargetLowering::getConstraintType(), llvm::ARMTargetLowering::getConstraintType(), llvm::SystemZTargetLowering::getConstraintType(), llvm::NVPTXTargetLowering::getConstraintType(), llvm::PPCTargetLowering::getConstraintType(), llvm::X86TargetLowering::getConstraintType(), llvm::TargetLowering::getConstraintType(), llvm::object::getElfArchType(), llvm::AsmToken::getEndLoc(), llvm::DwarfStringPool::getEntry(), llvm::Triple::getEnvironmentVersion(), llvm::getFuncNameWithoutPrefix(), llvm::object::MachOObjectFile::getIndirectName(), llvm::Mips16InstrInfo::getInlineAsmLength(), llvm::HexagonInstrInfo::getInlineAsmLength(), llvm::TargetInstrInfo::getInlineAsmLength(), llvm::ARMTargetLowering::getInlineAsmMemConstraint(), llvm::SystemZTargetLowering::getInlineAsmMemConstraint(), llvm::MDString::getLength(), llvm::object::MachOObjectFile::getLibraryShortNameByIndex(), llvm::MemoryBuffer::getMemBufferCopy(), getMemsetStringVal(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::Elf_Sym_Impl< ELFT >::getName(), llvm::MemoryBuffer::getNewUninitMemBuffer(), getOptionPred(), llvm::cl::generic_parser_base::getOptionWidth(), llvm::cl::basic_parser_impl::getOptionWidth(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::Triple::getOSVersion(), llvm::SparcTargetLowering::getRegForInlineAsmConstraint(), llvm::LanaiTargetLowering::getRegForInlineAsmConstraint(), llvm::MSP430TargetLowering::getRegForInlineAsmConstraint(), llvm::AVRTargetLowering::getRegForInlineAsmConstraint(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::HexagonTargetLowering::getRegForInlineAsmConstraint(), llvm::ARMTargetLowering::getRegForInlineAsmConstraint(), llvm::SystemZTargetLowering::getRegForInlineAsmConstraint(), llvm::NVPTXTargetLowering::getRegForInlineAsmConstraint(), llvm::PPCTargetLowering::getRegForInlineAsmConstraint(), llvm::X86TargetLowering::getRegForInlineAsmConstraint(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::object::ELFFile< ELFT >::getSectionName(), llvm::object::MachOObjectFile::getSectionSize(), llvm::ConstantDataArray::getString(), llvm::AsmToken::getStringContents(), GetStringLengthH(), llvm::DWARFUnit::getStringOffsetSectionItem(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::getTypeName(), getUnicodeEncoding(), llvm::yaml::ScalarNode::getValue(), getVarName(), llvm::object::MachOObjectFile::guessLibraryShortName(), HandlePrefixedOrGroupedOption(), llvm::SHA1::hash(), llvm::HashString(), llvm::pdb::hashStringV1(), llvm::sys::fs::identify_magic(), llvm::ExecutionEngine::InitializeMemory(), llvm::yaml::ScalarTraits< char_16 >::input(), llvm::yaml::ScalarTraits< uuid_t >::input(), llvm::TrigramIndex::isDefinitelyOut(), isIntrinsicSourceOfDivergence(), isRepeatedByteSequence(), llvm::DataExtractor::isValidOffset(), llvm::detail::join_impl(), LLVMGetAsString(), LLVMTargetMachineEmitToMemoryBuffer(), loadTestingFormat(), llvm::Function::lookupIntrinsicID(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::AMDGPUIntrinsicInfo::lookupName(), llvm::TargetIntrinsicInfo::lookupName(), lower(), llvm::object::MachOUniversalBinary::MachOUniversalBinary(), llvm::MCGenDwarfLabelEntry::Make(), llvm::opt::DerivedArgList::MakeJoinedArg(), llvm::codeview::CodeViewRecordIO::mapGuid(), mapNameAndUniqueName(), llvm::Regex::match(), MatchCoprocessorOperandName(), matchOption(), maybeLexHexadecimalLiteral(), maybeLexIndex(), maybeLexIndexAndName(), maybeLexIRBlock(), maybeLexIRValue(), maybeLexMachineBasicBlock(), maybeLexSubRegisterIndex(), NaiveLogLoader(), operator new(), llvm::raw_ostream::operator<<(), llvm::DWARFDebugFrame::parse(), llvm::DWARFDebugLocDWO::parse(), parseBackslash(), parseRefinementStep(), parseRegisterNumber(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::parseType(), llvm::MCExpr::print(), llvm::ScopedPrinter::printBinary(), llvm::ScopedPrinter::printBinaryBlock(), printBSDMemberHeader(), PrintCFIEscape(), llvm::PrintEscapedString(), llvm::cl::generic_parser_base::printGenericOptionDiff(), PrintHelpOptionList(), printLine(), llvm::printLLVMNameWithoutPrefix(), printMetadataIdentifier(), llvm::cl::generic_parser_base::printOptionInfo(), llvm::cl::basic_parser_impl::printOptionName(), PrintQuotedString(), printSourceLine(), promoteToConstantPool(), llvm::sys::path::rbegin(), readCoverageMappingData(), llvm::GCOVBuffer::readInt(), llvm::readPGOFuncNameStrings(), llvm::GCOVBuffer::readString(), llvm::sampleprof::SampleProfileReaderBinary::readString(), llvm::LessRecordRegister::RecordParts::RecordParts(), llvm::sys::path::relative_path(), llvm::sys::path::remove_leading_dotslash(), llvm::sys::path::replace_extension(), llvm::sys::path::replace_path_prefix(), replaceSubString(), llvm::report_fatal_error(), RequiresVFPRegListValidation(), llvm::RuntimeDyldImpl::resolveExternalSymbols(), RewriteIntelBracExpression(), rfind(), rfind_lower(), llvm::StringSaver::save(), llvm::yaml::Output::scalarString(), llvm::orc::rpc::SerializationTraits< ChannelT, std::string, StringRef, typename std::enable_if< std::is_base_of< RawByteChannel, ChannelT >::value >::type >::serialize(), llvm::StructType::setName(), llvm::X86Operand::setTokenValue(), llvm::DIEInlineString::SizeOf(), split(), llvm::formatv_object_base::splitLiteralAndReplacement(), splitPath(), llvm::StringSwitch< T, R >::StartsWith(), llvm::sys::path::stem(), llvm::StrInStrNoCase(), llvm::Regex::sub(), take_back(), take_front(), llvm::toHex(), llvm::cl::TokenizeGNUCommandLine(), llvm::cl::TokenizeWindowsCommandLine(), llvm::zlib::uncompress(), unescapeQuotedString(), llvm::SHA1::update(), llvm::MD5::update(), UpgradeIntrinsicFunction1(), upgradeLoopTag(), upper(), useStringTable(), llvm::StringTableBuilder::write(), llvm::MCObjectWriter::writeBytes(), llvm::msf::StreamWriter::writeFixedString(), llvm::MachObjectWriter::writeSegmentLoadCommand(), writeStringRecord(), writeSymbolTable(), writeUstarHeader(), and llvm::xxHash64().
|
inline |
Return a reference to the substring from [Start, End).
| Start | The index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned. |
| End | The index following the last character to include in the substring. If this is npos or exceeds the number of characters remaining in the string, the string suffix (starting with Start) will be returned. If this is less than Start, an empty string will be returned. |
Definition at line 699 of file StringRef.h.
References fuzzer::min(), and StringRef().
Referenced by llvm::object::ObjectFile::createMachOObjectFile(), llvm::DWARFUnit::DWARFUnit(), getObjCClassCategory(), getObjCMethodName(), llvm::AsmToken::getStringContents(), llvm::getToken(), llvm::object::MachOObjectFile::guessLibraryShortName(), llvm::yaml::ScalarTraits< uuid_t >::input(), llvm::DWARFDebugFrame::parse(), parseRegisterNumber(), llvm::GCOVBuffer::readArcTag(), llvm::GCOVBuffer::readBlockTag(), llvm::GCOVBuffer::readEdgeTag(), llvm::GCOVBuffer::readFunctionTag(), llvm::GCOVBuffer::readGCDAFormat(), llvm::GCOVBuffer::readGCNOFormat(), llvm::GCOVBuffer::readGCOVVersion(), llvm::GCOVBuffer::readInt(), llvm::GCOVBuffer::readLineTag(), llvm::GCOVBuffer::readObjectTag(), llvm::GCOVBuffer::readProgramTag(), llvm::GCOVBuffer::readString(), rsplit(), llvm::SmallString< 256 >::slice(), split(), llvm::formatv_object_base::splitLiteralAndReplacement(), and llvm::Regex::sub().
|
inline |
Split into two substrings around the first occurrence of a separator character.
If Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is maximal. If Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").
| Separator | The character to split on. |
Definition at line 716 of file StringRef.h.
References find(), npos, slice(), and StringRef().
Referenced by addForcedAttributes(), findTargetSubtable(), llvm::Triple::getArchName(), llvm::codeview::getBytesAsCString(), llvm::Triple::getEnvironmentName(), llvm::AMDGPU::getIntegerPairAttribute(), getIntOperandFromRegisterString(), getIntOperandsFromRegisterString(), llvm::ModuleSummaryIndex::getOriginalNameBeforePromote(), llvm::Triple::getOSAndEnvironmentName(), llvm::Triple::getOSName(), getSearchPaths(), llvm::Triple::getVendorName(), LookupNearestOption(), llvm::Triple::normalize(), llvm::PassBuilder::parseAAPipeline(), llvm::MCSectionMachO::ParseSectionSpecifier(), printHelpStr(), printSymbolizedStackTrace(), llvm::readPGOFuncNameStrings(), llvm::GCOVBuffer::readString(), Split(), split(), llvm::Regex::sub(), llvm::Triple::Triple(), and UsesVectorABI().
|
inline |
Split into two substrings around the first occurrence of a separator string.
If Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is maximal. If Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").
| Separator | - The string to split on. |
Definition at line 734 of file StringRef.h.
References find(), npos, size(), slice(), and StringRef().
| void StringRef::split | ( | SmallVectorImpl< StringRef > & | A, |
| StringRef | Separator, | ||
| int | MaxSplit = -1, |
||
| bool | KeepEmpty = true |
||
| ) | const |
Split into substrings around the occurrences of a separator string.
Each substring is stored in A. If MaxSplit is >= 0, at most MaxSplit splits are done and consequently <= MaxSplit + 1 elements are added to A. If KeepEmpty is false, empty strings are not added to A. They still count when considering MaxSplit An useful invariant is that Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
| A | - Where to put the substrings. |
| Separator | - The string to split on. |
| MaxSplit | - The maximum number of times the string is split. |
| KeepEmpty | - True if empty substring should be added. |
Definition at line 328 of file StringRef.cpp.
References empty(), find(), npos, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), size(), and slice().
| void StringRef::split | ( | SmallVectorImpl< StringRef > & | A, |
| char | Separator, | ||
| int | MaxSplit = -1, |
||
| bool | KeepEmpty = true |
||
| ) | const |
Split into substrings around the occurrences of a separator character.
Each substring is stored in A. If MaxSplit is >= 0, at most MaxSplit splits are done and consequently <= MaxSplit + 1 elements are added to A. If KeepEmpty is false, empty strings are not added to A. They still count when considering MaxSplit An useful invariant is that Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
| A | - Where to put the substrings. |
| Separator | - The string to split on. |
| MaxSplit | - The maximum number of times the string is split. |
| KeepEmpty | - True if empty substring should be added. |
Definition at line 355 of file StringRef.cpp.
References empty(), find(), npos, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and slice().
|
inline |
Check if this string starts with the given Prefix.
Definition at line 264 of file StringRef.h.
Referenced by AddRuntimeUnrollDisableMetaData(), llvm::analyzeBuiltinArguments(), llvm::object::Archive::Archive(), llvm::ARMBuildAttrs::AttrTypeFromString(), llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), llvm::object::Archive::Child::Child(), CloneLoopBlocks(), llvm::MipsABIInfo::computeTargetABI(), computeTargetABI(), consume_front(), llvm::GlobPattern::create(), doesIgnoreDataTypeSuffix(), findTargetSubtable(), llvm::ARM::getArchExtFeature(), GetAutoSenseRadix(), llvm::ARM::getCanonicalArchName(), getELFKindForNamedSection(), getELFSectionType(), llvm::Triple::getEnvironmentVersion(), llvm::XCoreTargetObjectFile::getExplicitSectionGlobal(), llvm::getFuncNameWithoutPrefix(), getName(), llvm::object::ArchiveMemberHeader::getName(), llvm::Mangler::getNameWithPrefix(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), llvm::Triple::getOSVersion(), getRuntimeMDValueType(), llvm::object::ELFObjectFile< ELFT >::getSymbolFlags(), llvm::yaml::Node::getVerbatimTag(), GlobalWasGeneratedByCompiler(), llvm::object::MachOObjectFile::guessLibraryShortName(), INITIALIZE_PASS(), llvm::LTOModule::isBitcodeForTarget(), llvm::object::Decompressor::isGnuStyle(), llvm::MCSectionCOFF::isImplicitlyDiscardable(), isInput(), isModulePassName(), llvm::yaml::isNumber(), isObjCClass(), llvm::objcarc::IsObjCIdentifiedObject(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::AMDGPUIntrinsicInfo::lookupName(), llvm::MCGenDwarfLabelEntry::Make(), llvm::GlobPattern::match(), matchAsm(), matchOption(), llvm::mayBeOldLoopAttachmentTag(), llvm::PassInfoMixin< PromotePass >::name(), llvm::orc::GlobalRenamer::needsRenaming(), llvm::Triple::normalize(), parseArch(), llvm::ARM::parseArchEndian(), parseARMArch(), parseVersionFromName(), printSymbolizedStackTrace(), processGlobal(), llvm::TextInstrProfReader::readHeader(), llvm::TextInstrProfReader::readNextRecord(), llvm::Function::recalculateIntrinsicID(), RequiresVFPRegListValidation(), SetLoopAlreadyUnrolled(), llvm::SmallString< 256 >::startswith(), llvm::sys::fs::startswith(), llvm::StripDebugInfo(), StripSymtab(), StripTypeNames(), llvm::UpgradeIntrinsicCall(), UpgradeIntrinsicFunction1(), and upgradeLoopTag().
Check if this string starts with the given Prefix, ignoring case.
Definition at line 61 of file StringRef.cpp.
References ascii_strncasecmp().
Referenced by llvm::detail::HelperFunctions::consumeHexStyle(), find_lower(), matchOption(), and llvm::StringSwitch< T, R >::StartsWithLower().
|
inline |
str - Get the contents as an std::string.
Definition at line 225 of file StringRef.h.
Referenced by llvm::DwarfCompileUnit::addGlobalName(), llvm::DwarfCompileUnit::addGlobalType(), llvm::cacheAnnotationFromMD(), llvm::sys::path::convert_to_slash(), findInputFile(), llvm::FieldInit::getAsString(), llvm::bfi_detail::getBlockName(), getDescription(), llvm::GlobalValue::getGlobalIdentifier(), llvm::DOTGraphTraits< const Function * >::getGraphName(), llvm::AMDGPUIntrinsicInfo::getName(), llvm::getPGOFuncName(), llvm::DOTGraphTraits< const Function * >::getSimpleNodeLabel(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), llvm::Record::getValueAsBitOrUnset(), llvm::yaml::ScalarTraits< StringValue >::input(), llvm::yaml::CustomMappingTraits< GlobalValueSummaryMapTy >::inputOne(), llvm::yaml::StdMapStringCustomMappingTraitsImpl< T >::inputOne(), llvm::LineEditor::LineEditor(), llvm::LockFileManager::LockFileManager(), mangleCoveragePath(), operator std::string(), llvm::cl::parser< std::string >::parse(), llvm::DOTGraphTraitsViewer< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >::runOnFunction(), llvm::DOTGraphTraitsPrinter< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >::runOnFunction(), llvm::MCContext::setCompilationDir(), llvm::MCParsedAsmOperand::setConstraint(), smallData(), llvm::Twine::str(), suffixed_name_or(), and writeTimestampFile().
|
inline |
Return a reference to the substring from [Start, Start + N).
| Start | The index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned. |
| N | The number of characters to included in the substring. If N exceeds the number of characters remaining in the string, the string suffix (starting with Start) will be returned. |
Definition at line 587 of file StringRef.h.
References fuzzer::min(), N, and StringRef().
Referenced by llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer(), llvm::object::Archive::Child::Child(), CommaSeparateAndAddOccurrence(), llvm::consumeUnsignedInteger(), count(), decodeBase64StringEntry(), drop_back(), drop_front(), drop_until(), drop_while(), llvm::DWARFContextInMemory::DWARFContextInMemory(), EatNumber(), emitComments(), llvm::emitSourceFileHeader(), llvm::RuntimeDyldCheckerExprEval::evaluate(), expand(), llvm::sys::path::extension(), llvm::DWARFFormValue::extractValue(), find_lower(), llvm::MCJIT::findModuleForSymbol(), llvm::format_provider< T, typename std::enable_if< detail::use_string_formatter< T >::value >::type >::format(), 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(), getMemcpyLoadsAndStores(), getName(), llvm::object::ArchiveMemberHeader::getName(), getNameWithPrefixImpl(), getOpEnabled(), getOpRefinementSteps(), getOptionPred(), llvm::Triple::getOSVersion(), llvm::GlobalValue::getRealLinkageName(), llvm::SITargetLowering::getRegForInlineAsmConstraint(), llvm::object::MachOObjectFile::getSectionContents(), llvm::object::MachOObjectFile::getStringTableData(), llvm::getToken(), llvm::getTypeName(), llvm::yaml::ScalarNode::getValue(), getVarName(), llvm::yaml::Node::getVerbatimTag(), HandlePrefixedOrGroupedOption(), loadTestingFormat(), llvm::MCGenDwarfLabelEntry::Make(), matchAsm(), matchOption(), llvm::sys::path::parent_path(), llvm::DWARFDebugLoc::parse(), llvm::DWARFDebugLocDWO::parse(), llvm::yaml::Document::parseBlockNode(), ParseHead(), ParseLine(), parseRefinementStep(), parseVersionFromName(), llvm::sys::path::relative_path(), llvm::sys::path::remove_leading_dotslash(), llvm::sys::path::rend(), llvm::sys::path::replace_path_prefix(), RequiresVFPRegListValidation(), rfind(), rfind_lower(), llvm::sys::path::root_path(), scan(), llvm::formatv_object_base::splitLiteralAndReplacement(), splitPath(), llvm::sys::path::stem(), llvm::StrInStrNoCase(), StripFlag(), llvm::Regex::sub(), llvm::SmallString< 256 >::substr(), take_until(), take_while(), unescapeQuotedString(), llvm::UpgradeIntrinsicCall(), UpgradeIntrinsicFunction1(), and llvm::object::WasmObjectFile::WasmObjectFile().
|
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_front(), N, and size().
Referenced by llvm::codeview::consume().
|
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 597 of file StringRef.h.
References drop_back(), N, and size().
Referenced by emitNullTerminatedSymbolName(), and llvm::codeview::CodeViewRecordIO::mapStringZ().
|
inline |
Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicate.
Definition at line 626 of file StringRef.h.
|
inline |
Return the longest prefix of 'this' such that every character in the prefix satisfies the given predicate.
Definition at line 618 of file StringRef.h.
References F, find_if_not(), and substr().
Referenced by llvm::formatv_object_base::splitLiteralAndReplacement().
|
inline |
Return string with consecutive Char characters starting from the left and right removed.
Definition at line 825 of file StringRef.h.
References ltrim(), and rtrim().
Referenced by llvm::RuntimeDyldCheckerImpl::check(), llvm::RuntimeDyldCheckerExprEval::evaluate(), and llvm::formatv_object_base::parseReplacementItem().
|
inline |
Return string with consecutive characters in Chars starting from the left and right removed.
Definition at line 832 of file StringRef.h.
| std::string StringRef::upper | ( | ) | const |
Convert the given ASCII string to uppercase.
Definition at line 130 of file StringRef.cpp.
References ascii_toupper(), i, and size().
Referenced by llvm::AArch64SysReg::parseGenericRegister().
Definition at line 95 of file StringRef.h.
References StringRef().
|
static |
Definition at line 51 of file StringRef.h.
Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), buildFixItLine(), CommaSeparateAndAddOccurrence(), contains(), contains_lower(), llvm::sys::fs::createTemporaryFile(), 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::SourceMgr::getLineAndColumn(), llvm::InstrProfSymtab::getOrigFuncName(), llvm::object::ArchiveMemberHeader::getRawName(), getRuntimeMDForKernel(), llvm::getTypeName(), llvm::yaml::ScalarNode::getValue(), llvm::object::MachOObjectFile::guessLibraryShortName(), hasObjCCategory(), hasWildcard(), llvm::ConstantDataSequential::isCString(), llvm::Regex::isLiteralERE(), llvm::yaml::isNumber(), llvm::objcarc::IsObjCIdentifiedObject(), isSmallDataSection(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::yaml::needsQuotes(), llvm::sys::path::parent_path(), ParseLine(), parseRefinementStep(), printName(), llvm::AArch64InstPrinter::printSysAlias(), llvm::sys::path::remove_filename(), llvm::sys::path::replace_extension(), rfind(), rfind_lower(), rsplit(), sanitizeFunctionName(), scan(), split(), llvm::formatv_object_base::splitLiteralAndReplacement(), splitPath(), llvm::sys::path::stem(), llvm::StrInStrNoCase(), llvm::UpgradeIntrinsicCall(), and UpgradeIntrinsicFunction1().
1.8.6