From 4e432f1b7ce6af4b24e67ebd21d119b092427a03 Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Wed, 6 Oct 2021 12:04:03 +0100 Subject: [PATCH] [APInt] Deprecate truncOrSelf, zextOrSelf and sextOrSelf Differential Revision: https://reviews.llvm.org/D125558 --- llvm/include/llvm/ADT/APInt.h | 6 +++--- llvm/unittests/ADT/APIntTest.cpp | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index 3c75417..45d32e1 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -1263,15 +1263,15 @@ public: /// Truncate this APInt if necessary to ensure that its bit width is <= \p /// width. - APInt truncOrSelf(unsigned width) const; + [[deprecated("Use trunc instead")]] APInt truncOrSelf(unsigned width) const; /// Sign-extend this APInt if necessary to ensure that its bit width is >= \p /// width. - APInt sextOrSelf(unsigned width) const; + [[deprecated("Use sext instead")]] APInt sextOrSelf(unsigned width) const; /// Zero-extend this APInt if necessary to ensure that its bit width is >= \p /// width. - APInt zextOrSelf(unsigned width) const; + [[deprecated("Use zext instead")]] APInt zextOrSelf(unsigned width) const; /// @} /// \name Bit Manipulation Operators diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp index aca4a9a..607560a 100644 --- a/llvm/unittests/ADT/APIntTest.cpp +++ b/llvm/unittests/ADT/APIntTest.cpp @@ -2663,9 +2663,6 @@ TEST(APIntTest, trunc) { APInt val(32, 0xFFFFFFFF); EXPECT_EQ(0xFFFF, val.trunc(16)); EXPECT_EQ(0xFFFFFFFF, val.trunc(32)); - EXPECT_EQ(0xFFFF, val.truncOrSelf(16)); - EXPECT_EQ(0xFFFFFFFF, val.truncOrSelf(32)); - EXPECT_EQ(0xFFFFFFFF, val.truncOrSelf(64)); } TEST(APIntTest, concat) { -- 2.7.4