[llvm] [ADT] Improve a comment in APInt.h (PR #156390)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 1 19:35:28 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/156390

We don't have to remove this constructor if we are worried about
accidental binding.  We can use "= delete" instead.  Also, this patch
replaces "captured by" with "bound to" as that is more precise
terminology than "captured by".


>From 97d81721bffd11c24f417af47a4befa2c7a60947 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 1 Sep 2025 17:54:36 -0700
Subject: [PATCH] [ADT] Improve a comment in APInt.h

We don't have to remove this constructor if we are worried about
accidental binding.  We can use "= delete" instead.  Also, this patch
replaces "captured by" with "bound to" as that is more precise
terminology than "captured by".
---
 llvm/include/llvm/ADT/APInt.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index e68dc8bd14d96..9fa98ad4ddde1 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -151,9 +151,9 @@ class [[nodiscard]] APInt {
   /// deprecated because this constructor is prone to ambiguity with the
   /// APInt(unsigned, uint64_t, bool) constructor.
   ///
-  /// If this overload is ever deleted, care should be taken to prevent calls
-  /// from being incorrectly captured by 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.
   LLVM_ABI APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);
 
   /// Construct an APInt from a string representation.



More information about the llvm-commits mailing list