[Transforms] Silence a warning in SROA.cpp (NFC)
[llvm-project.git] / libcxx / include / __debug_utils / randomize_range.h
blob7eb77d81ab2a3db2866c4916c39c3eb1e95c7b5f
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___LIBCXX_DEBUG_RANDOMIZE_RANGE_H
10 #define _LIBCPP___LIBCXX_DEBUG_RANDOMIZE_RANGE_H
12 #include <__config>
14 #ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
15 # include <__algorithm/shuffle.h>
16 # include <__type_traits/is_constant_evaluated.h>
17 #endif
19 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20 # pragma GCC system_header
21 #endif
23 _LIBCPP_BEGIN_NAMESPACE_STD
25 template <class _AlgPolicy, class _Iterator, class _Sentinel>
26 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __debug_randomize_range(_Iterator __first, _Sentinel __last) {
27 #ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
28 # ifdef _LIBCPP_CXX03_LANG
29 # error Support for unspecified stability is only for C++11 and higher
30 # endif
32 if (!__libcpp_is_constant_evaluated())
33 std::__shuffle<_AlgPolicy>(__first, __last, __libcpp_debug_randomizer());
34 #else
35 (void)__first;
36 (void)__last;
37 #endif
40 _LIBCPP_END_NAMESPACE_STD
42 #endif // _LIBCPP___LIBCXX_DEBUG_RANDOMIZE_RANGE_H