Author: Timm Bäder Date: 2022-08-19T16:14:37+02:00 New Revision: 7614785e1d284db5b1d1b9b0017f3bb5a3724f8c
URL: https://github.com/llvm/llvm-project/commit/7614785e1d284db5b1d1b9b0017f3bb5a3724f8c DIFF: https://github.com/llvm/llvm-project/commit/7614785e1d284db5b1d1b9b0017f3bb5a3724f8c.diff LOG: [clang][Interp] Rename Integral::T to Integral::ReprT Just 'T' is a bit generic and causes confusion. Added: Modified: clang/lib/AST/Interp/Integral.h Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/Integral.h b/clang/lib/AST/Interp/Integral.h index fd2c0947a516..dc17df44282a 100644 --- a/clang/lib/AST/Interp/Integral.h +++ b/clang/lib/AST/Interp/Integral.h @@ -58,12 +58,12 @@ template <unsigned Bits, bool Signed> class Integral { template <unsigned OtherBits, bool OtherSigned> friend class Integral; // The primitive representing the integral. - using T = typename Repr<Bits, Signed>::Type; - T V; + using ReprT = typename Repr<Bits, Signed>::Type; + ReprT V; /// Primitive representing limits. - static const auto Min = std::numeric_limits<T>::min(); - static const auto Max = std::numeric_limits<T>::max(); + static const auto Min = std::numeric_limits<ReprT>::min(); + static const auto Max = std::numeric_limits<ReprT>::max(); /// Construct an integral from anything that is convertible to storage. template <typename T> explicit Integral(T V) : V(V) {} @@ -124,25 +124,27 @@ template <unsigned Bits, bool Signed> class Integral { bool isMin() const { return *this == min(bitWidth()); } - bool isMinusOne() const { return Signed && V == T(-1); } + bool isMinusOne() const { return Signed && V == ReprT(-1); } constexpr static bool isSigned() { return Signed; } - bool isNegative() const { return V < T(0); } + bool isNegative() const { return V < ReprT(0); } bool isPositive() const { return !isNegative(); } ComparisonCategoryResult compare(const Integral &RHS) const { return Compare(V, RHS.V); } - unsigned countLeadingZeros() const { return llvm::countLeadingZeros<T>(V); } + unsigned countLeadingZeros() const { + return llvm::countLeadingZeros<ReprT>(V); + } Integral truncate(unsigned TruncBits) const { if (TruncBits >= Bits) return *this; - const T BitMask = (T(1) << T(TruncBits)) - 1; - const T SignBit = T(1) << (TruncBits - 1); - const T ExtMask = ~BitMask; + const ReprT BitMask = (ReprT(1) << ReprT(TruncBits)) - 1; + const ReprT SignBit = ReprT(1) << (TruncBits - 1); + const ReprT ExtMask = ~BitMask; return Integral((V & BitMask) | (Signed && (V & SignBit) ? ExtMask : 0)); } @@ -159,7 +161,7 @@ template <unsigned Bits, bool Signed> class Integral { if constexpr (std::is_integral<ValT>::value) return Integral(Value); else - return Integral::from(static_cast<Integral::T>(Value)); + return Integral::from(static_cast<Integral::ReprT>(Value)); } template <unsigned SrcBits, bool SrcSign> @@ -182,15 +184,15 @@ template <unsigned Bits, bool Signed> class Integral { } static bool inRange(int64_t Value, unsigned NumBits) { - return CheckRange<T, Min, Max>(Value); + return CheckRange<ReprT, Min, Max>(Value); } static bool increment(Integral A, Integral *R) { - return add(A, Integral(T(1)), A.bitWidth(), R); + return add(A, Integral(ReprT(1)), A.bitWidth(), R); } static bool decrement(Integral A, Integral *R) { - return sub(A, Integral(T(1)), A.bitWidth(), R); + return sub(A, Integral(ReprT(1)), A.bitWidth(), R); } static bool add(Integral A, Integral B, unsigned OpBits, Integral *R) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits