[libc] [llvm] [libc] Cleaned up wcsspn and wcscspn (PR #147408)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 20:55:06 PDT 2025


================
@@ -0,0 +1,45 @@
+//===-- wchar utils ---------------------------------------------*- 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_WCHAR_WCHAR_UTILS_H
+#define LLVM_LIBC_SRC_WCHAR_WCHAR_UTILS_H
+
+#include "hdr/types/size_t.h"
+#include "hdr/types/wchar_t.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/attributes.h" // LIBC_INLINE
+
+namespace LIBC_NAMESPACE_DECL {
+namespace internal {
+
+// returns true if the character exists in the string
+LIBC_INLINE bool internal_wcschr(wchar_t c, const wchar_t *str) {
----------------
lntue wrote:

probably also mark these 2 `static`.  We don't need to export their symbols anyway.  Also, since they are already in the `internal` namespace, just keep their names to `wcschr` and `wcsspn`?

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


More information about the llvm-commits mailing list