14#ifndef LLVM_ADT_SMALLSTRING_H
15#define LLVM_ADT_SMALLSTRING_H
26template <
unsigned InternalLen>
43 template<
typename ItTy>
58 void assign(std::initializer_list<StringRef> Refs) {
75 void append(std::initializer_list<StringRef> Refs) {
76 size_t CurrentSize = this->
size();
77 size_t SizeNeeded = CurrentSize;
79 SizeNeeded +=
Ref.size();
82 std::copy(
Ref.begin(),
Ref.end(), this->begin() + CurrentSize);
83 CurrentSize +=
Ref.size();
98 return str().equals_insensitive(
RHS);
108 return str().compare_insensitive(
RHS);
114 return str().compare_numeric(
RHS);
123 return str().starts_with(Prefix);
131 return str().ends_with(Suffix);
153 [[nodiscard]]
size_t find(
char C,
size_t From = 0)
const {
154 return str().find(
C, From);
162 return str().find(Str, From);
170 return str().rfind(
C, From);
182 return str().find_first_of(
C, From);
190 return str().find_first_of(Chars, From);
196 return str().find_first_not_of(
C, From);
204 size_t From = 0)
const {
205 return str().find_first_not_of(Chars, From);
212 return str().find_last_of(
C, From);
221 return str().find_last_of(Chars, From);
229 [[nodiscard]]
size_t count(
char C)
const {
return str().count(
C); }
250 return str().substr(Start,
N);
264 return str().slice(Start,
End);
284 explicit operator std::string()
const {
285 return std::string(this->
data(), this->
size());
Ops append({Chain, DAG.getConstant(SVEStores[NumParts - 2], DL, MVT::i32)})
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ATTRIBUTE_WARN_UNUSED
This file defines the SmallVector class.
size_t rfind(StringRef Str) const
Search for the last string Str in the string.
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.
bool ends_with(char C) const
ends_with - Check if this string ends with the given character C.
SmallString(StringRef S)
Initialize from a StringRef.
size_t find_last_of(StringRef Chars, size_t From=StringRef::npos) const
Find the last character in the string that is in C, or npos if not found.
size_t find_last_of(char C, size_t From=StringRef::npos) const
Find the last character in the string that is C, or npos if not found.
SmallString & operator=(StringRef RHS)
bool contains(StringRef Other) const
contains - Check if Other is a substring of this string.
bool contains(char C) const
contains - Check if this string contains the character C.
void assign(std::initializer_list< StringRef > Refs)
Assign from a list of StringRefs.
SmallString()=default
Default ctor - Initialize to empty.
size_t find(char C, size_t From=0) const
find - Search for the first character C in the string.
bool ends_with(StringRef Suffix) const
ends_with - Check if this string ends with the given Suffix.
size_t find(StringRef Str, size_t From=0) const
Search for the first string Str in the string.
bool equals(StringRef RHS) const
Check for string equality.
size_t count(StringRef Str) const
Return the number of non-overlapped occurrences of Str in the string.
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
size_t rfind(char C, size_t From=StringRef::npos) const
Search for the last character C in the string.
void append(std::initializer_list< StringRef > Refs)
Append from a list of StringRefs.
SmallString & operator+=(char C)
void assign(StringRef RHS)
Assign from a StringRef.
SmallString & operator+=(StringRef RHS)
bool equals_insensitive(StringRef RHS) const
Check for string equality, ignoring case.
int compare_numeric(StringRef RHS) const
compare_numeric - Compare two strings, treating sequences of digits as numbers.
int compare(StringRef RHS) const
compare - Compare two strings; the result is negative, zero, or positive if this string is lexicograp...
bool starts_with(StringRef Prefix) const
starts_with - Check if this string starts with the given Prefix.
StringRef substr(size_t Start, size_t N=StringRef::npos) const
Return a reference to the substring from [Start, Start + N).
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.
void append(StringRef RHS)
Append from a StringRef.
SmallString(ItTy S, ItTy E)
Initialize with a range.
int compare_insensitive(StringRef RHS) const
compare_insensitive - Compare two strings, ignoring case.
size_t count(char C) const
Return the number of occurrences of C in the string.
bool starts_with(char C) const
starts_with - Check if this string starts with the given character C.
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.
SmallString(std::initializer_list< StringRef > Refs)
Initialize by concatenating a list of StringRefs.
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.
void resize_for_overwrite(size_type N)
void assign(size_type NumElts, ValueParamT Elt)
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const char &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
static constexpr size_t npos
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
static void assign(DXContainerYAML::SourceInfo::SectionHeader &Dst, const dxbc::SourceInfo::SectionHeader &Src)
@ Ref
The access may reference the value stored in memory.
@ End
Run the machine verifier once, at the end of the pipeline.