[libc] [llvm] [libc] Migrate ctype_utils to use char instead of int where applicable. (PR #166225)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 3 12:05:29 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- libc/src/__support/ctype_utils.h libc/src/__support/integer_to_string.h libc/src/ctype/isalnum.cpp libc/src/ctype/isalnum_l.cpp libc/src/ctype/isalpha.cpp libc/src/ctype/isalpha_l.cpp libc/src/ctype/isdigit.cpp libc/src/ctype/isdigit_l.cpp libc/src/ctype/isgraph.cpp libc/src/ctype/isgraph_l.cpp libc/src/ctype/islower.cpp libc/src/ctype/islower_l.cpp libc/src/ctype/ispunct.cpp libc/src/ctype/ispunct_l.cpp libc/src/ctype/isspace.cpp libc/src/ctype/isspace_l.cpp libc/src/ctype/isupper.cpp libc/src/ctype/isupper_l.cpp libc/src/ctype/isxdigit.cpp libc/src/ctype/isxdigit_l.cpp libc/src/ctype/tolower.cpp libc/src/ctype/tolower_l.cpp libc/src/ctype/toupper.cpp libc/src/ctype/toupper_l.cpp libc/src/stdio/printf_core/float_dec_converter_limited.h libc/src/stdio/printf_core/float_hex_converter.h libc/src/stdlib/l64a.cpp libc/src/string/strcasestr.cpp libc/src/strings/strcasecmp.cpp libc/src/strings/strcasecmp_l.cpp libc/src/strings/strncasecmp.cpp libc/src/strings/strncasecmp_l.cpp libc/test/UnitTest/MemoryMatcher.cpp libc/test/src/ctype/islower_test.cpp libc/test/src/stdlib/StrtolTest.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/ctype/isalpha.cpp b/libc/src/ctype/isalpha.cpp
index 8b6ecf192..7c874bf37 100644
--- a/libc/src/ctype/isalpha.cpp
+++ b/libc/src/ctype/isalpha.cpp
@@ -17,7 +17,7 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, isalpha, (int c)) {
if (c < 0 || c > cpp::numeric_limits<unsigned char>::max())
- return 0;
+ return 0;
return static_cast<int>(internal::isalpha(static_cast<char>(c)));
}
diff --git a/libc/src/ctype/isgraph.cpp b/libc/src/ctype/isgraph.cpp
index 86ac0cb0d..b9308ecb7 100644
--- a/libc/src/ctype/isgraph.cpp
+++ b/libc/src/ctype/isgraph.cpp
@@ -17,7 +17,7 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, isgraph, (int c)) {
if (c < 0 || c > cpp::numeric_limits<unsigned char>::max())
- return 0;
+ return 0;
return static_cast<int>(internal::isgraph(static_cast<char>(c)));
}
diff --git a/libc/src/ctype/isspace.cpp b/libc/src/ctype/isspace.cpp
index 908cc1196..998dbf28f 100644
--- a/libc/src/ctype/isspace.cpp
+++ b/libc/src/ctype/isspace.cpp
@@ -17,7 +17,7 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, isspace, (int c)) {
if (c < 0 || c > cpp::numeric_limits<unsigned char>::max())
- return 0;
+ return 0;
return static_cast<int>(internal::isspace(static_cast<char>(c)));
}
diff --git a/libc/src/ctype/isspace_l.cpp b/libc/src/ctype/isspace_l.cpp
index dd287c633..e40765326 100644
--- a/libc/src/ctype/isspace_l.cpp
+++ b/libc/src/ctype/isspace_l.cpp
@@ -17,7 +17,7 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, isspace_l, (int c, locale_t)) {
if (c < 0 || c > cpp::numeric_limits<unsigned char>::max())
- return 0;
+ return 0;
return static_cast<int>(internal::isspace(static_cast<char>(c)));
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/166225
More information about the llvm-commits
mailing list