[llvm] [ADT] Mark deprecated APInt constructor deleted (PR #216371)

Marc Auberer via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 11:07:21 PDT 2026


https://github.com/marcauberer created https://github.com/llvm/llvm-project/pull/216371

Mark deprecated APInt constructor, taking uint64_t[] deleted instead of removing it as the comment suggests.

>From 14b1690c88f92db9f61cdb72f18b3c11961c5018 Mon Sep 17 00:00:00 2001
From: Marc Auberer <marc.auberer at chillibits.com>
Date: Fri, 14 Aug 2026 20:05:40 +0200
Subject: [PATCH] [ADT] Mark deprecated APInt constructor deleted

---
 llvm/include/llvm/ADT/APInt.h | 14 +++++---------
 llvm/lib/Support/APInt.cpp    |  5 -----
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index b59d3e9321bae..c3a18de7d89ba 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -147,15 +147,11 @@ class [[nodiscard]] APInt {
   /// \param bigVal a sequence of words to form the initial value of the APInt
   LLVM_ABI APInt(unsigned numBits, ArrayRef<uint64_t> bigVal);
 
-  /// Equivalent to APInt(numBits, ArrayRef<uint64_t>(bigVal, numWords)), but
-  /// deprecated because this constructor is prone to ambiguity with the
-  /// APInt(unsigned, uint64_t, bool) constructor.
-  ///
-  /// Once all uses of this constructor are migrated to other constructors,
-  /// consider marking this overload ""= delete" to prevent calls from being
-  /// incorrectly bound to the APInt(unsigned, uint64_t, bool) constructor.
-  [[deprecated("Use other constructors of APInt")]]
-  LLVM_ABI APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);
+  /// Was equivalent to APInt(numBits, ArrayRef<uint64_t>(bigVal, numWords))
+  /// historically, but is now deleted because this constructor is prone to
+  /// ambiguity with the APInt(unsigned, uint64_t, bool) constructor.
+  LLVM_ABI APInt(unsigned numBits, unsigned numWords,
+                 const uint64_t bigVal[]) = delete;
 
   /// Construct an APInt from a string representation.
   ///
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index c5766a2613e0c..943b3b6777b05 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -109,11 +109,6 @@ APInt::APInt(unsigned numBits, ArrayRef<uint64_t> bigVal) : BitWidth(numBits) {
   initFromArray(bigVal);
 }
 
-APInt::APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[])
-    : BitWidth(numBits) {
-  initFromArray(ArrayRef(bigVal, numWords));
-}
-
 APInt::APInt(unsigned numbits, StringRef Str, uint8_t radix)
     : BitWidth(numbits) {
   fromString(numbits, Str, radix);



More information about the llvm-commits mailing list