27 for (
size_t i = 0, e = M -
N + 1; i !=
e; ++i)
39std::pair<StringRef, StringRef> llvm::getToken(
StringRef Source,
55 std::pair<StringRef, StringRef> S = getToken(Source, Delimiters);
56 while (!S.first.empty()) {
58 S = getToken(S.second, Delimiters);
63 for (
unsigned char C :
Name) {
69 Out <<
'\\' << hexdigit(
C >> 4) << hexdigit(
C & 0x0F);
95std::string llvm::convertToSnakeFromCamelCase(
StringRef input) {
99 std::string snakeCase;
100 snakeCase.reserve(input.
size());
102 return j < input.
size() && predicate(input[j]);
104 for (
size_t i = 0; i < input.
size(); ++i) {
105 snakeCase.push_back(tolower(input[i]));
107 if (
check(i, isupper) &&
check(i + 1, isupper) &&
check(i + 2, islower))
108 snakeCase.push_back(
'_');
110 snakeCase.push_back(
'_');
115std::string llvm::convertToCamelFromSnakeCase(
StringRef input,
116 bool capitalizeFirst) {
121 output.reserve(input.
size());
124 if (capitalizeFirst && std::islower(input.
front()))
125 output.push_back(llvm::toUpper(input.
front()));
127 output.push_back(input.
front());
130 for (
size_t pos = 1, e = input.
size(); pos < e; ++pos) {
131 if (input[pos] ==
'_' && pos != (e - 1) && std::islower(input[pos + 1]))
132 output.push_back(llvm::toUpper(input[++pos]));
134 output.push_back(input[pos]);
This file defines the SmallVector class.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
StringRef - Represent a constant reference to a string, i.e.
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.
constexpr size_t size() const
size - Get the string size.
char front() const
front - Get the first character in the string.
static constexpr size_t npos
bool equals_insensitive(StringRef RHS) const
Check for string equality, ignoring case.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.