[libcxx-commits] [PATCH] D147850: [libc++] Implements isblank.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 9 04:13:08 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Mordante marked an inline comment as done.
Closed by commit rG0bc0edb847a0: [libc++] Implements isblank. (authored by Mordante).

Changed prior to commit:
  https://reviews.llvm.org/D147850?vs=511883&id=511982#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147850/new/

https://reviews.llvm.org/D147850

Files:
  libcxx/include/__locale
  libcxx/test/std/localization/locales/locale.convenience/classification/isblank.pass.cpp


Index: libcxx/test/std/localization/locales/locale.convenience/classification/isblank.pass.cpp
===================================================================
--- /dev/null
+++ libcxx/test/std/localization/locales/locale.convenience/classification/isblank.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool isblank (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**) {
+  std::locale l;
+  assert(std::isblank(' ', l));
+  assert(!std::isblank('<', l));
+  assert(!std::isblank('\x8', l));
+  assert(!std::isblank('A', l));
+  assert(!std::isblank('a', l));
+  assert(!std::isblank('z', l));
+  assert(!std::isblank('3', l));
+  assert(!std::isblank('.', l));
+  assert(!std::isblank('f', l));
+  assert(!std::isblank('9', l));
+  assert(!std::isblank('+', l));
+
+  return 0;
+}
Index: libcxx/include/__locale
===================================================================
--- libcxx/include/__locale
+++ libcxx/include/__locale
@@ -927,6 +927,11 @@
     return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
 }
 
+template <class _CharT>
+_LIBCPP_HIDE_FROM_ABI bool isblank(_CharT __c, const locale& __loc) {
+    return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::blank, __c);
+}
+
 template <class _CharT>
 inline _LIBCPP_INLINE_VISIBILITY
 _CharT


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147850.511982.patch
Type: text/x-patch
Size: 1761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230409/f2f9fd8d/attachment.bin>


More information about the libcxx-commits mailing list