From d910829febd43813d89ef80d4c3f3992223202fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 25 Nov 2025 17:16:01 +0100 Subject: [PATCH] [clang][bytecode][NFC] Clean up Integral::from() functions --- clang/lib/AST/ByteCode/Integral.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/clang/lib/AST/ByteCode/Integral.h b/clang/lib/AST/ByteCode/Integral.h index 131802439f0c5..5bf6621874e69 100644 --- a/clang/lib/AST/ByteCode/Integral.h +++ b/clang/lib/AST/ByteCode/Integral.h @@ -202,26 +202,21 @@ template class Integral final { static Integral min(unsigned NumBits) { return Integral(Min); } static Integral max(unsigned NumBits) { return Integral(Max); } + static Integral zero(unsigned BitWidth = 0) { return from(0); } - template static Integral from(ValT Value) { - if constexpr (std::is_integral::value) + template + static Integral from(ValT Value, unsigned NumBits = 0) { + if constexpr (std::is_integral_v) return Integral(Value); else - return Integral::from(static_cast(Value)); + return Integral(static_cast(Value)); } template - static std::enable_if_t - from(Integral Value) { + static Integral from(Integral Value) { return Integral(Value.V); } - static Integral zero(unsigned BitWidth = 0) { return from(0); } - - template static Integral from(T Value, unsigned NumBits) { - return Integral(Value); - } - static bool inRange(int64_t Value, unsigned NumBits) { return CheckRange(Value); }