Skip to content

Commit 091ab03

Browse files
nikicakiramenai
authored andcommitted
[APInt] Enable APInt ctor assertion by default (#112670)
This enables the assertion introduced in llvm/llvm-project#106524, which checks that the value passed to the APInt constructor is indeed a valid N-bit signed or unsigned integer. Places that previously violated the assertion were updated in advance, e.g. in llvm/llvm-project#80309. It is possible to opt-out of the check and restore the previous behavior by setting implicitTrunc=true.
1 parent 4e86045 commit 091ab03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/include/llvm/ADT/APInt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class [[nodiscard]] APInt {
111111
/// \param implicitTrunc allow implicit truncation of non-zero/sign bits of
112112
/// val beyond the range of numBits
113113
APInt(unsigned numBits, uint64_t val, bool isSigned = false,
114-
bool implicitTrunc = true)
114+
bool implicitTrunc = false)
115115
: BitWidth(numBits) {
116116
if (!implicitTrunc) {
117117
if (isSigned) {

0 commit comments

Comments
 (0)