[libcxx-commits] [libcxx] [libc++][chrono] P0355R7 Implement from_stream and parse (PR #227590)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 30 03:11:17 PDT 2026


================
@@ -0,0 +1,146 @@
+// -*- 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 _LIBCPP___CHRONO_PARSER_DATA_H
+#define _LIBCPP___CHRONO_PARSER_DATA_H
+
+#include <__config>
+
+#if _LIBCPP_HAS_LOCALIZATION
+
+#  include <cstdint>
+
+#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#    pragma GCC system_header
+#  endif
+
+#  if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+// Fields supplied by the parsed format directives.
+enum class __fields_set : uint32_t {
+  __none    = 0,
+  __year    = 1 << 0,
+  __month   = 1 << 1,
+  __day     = 1 << 2,
+  __hours   = 1 << 3,
+  __minutes = 1 << 4,
+  __seconds = 1 << 5,
+
+  __iso_year = 1 << 6,
+  __iso_week = 1 << 7,
+  __weekday  = 1 << 8,
+
+  __century         = 1 << 9,
+  __year_of_century = 1 << 10,
+
+  __hour12 = 1 << 11,
+  __am_pm  = 1 << 12,
+
+  __day_of_year = 1 << 13,
+  __week_sun    = 1 << 14,
+  __week_mon    = 1 << 15,
+
+  __utc_offset = 1 << 16,
+
+  __iso_year_of_century = 1 << 17,
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr __fields_set operator|(__fields_set __lhs, __fields_set __rhs) {
----------------
frederick-vs-ja wrote:

Current CI failures seem to be module-related. Maybe we can move these (enum and operators) to an inner internal namespace?

Also, did you intend to write both `inline` and `constexpr`? `inline` is subsumed by `constexpr` here so we don't need to explicit write it.

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


More information about the libcxx-commits mailing list