[all-commits] [llvm/llvm-project] 45415e: [libcxx] Fix the ctype `is` (pointer version) func...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Fri Mar 4 14:50:10 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45415ef91be5311939dfb0bf11a87b1722f68d02
      https://github.com/llvm/llvm-project/commit/45415ef91be5311939dfb0bf11a87b1722f68d02
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-03-05 (Sat, 05 Mar 2022)

  Changed paths:
    M libcxx/include/__locale
    M libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp
    M libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_many.pass.cpp
    M libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp
    M libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_not.pass.cpp

  Log Message:
  -----------
  [libcxx] Fix the ctype `is` (pointer version) function for Windows

Previously, this test snippet would report incorrect information:

    F::mask m;
    std::wstring in(L"\u00DA"); // LATIN CAPITAL LETTER U WITH ACUTE
    f.is(in.data(), in.data() + 1, &m);
    // m & F::lower would be set

The single-character version of the `is` function wasn't
affected by this issue though.

Define `_LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA` for Windows,
as the `alpha` / `_ALPHA` constant is a mask consisting of
multiple bits set, which avoids setting `alpha` whenver any
of the bits is set, in the `do_is` implementation.

On Windows, with the "C" locale, wchars are classified according
to their Unicode interpretation, just as in the en_US.UTF-8 locale on
all platforms.

Due to the differing classification of some characters, the
`scan_is` and `scan_not` tests are quite annoying to fix, thus just
ifdef out some of the tests for the "C" locale there - the code gets
tested with the more standard en_US.UTF-8 locale anyway.

Differential Revision: https://reviews.llvm.org/D120796




More information about the All-commits mailing list