[libc-commits] [libc] 185136 - added iswlower entry point (PR #185221)
via libc-commits
libc-commits at lists.llvm.org
Sat Mar 7 11:35:46 PST 2026
https://github.com/albertbolt1 updated https://github.com/llvm/llvm-project/pull/185221
>From 931fac58656956d3d2865a28c1275d537f0a845b Mon Sep 17 00:00:00 2001
From: albertbolt <albertboltinfinity at gmail.com>
Date: Sun, 8 Mar 2026 01:01:20 +0530
Subject: [PATCH 1/2] added iswlower entry point
---
libc/config/baremetal/arm/entrypoints.txt | 1 +
libc/config/baremetal/riscv/entrypoints.txt | 1 +
libc/config/darwin/aarch64/entrypoints.txt | 1 +
libc/config/linux/aarch64/entrypoints.txt | 1 +
libc/config/linux/arm/entrypoints.txt | 1 +
libc/config/linux/riscv/entrypoints.txt | 1 +
libc/config/linux/x86_64/entrypoints.txt | 1 +
libc/config/windows/entrypoints.txt | 1 +
libc/include/wctype.yaml | 6 ++++++
libc/src/wctype/CMakeLists.txt | 10 ++++++++++
libc/src/wctype/iswlower.cpp | 21 ++++++++++++++++++++
libc/src/wctype/iswlower.h | 21 ++++++++++++++++++++
libc/test/src/wctype/CMakeLists.txt | 10 ++++++++++
libc/test/src/wctype/iswlower_test.cpp | 22 +++++++++++++++++++++
14 files changed, 98 insertions(+)
create mode 100644 libc/src/wctype/iswlower.cpp
create mode 100644 libc/src/wctype/iswlower.h
create mode 100644 libc/test/src/wctype/iswlower_test.cpp
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 7bc92e84b7fa4..f492c6e230552 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -299,6 +299,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswlower
# internal entrypoints
libc.startup.baremetal.init
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 29be47dfbfd53..cc6d4556a10fd 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -296,6 +296,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswlower
# internal entrypoints
libc.startup.baremetal.init
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index b4a1ee70764cb..755edfc2714a6 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -102,6 +102,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswlower
)
if(LLVM_LIBC_FULL_BUILD)
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 960958b7cf90a..af141ed8aad41 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -369,6 +369,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswlower
# sys/uio.h entrypoints
libc.src.sys.uio.writev
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index e76bf81670ce5..a8df8fab8d3e9 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -194,6 +194,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswlower
)
if(LLVM_LIBC_FULL_BUILD)
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index a69d1a1b0a642..321c290a7908b 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -373,6 +373,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswlower
# sys/uio.h entrypoints
libc.src.sys.uio.writev
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 4103ee0331a23..46b348874b9ff 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -418,6 +418,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswlower
# sys/uio.h entrypoints
libc.src.sys.uio.writev
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index f777fc6c94bc2..635ab3e7bb217 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -108,6 +108,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswlower
)
set(TARGET_LIBM_ENTRYPOINTS
diff --git a/libc/include/wctype.yaml b/libc/include/wctype.yaml
index fb4f96f7d17e4..0c68d369e2bc3 100644
--- a/libc/include/wctype.yaml
+++ b/libc/include/wctype.yaml
@@ -8,3 +8,9 @@ functions:
return_type: int
arguments:
- type: wint_t
+ - name: iswlower
+ standards:
+ - stdc
+ return_type: int
+ arguments:
+ - type: wint_t
diff --git a/libc/src/wctype/CMakeLists.txt b/libc/src/wctype/CMakeLists.txt
index 3ac5eaef8ed8b..88587d7200a9a 100644
--- a/libc/src/wctype/CMakeLists.txt
+++ b/libc/src/wctype/CMakeLists.txt
@@ -7,3 +7,13 @@ add_entrypoint_object(
DEPENDS
libc.src.__support.wctype_utils
)
+
+add_entrypoint_object(
+ iswlower
+ SRCS
+ iswlower.cpp
+ HDRS
+ iswlower.h
+ DEPENDS
+ libc.src.__support.wctype_utils
+)
diff --git a/libc/src/wctype/iswlower.cpp b/libc/src/wctype/iswlower.cpp
new file mode 100644
index 0000000000000..0ded94075a0bd
--- /dev/null
+++ b/libc/src/wctype/iswlower.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of iswlower ----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/wctype/iswlower.h"
+#include "src/__support/common.h"
+#include "src/__support/wctype_utils.h"
+
+#include "hdr/types/wint_t.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, iswlower, (wint_t c)) {
+ return internal::islower(static_cast<wchar_t>(c));
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/wctype/iswlower.h b/libc/src/wctype/iswlower.h
new file mode 100644
index 0000000000000..5acbe641ebfbc
--- /dev/null
+++ b/libc/src/wctype/iswlower.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for iswalpha ----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_WCTYPE_ISLOWER_H
+#define LLVM_LIBC_SRC_WCTYPE_ISLOWER_H
+
+#include "hdr/types/wint_t.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+int iswlower(wint_t c);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_WCTYPE_ISLOWER_H
diff --git a/libc/test/src/wctype/CMakeLists.txt b/libc/test/src/wctype/CMakeLists.txt
index 5459cdb4a9b71..da9218f45ea93 100644
--- a/libc/test/src/wctype/CMakeLists.txt
+++ b/libc/test/src/wctype/CMakeLists.txt
@@ -9,3 +9,13 @@ add_libc_test(
DEPENDS
libc.src.wctype.iswalpha
)
+
+add_libc_test(
+ iswlower_test
+ SUITE
+ libc_wctype_unittests
+ SRCS
+ iswlower_test.cpp
+ DEPENDS
+ libc.src.wctype.iswlower
+)
diff --git a/libc/test/src/wctype/iswlower_test.cpp b/libc/test/src/wctype/iswlower_test.cpp
new file mode 100644
index 0000000000000..65a2a72981c35
--- /dev/null
+++ b/libc/test/src/wctype/iswlower_test.cpp
@@ -0,0 +1,22 @@
+//===-- Unittests for iswlower --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/__support/CPP/span.h"
+#include "src/wctype/iswlower.h"
+
+#include "test/UnitTest/Test.h"
+
+TEST(LlvmLibciswlower, SimpleTest) {
+ EXPECT_NE(LIBC_NAMESPACE::iswlower('a'), 0);
+ EXPECT_NE(LIBC_NAMESPACE::iswlower('b'), 0);
+ EXPECT_NE(LIBC_NAMESPACE::iswlower('z'), 0);
+
+ EXPECT_EQ(LIBC_NAMESPACE::iswlower('A'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswlower('B'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswlower('Z'), 0);
+}
>From 434cfbb3c03ea14f7b28603f987401c0d081e40e Mon Sep 17 00:00:00 2001
From: albertbolt <albertboltinfinity at gmail.com>
Date: Sun, 8 Mar 2026 01:05:25 +0530
Subject: [PATCH 2/2] correction in header text
---
libc/src/wctype/iswlower.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/src/wctype/iswlower.h b/libc/src/wctype/iswlower.h
index 5acbe641ebfbc..a9fef0d725f48 100644
--- a/libc/src/wctype/iswlower.h
+++ b/libc/src/wctype/iswlower.h
@@ -1,4 +1,4 @@
-//===-- Implementation header for iswalpha ----------------------*- C++ -*-===//
+//===-- Implementation header for iswlower ----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
More information about the libc-commits
mailing list