Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:15

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CHRONO_STATICALLY_WIDEN_H
0011 #define _LIBCPP___CHRONO_STATICALLY_WIDEN_H
0012 
0013 // Implements the STATICALLY-WIDEN exposition-only function. ([time.general]/2)
0014 
0015 #include <__concepts/same_as.h>
0016 #include <__config>
0017 #include <__format/concepts.h>
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 #if _LIBCPP_STD_VER >= 20
0026 
0027 #  if _LIBCPP_HAS_WIDE_CHARACTERS
0028 template <__fmt_char_type _CharT>
0029 _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str, const wchar_t* __wstr) {
0030   if constexpr (same_as<_CharT, char>)
0031     return __str;
0032   else
0033     return __wstr;
0034 }
0035 #    define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str, L##__str)
0036 #  else // _LIBCPP_HAS_WIDE_CHARACTERS
0037 
0038 // Without this indirection the unit test test/libcxx/modules_include.sh.cpp
0039 // fails for the CI build "No wide characters". This seems like a bug.
0040 // TODO FMT investigate why this is needed.
0041 template <__fmt_char_type _CharT>
0042 _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str) {
0043   return __str;
0044 }
0045 #    define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str)
0046 #  endif // _LIBCPP_HAS_WIDE_CHARACTERS
0047 
0048 #endif // _LIBCPP_STD_VER >= 20
0049 
0050 _LIBCPP_END_NAMESPACE_STD
0051 
0052 #endif // _LIBCPP___CHRONO_STATICALLY_WIDEN_H