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

via libc-commits libc-commits at lists.llvm.org
Tue Mar 10 07:20:28 PDT 2026


Author: albertbolt1
Date: 2026-03-10T07:20:23-07:00
New Revision: c79034abb6db33fdcbf70679c61f0883ca5f6de9

URL: https://github.com/llvm/llvm-project/commit/c79034abb6db33fdcbf70679c61f0883ca5f6de9
DIFF: https://github.com/llvm/llvm-project/commit/c79034abb6db33fdcbf70679c61f0883ca5f6de9.diff

LOG: [libc] 185136 - added iswlower entry point (#185221)

Changes include:
- Added iswlower entrypoint in wctype.yaml to expose the function
- Created iswlower.h header and iswlower.cpp implementation
- Added CMake entrypoint object for iswlower
- Created unit test in iswlower_test.cpp
- Added test entry to wctype CMakeLists.txt

this PR helps in exposing iswlower which internally calls islower on
wide character

built using :  ninja -C build libc 
tested using : ninja libc_wctype_unittests and all the 3 tests passed 

resolves issue #185136

Added: 
    libc/src/wctype/iswlower.cpp
    libc/src/wctype/iswlower.h
    libc/test/src/wctype/iswlower_test.cpp

Modified: 
    libc/config/baremetal/arm/entrypoints.txt
    libc/config/baremetal/riscv/entrypoints.txt
    libc/config/darwin/aarch64/entrypoints.txt
    libc/config/linux/aarch64/entrypoints.txt
    libc/config/linux/arm/entrypoints.txt
    libc/config/linux/riscv/entrypoints.txt
    libc/config/linux/x86_64/entrypoints.txt
    libc/config/windows/entrypoints.txt
    libc/include/wctype.yaml
    libc/src/wctype/CMakeLists.txt
    libc/test/src/wctype/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 955dc643586e9..5fead3c443507 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -300,6 +300,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     # wctype.h entrypoints
     libc.src.wctype.iswalpha
     libc.src.wctype.iswdigit
+    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 472792e48fa01..3ce4724ea25f9 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -297,6 +297,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     # wctype.h entrypoints
     libc.src.wctype.iswalpha
     libc.src.wctype.iswdigit
+    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 051ab45f450fa..aeaa60b085171 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -103,6 +103,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     # wctype.h entrypoints
     libc.src.wctype.iswalpha
     libc.src.wctype.iswdigit
+    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 bdca0baf478c7..e641f39223d62 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -370,6 +370,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     # wctype.h entrypoints
     libc.src.wctype.iswalpha
     libc.src.wctype.iswdigit
+    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 3d3e77d826b06..915b421d3366b 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -195,6 +195,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     # wctype.h entrypoints
     libc.src.wctype.iswalpha
     libc.src.wctype.iswdigit
+    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 13343dea76fe3..de82f1ee72cfa 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -374,6 +374,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     # wctype.h entrypoints
     libc.src.wctype.iswalpha
     libc.src.wctype.iswdigit
+    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 24df7e63e3ebf..7cd7b50eb48a8 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -419,6 +419,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     # wctype.h entrypoints
     libc.src.wctype.iswalpha
     libc.src.wctype.iswdigit
+    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 dc6282fac883f..dc185404f98e9 100644
--- a/libc/src/wctype/CMakeLists.txt
+++ b/libc/src/wctype/CMakeLists.txt
@@ -17,3 +17,14 @@ 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
+    libc.hdr.types.wint_t
+)

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..a9fef0d725f48
--- /dev/null
+++ b/libc/src/wctype/iswlower.h
@@ -0,0 +1,21 @@
+//===-- 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.
+// 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 5d46b1a61bbef..cd9247e6b53cf 100644
--- a/libc/test/src/wctype/CMakeLists.txt
+++ b/libc/test/src/wctype/CMakeLists.txt
@@ -21,3 +21,13 @@ add_libc_test(
     libc.src.wctype.iswdigit
     libc.src.__support.wctype_utils
 )
+
+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..c0dc6079bfd8f
--- /dev/null
+++ b/libc/test/src/wctype/iswlower_test.cpp
@@ -0,0 +1,20 @@
+//===-- 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/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);
+}


        


More information about the libc-commits mailing list