From aad74dc971f789b2974fde4181f87ee20db2998d Mon Sep 17 00:00:00 2001 From: l0rinc Date: Fri, 21 Feb 2025 09:17:26 +0000 Subject: [PATCH] [compiler-rt] FuzzedDataProvider: modernize outdated trait patterns (#127811) --- compiler-rt/include/fuzzer/FuzzedDataProvider.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler-rt/include/fuzzer/FuzzedDataProvider.h b/compiler-rt/include/fuzzer/FuzzedDataProvider.h index e57b95b6304a..11f2fbdb8c85 100644 --- a/compiler-rt/include/fuzzer/FuzzedDataProvider.h +++ b/compiler-rt/include/fuzzer/FuzzedDataProvider.h @@ -203,7 +203,7 @@ template T FuzzedDataProvider::ConsumeIntegral() { // be less than or equal to |max|. template T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) { - static_assert(std::is_integral::value, "An integral type is required."); + static_assert(std::is_integral_v, "An integral type is required."); static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type."); if (min > max) @@ -271,14 +271,14 @@ T FuzzedDataProvider::ConsumeFloatingPointInRange(T min, T max) { // Returns a floating point number in the range [0.0, 1.0]. If there's no // input data left, always returns 0. template T FuzzedDataProvider::ConsumeProbability() { - static_assert(std::is_floating_point::value, + static_assert(std::is_floating_point_v, "A floating point type is required."); // Use different integral types for different floating point types in order // to provide better density of the resulting values. using IntegralType = - typename std::conditional<(sizeof(T) <= sizeof(uint32_t)), uint32_t, - uint64_t>::type; + typename std::conditional_t<(sizeof(T) <= sizeof(uint32_t)), uint32_t, + uint64_t>; T result = static_cast(ConsumeIntegral()); result /= static_cast(std::numeric_limits::max()); @@ -294,7 +294,7 @@ inline bool FuzzedDataProvider::ConsumeBool() { // also contain |kMaxValue| aliased to its largest (inclusive) value. Such as: // enum class Foo { SomeValue, OtherValue, kMaxValue = OtherValue }; template T FuzzedDataProvider::ConsumeEnum() { - static_assert(std::is_enum::value, "|T| must be an enum type."); + static_assert(std::is_enum_v, "|T| must be an enum type."); return static_cast( ConsumeIntegralInRange(0, static_cast(T::kMaxValue))); }