34 return {Source.slice(Start, End), Source.substr(End)};
42 std::pair<StringRef, StringRef> S =
getToken(Source, Delimiters);
43 while (!S.first.empty()) {
50 for (
unsigned char C : Name) {
86 std::string snakeCase;
87 snakeCase.reserve(input.
size());
89 return j < input.
size() && predicate(input[j]);
91 for (
size_t i = 0; i < input.
size(); ++i) {
92 snakeCase.push_back(tolower(input[i]));
94 if (check(i, isupper) && check(i + 1, isupper) && check(i + 2, islower))
95 snakeCase.push_back(
'_');
96 if ((check(i, islower) || check(i, isdigit)) && check(i + 1, isupper))
97 snakeCase.push_back(
'_');
103 bool capitalizeFirst) {
108 output.reserve(input.
size());
111 if (capitalizeFirst && std::islower(input.
front()))
114 output.push_back(input.
front());
117 for (
size_t pos = 1, e = input.
size(); pos < e; ++pos) {
118 if (input[pos] ==
'_' && pos != (e - 1) && std::islower(input[pos + 1]))
121 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 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.
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.
char toLower(char x)
Returns the corresponding lowercase character if x is uppercase.
LLVM_ABI void printHTMLEscaped(StringRef String, raw_ostream &Out)
Print each character of the specified string, escaping HTML special characters.
LLVM_ABI void printLowerCase(StringRef String, raw_ostream &Out)
printLowerCase - Print each character as lowercase if it is uppercase.
LLVM_ABI std::pair< StringRef, StringRef > getToken(StringRef Source, StringRef Delimiters=" \t\n\v\f\r")
getToken - This function extracts one token from source, ignoring any leading characters that appear ...
LLVM_ABI void printEscapedString(StringRef Name, raw_ostream &Out)
Print each character of the specified string, escaping it if it is not printable or if it is an escap...
LLVM_ABI void SplitString(StringRef Source, SmallVectorImpl< StringRef > &OutFragments, StringRef Delimiters=" \t\n\v\f\r")
SplitString - Split up the specified string according to the specified delimiters,...
LLVM_ABI std::string convertToSnakeFromCamelCase(StringRef input)
Converts a string from camel-case to snake-case by replacing all uppercase letters with '_' followed ...
char hexdigit(unsigned X, bool LowerCase=false)
hexdigit - Return the hexadecimal character for the given number X (which should be less than 16).
char toUpper(char x)
Returns the corresponding uppercase character if x is lowercase.
LLVM_ABI std::string convertToCamelFromSnakeCase(StringRef input, bool capitalizeFirst=false)
Converts a string from snake-case to camel-case by replacing all occurrences of '_' followed by a low...
bool isPrint(char C)
Checks whether character C is printable.