[clang] 66c9915 - [clang][Interp][NFC] Remove from(Boolean) overload

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 18 05:28:58 PDT 2023


Author: Timm Bäder
Date: 2023-10-18T14:23:29+02:00
New Revision: 66c99154a130553a50e499d898ef1fba5b755dcf

URL: https://github.com/llvm/llvm-project/commit/66c99154a130553a50e499d898ef1fba5b755dcf
DIFF: https://github.com/llvm/llvm-project/commit/66c99154a130553a50e499d898ef1fba5b755dcf.diff

LOG: [clang][Interp][NFC] Remove from(Boolean) overload

This code is unused now that we have special casts from/to IntAP(S).

Added: 
    

Modified: 
    clang/lib/AST/Interp/IntegralAP.h
    clang/test/AST/Interp/intap.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/IntegralAP.h b/clang/lib/AST/Interp/IntegralAP.h
index f17fb8e484415d2..fd120944a25043e 100644
--- a/clang/lib/AST/Interp/IntegralAP.h
+++ b/clang/lib/AST/Interp/IntegralAP.h
@@ -29,7 +29,6 @@ namespace interp {
 using APInt = llvm::APInt;
 using APSInt = llvm::APSInt;
 template <unsigned Bits, bool Signed> class Integral;
-class Boolean;
 
 template <bool Signed> class IntegralAP final {
 private:
@@ -104,10 +103,6 @@ template <bool Signed> class IntegralAP final {
     assert(Copy.isSigned() == Signed);
     return IntegralAP<Signed>(Copy);
   }
-  static IntegralAP from(const Boolean &B) {
-    assert(false);
-    return IntegralAP::zero();
-  }
 
   static IntegralAP zero() {
     assert(false);

diff  --git a/clang/test/AST/Interp/intap.cpp b/clang/test/AST/Interp/intap.cpp
index f9cbc698a3290d8..ef7a0d4f0dfdab0 100644
--- a/clang/test/AST/Interp/intap.cpp
+++ b/clang/test/AST/Interp/intap.cpp
@@ -42,6 +42,9 @@ namespace i128 {
                                          // ref-note {{outside the range}}
   constexpr int128_t Two = (int128_t)1 << 1ul;
   static_assert(Two == 2, "");
+  static_assert(Two, "");
+  constexpr bool CastedToBool = Two;
+  static_assert(CastedToBool, "");
 
   constexpr uint128_t AllOnes = ~static_cast<uint128_t>(0);
   static_assert(AllOnes == UINT128_MAX, "");


        


More information about the cfe-commits mailing list