Skip to content

Commit

Permalink
Reapply [APInt] Enable APInt ctor assertion by default (llvm#114539)
Browse files Browse the repository at this point in the history
This enables the assertion introduced in
llvm#106524, which checks that the
value passed to the 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#80309.

It is possible to opt-out of the check and restore the previous behavior
by setting implicitTrunc=true.

-----

The buildbot failures from the previous attempt should be fixed by
a18dd29 and
e2074c6.
  • Loading branch information
nikic authored and NoumanAmir657 committed Nov 4, 2024
1 parent f7a42c9 commit 6f1b6c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/include/llvm/ADT/APInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class [[nodiscard]] APInt {
/// \param implicitTrunc allow implicit truncation of non-zero/sign bits of
/// val beyond the range of numBits
APInt(unsigned numBits, uint64_t val, bool isSigned = false,
bool implicitTrunc = true)
bool implicitTrunc = false)
: BitWidth(numBits) {
if (!implicitTrunc) {
if (isSigned) {
Expand Down

0 comments on commit 6f1b6c7

Please sign in to comment.