[all-commits] [llvm/llvm-project] 643b7b: [libc++] Fix simple cases of locale name construction

Jake Egan via All-commits all-commits at lists.llvm.org
Sat Jul 8 19:03:45 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 643b7bcdb40433958e7c7022278748b77fe038c4
      https://github.com/llvm/llvm-project/commit/643b7bcdb40433958e7c7022278748b77fe038c4
  Author: Jake Egan <5326451+jakeegan at users.noreply.github.com>
  Date:   2023-07-08 (Sat, 08 Jul 2023)

  Changed paths:
    M libcxx/src/locale.cpp
    A libcxx/test/std/localization/locales/locale/locale.cons/name_construction.pass.cpp

  Log Message:
  -----------
  [libc++] Fix simple cases of locale name construction

When using the following constructors:

```
locale(const locale& other, const char* std_name, category cat);
locale(const locale& other, const string& std_name, category cat);
locale(const locale& other, const locale& one, category cats);
```
The new locale name is always "*". Locale names formed from parts of two named locales (that is, C++ locales having names) are supposed to have names in turn (see C++20 subclause 28.3.1.1 [locale.general] paragraph 8). This patch fixes the name construction for cases when either of locales are unnamed, when the category is locale::none, and when the two locale names are the same.

Reviewed By: #libc, ldionne

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




More information about the All-commits mailing list