[libc-commits] [libc] 185136 - added iswlower entry point (PR #185221)

via libc-commits libc-commits at lists.llvm.org
Sat Mar 7 11:35:17 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (albertbolt1)

<details>
<summary>Changes</summary>

added iswlower entry point and needed test cases to verify it

<img width="372" height="69" alt="image" src="https://github.com/user-attachments/assets/b65127a9-8a97-4143-8431-4520fb5b4bc7" />

resolves issue #<!-- -->185136 

---
Full diff: https://github.com/llvm/llvm-project/pull/185221.diff


14 Files Affected:

- (modified) libc/config/baremetal/arm/entrypoints.txt (+1) 
- (modified) libc/config/baremetal/riscv/entrypoints.txt (+1) 
- (modified) libc/config/darwin/aarch64/entrypoints.txt (+1) 
- (modified) libc/config/linux/aarch64/entrypoints.txt (+1) 
- (modified) libc/config/linux/arm/entrypoints.txt (+1) 
- (modified) libc/config/linux/riscv/entrypoints.txt (+1) 
- (modified) libc/config/linux/x86_64/entrypoints.txt (+1) 
- (modified) libc/config/windows/entrypoints.txt (+1) 
- (modified) libc/include/wctype.yaml (+6) 
- (modified) libc/src/wctype/CMakeLists.txt (+10) 
- (added) libc/src/wctype/iswlower.cpp (+21) 
- (added) libc/src/wctype/iswlower.h (+21) 
- (modified) libc/test/src/wctype/CMakeLists.txt (+10) 
- (added) libc/test/src/wctype/iswlower_test.cpp (+22) 


``````````diff
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);
+}

``````````

</details>


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


More information about the libc-commits mailing list