Revert "[InstCombine] Support gep nuw in icmp folds" (#118698)
[llvm-project.git] / libcxx / include / __chrono / statically_widen.h
blob40e085633b8c16c01447a5e431572251f9131c4e
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___CHRONO_STATICALLY_WIDEN_H
11 #define _LIBCPP___CHRONO_STATICALLY_WIDEN_H
13 // Implements the STATICALLY-WIDEN exposition-only function. ([time.general]/2)
15 #include <__concepts/same_as.h>
16 #include <__config>
17 #include <__format/concepts.h>
19 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20 # pragma GCC system_header
21 #endif
23 _LIBCPP_BEGIN_NAMESPACE_STD
25 #if _LIBCPP_STD_VER >= 20
27 # if _LIBCPP_HAS_WIDE_CHARACTERS
28 template <__fmt_char_type _CharT>
29 _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str, const wchar_t* __wstr) {
30 if constexpr (same_as<_CharT, char>)
31 return __str;
32 else
33 return __wstr;
35 # define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str, L##__str)
36 # else // _LIBCPP_HAS_WIDE_CHARACTERS
38 // Without this indirection the unit test test/libcxx/modules_include.sh.cpp
39 // fails for the CI build "No wide characters". This seems like a bug.
40 // TODO FMT investigate why this is needed.
41 template <__fmt_char_type _CharT>
42 _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str) {
43 return __str;
45 # define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str)
46 # endif // _LIBCPP_HAS_WIDE_CHARACTERS
48 #endif // _LIBCPP_STD_VER >= 20
50 _LIBCPP_END_NAMESPACE_STD
52 #endif // _LIBCPP___CHRONO_STATICALLY_WIDEN_H