[llvm] [llvm][Support] fix convertToSnakeFromCamelCase (PR #68375)

Markus Böck via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 13:43:53 PDT 2023


================
@@ -98,16 +98,18 @@ std::string llvm::convertToSnakeFromCamelCase(StringRef input) {
 
   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() != '_')
+  auto check = [&input](size_t j, std::function<bool(int)> check) {
----------------
zero9178 wrote:

Can either the outer variable `check` or the parameter `check` be renamed? On first glance it is confusing that they have the same name. One could e.g. be called `predicate` or so.

https://github.com/llvm/llvm-project/pull/68375


More information about the llvm-commits mailing list