[llvm] [llvm][Support] fix convertToSnakeFromCamelCase (PR #68375)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 6 09:46:26 PDT 2023
================
@@ -96,18 +97,13 @@ std::string llvm::convertToSnakeFromCamelCase(StringRef input) {
if (input.empty())
return "";
- std::string snakeCase;
- snakeCase.reserve(input.size());
- for (char c : input) {
- if (!std::isupper(c)) {
- snakeCase.push_back(c);
- continue;
- }
-
- if (!snakeCase.empty() && snakeCase.back() != '_')
- snakeCase.push_back('_');
- snakeCase.push_back(llvm::toLower(c));
+ std::string snakeCase = input.str();
+ for (int i = 0; i < 10; ++i) {
----------------
rkayaith wrote:
How about looping until the `sub` result's length stops changing?
https://github.com/llvm/llvm-project/pull/68375
More information about the llvm-commits
mailing list