29 unsigned char LHC = toLower(LC);
30 unsigned char RHC = toLower(RC);
32 return LHC < RHC ? -1 : 1;
38 size_t Min = std::min(
size(),
RHS.size());
43 return size() <
RHS.size() ? -1 : 1;
47 return size() >= Prefix.size() &&
58 return find_if([L](
char D) {
return toLower(
D) == L; },
From);
63 for (
size_t I = 0, E = std::min(
size(),
RHS.size());
I != E; ++
I) {
69 for (J =
I + 1; J != E + 1; ++J) {
78 if (
int Res = compareMemory(
data() +
I,
RHS.data() +
I, J -
I))
79 return Res < 0 ? -1 : 1;
85 return (
unsigned char)
data()[
I] < (
unsigned char)
RHS.data()[
I] ? -1 : 1;
89 return size() <
RHS.size() ? -1 : 1;
94 bool AllowReplacements,
95 unsigned MaxEditDistance)
const {
98 AllowReplacements, MaxEditDistance);
102 StringRef Other,
bool AllowReplacements,
unsigned MaxEditDistance)
const {
105 llvm::toLower, AllowReplacements, MaxEditDistance);
138 const char *Needle = Str.data();
139 size_t N = Str.size();
145 const char *
Ptr = (
const char *)::memchr(Start, Needle[0],
Size);
149 const char *Stop = Start + (
Size -
N + 1);
156 if (std::memcmp(Start, Needle, 2) == 0)
157 return Start -
data();
159 }
while (Start < Stop);
164 if (Size < 16 || N > 255) {
166 if (std::memcmp(Start, Needle,
N) == 0)
167 return Start -
data();
169 }
while (Start < Stop);
175 std::memset(BadCharSkip,
N, 256);
176 for (
unsigned i = 0; i !=
N-1; ++i)
177 BadCharSkip[(
uint8_t)Str[i]] =
N-1-i;
182 if (std::memcmp(Start, Needle,
N - 1) == 0)
183 return Start -
data();
186 Start += BadCharSkip[
Last];
187 }
while (Start < Stop);
194 while (This.size() >= Str.size()) {
195 if (This.starts_with_insensitive(Str))
197 This = This.drop_front();
208 if (toLower(
data()[i]) == toLower(
C))
219 return std::string_view(*this).rfind(Str);
223 size_t N = Str.size();
226 for (
size_t i =
size() -
N + 1, e = 0; i != e;) {
240 std::bitset<1 << CHAR_BIT> CharBits;
242 CharBits.set((
unsigned char)
C);
245 if (CharBits.test((
unsigned char)
data()[i]))
253 return std::string_view(*this).find_first_not_of(
C,
From);
262 std::bitset<1 << CHAR_BIT> CharBits;
264 CharBits.set((
unsigned char)
C);
267 if (!CharBits.test((
unsigned char)
data()[i]))
278 std::bitset<1 << CHAR_BIT> CharBits;
280 CharBits.set((
unsigned char)
C);
283 if (CharBits.test((
unsigned char)
data()[i]))
303 std::bitset<1 << CHAR_BIT> CharBits;
305 CharBits.set((
unsigned char)
C);
308 if (!CharBits.test((
unsigned char)
data()[i]))
315 bool KeepEmpty)
const {
322 while (MaxSplit-- != 0) {
323 size_t Idx = S.
find(Separator);
328 if (KeepEmpty ||
Idx > 0)
336 if (KeepEmpty || !S.
empty())
341 int MaxSplit,
bool KeepEmpty)
const {
348 while (MaxSplit-- != 0) {
349 size_t Idx = S.
find(Separator);
354 if (KeepEmpty ||
Idx > 0)
362 if (KeepEmpty || !S.
empty())
375 size_t N = Str.size();
381 while ((Pos =
find(Str, Pos)) !=
npos) {
392 if (Str.consume_front_insensitive(
"0x"))
395 if (Str.consume_front_insensitive(
"0b"))
398 if (Str.consume_front(
"0o"))
401 if (Str[0] ==
'0' && Str.size() > 1 &&
isDigit(Str[1])) {
410 unsigned long long &Result) {
416 if (Str.empty())
return true;
421 while (!Str2.
empty()) {
423 if (Str2[0] >=
'0' && Str2[0] <=
'9')
424 CharVal = Str2[0] -
'0';
425 else if (Str2[0] >=
'a' && Str2[0] <=
'z')
426 CharVal = Str2[0] -
'a' + 10;
427 else if (Str2[0] >=
'A' && Str2[0] <=
'Z')
428 CharVal = Str2[0] -
'A' + 10;
434 if (CharVal >= Radix)
438 unsigned long long PrevResult = Result;
439 Result = Result * Radix + CharVal;
442 if (Result / Radix < PrevResult)
450 if (Str.size() == Str2.
size())
459 unsigned long long ULLVal;
462 if (!Str.starts_with(
"-")) {
465 (
long long)ULLVal < 0)
477 (
long long)-ULLVal > 0)
488 unsigned long long &Result) {
514 assert(Radix > 1 && Radix <= 36);
517 if (Str.empty())
return true;
521 Str = Str.ltrim(
'0');
525 Result =
APInt(64, 0);
531 unsigned Log2Radix = 0;
532 while ((1U << Log2Radix) < Radix) Log2Radix++;
533 bool IsPowerOf2Radix = ((1U << Log2Radix) == Radix);
535 unsigned BitWidth = Log2Radix * Str.size();
536 if (
BitWidth < Result.getBitWidth())
538 else if (
BitWidth > Result.getBitWidth())
541 APInt RadixAP, CharAP;
542 if (!IsPowerOf2Radix) {
550 while (!Str.empty()) {
552 if (Str[0] >=
'0' && Str[0] <=
'9')
553 CharVal = Str[0]-
'0';
554 else if (Str[0] >=
'a' && Str[0] <=
'z')
555 CharVal = Str[0]-
'a'+10;
556 else if (Str[0] >=
'A' && Str[0] <=
'Z')
557 CharVal = Str[0]-
'A'+10;
563 if (CharVal >= Radix)
567 if (IsPowerOf2Radix) {
568 Result <<= Log2Radix;
581 if (
size() == Str.size())
590 if (Str.consumeInteger(Radix, Result))
610 Result =
F.convertToDouble();
619 "Cannot hash the empty key!");
621 "Cannot hash the tombstone key!");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements a class to represent arbitrary precision integral constant values and operations...
BlockVerifier::State From
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_UNLIKELY(EXPR)
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
static bool isDigit(const char C)
static int ascii_strncasecmp(StringRef LHS, StringRef RHS)
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
LLVM_ABI size_t find_last_not_of(char C, size_t From=npos) const
Find the last character in the string that is not C, or npos if not found.
bool consumeInteger(unsigned Radix, T &Result)
Parse the current string as an integer of the specified radix.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
LLVM_ABI bool getAsDouble(double &Result, bool AllowInexact=true) const
Parse the current string as an IEEE double-precision floating point value.
size_t find_if(function_ref< bool(char)> F, size_t From=0) const
Search for the first character satisfying the predicate F.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr bool empty() const
empty - Check if the string is empty.
LLVM_ABI bool starts_with_insensitive(StringRef Prefix) const
Check if this string starts with the given Prefix, ignoring case.
LLVM_ABI std::string upper() const
Convert the given ASCII string to uppercase.
LLVM_ABI unsigned edit_distance(StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const
Determine the edit distance between this string and another string.
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
constexpr size_t size() const
size - Get the string size.
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.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
LLVM_ABI int compare_numeric(StringRef RHS) const
compare_numeric - Compare two strings, treating sequences of digits as numbers.
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.
size_t rfind(char C, size_t From=npos) const
Search for the last character C in the string.
StringRef take_back(size_t N=1) const
Return a StringRef equal to 'this' but with only the last N elements remaining.
StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
LLVM_ABI size_t rfind_insensitive(char C, size_t From=npos) const
Search for the last character C in the string, ignoring case.
LLVM_ABI std::string lower() const
LLVM_ABI size_t find_insensitive(char C, size_t From=0) const
Search for the first character C in the string, ignoring case.
size_t count(char C) const
Return the number of occurrences of C in the string.
static constexpr size_t npos
bool equals_insensitive(StringRef RHS) const
Check for string equality, ignoring case.
LLVM_ABI bool ends_with_insensitive(StringRef Suffix) const
Check if this string ends with the given Suffix, ignoring case.
LLVM_ABI size_t find_first_not_of(char C, size_t From=0) const
Find the first character in the string that is not C or npos if not found.
LLVM_ABI int compare_insensitive(StringRef RHS) const
Compare two strings, ignoring case.
LLVM_ABI unsigned edit_distance_insensitive(StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const
An opaque object representing a hash code.
This file defines a Levenshtein distance function that works for any two sequences,...
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
bool errorToBool(Error Err)
Helper for converting an Error to a bool.
LLVM_ABI bool getAsSignedInteger(StringRef Str, unsigned Radix, long long &Result)
hash_code hash_value(const FixedPointSemantics &Val)
LLVM_ABI unsigned getAutoSenseRadix(StringRef &Str)
detail::zippy< detail::zip_first, T, U, Args... > zip_equal(T &&t, U &&u, Args &&...args)
zip iterator that assumes that all iteratees have the same length.
mapped_iterator< ItTy, FuncTy > map_iterator(ItTy I, FuncTy F)
LLVM_ABI bool consumeUnsignedInteger(StringRef &Str, unsigned Radix, unsigned long long &Result)
unsigned ComputeEditDistance(ArrayRef< T > FromArray, ArrayRef< T > ToArray, bool AllowReplacements=true, unsigned MaxEditDistance=0)
LLVM_ABI bool consumeSignedInteger(StringRef &Str, unsigned Radix, long long &Result)
constexpr unsigned BitWidth
LLVM_ABI bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
unsigned ComputeMappedEditDistance(ArrayRef< T > FromArray, ArrayRef< T > ToArray, Functor Map, bool AllowReplacements=true, unsigned MaxEditDistance=0)
Determine the edit distance between two sequences.
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
static constexpr roundingMode rmNearestTiesToEven
opStatus
IEEE-754R 7: Default exception handling.
An information struct used to provide DenseMap with the various necessary components for a given valu...