Skip to content

Commit 8dedf4a

Browse files
Address a comment.
1 parent e29b7ca commit 8dedf4a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

llvm/include/llvm/ADT/Bitfields.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ template <typename Bitfield, typename StorageType> struct Impl {
114114
} else {
115115
static_assert(std::is_signed_v<IntegerType>,
116116
"IntegerType must be signed");
117-
assert(UserValue <= maxIntN(Bitfield::Bits) && "value is too big");
118-
assert(UserValue >= minIntN(Bitfield::Bits) && "value is too small");
117+
assert(isInt<Bitfield::Bits>(UserValue) && "value is out of range");
119118
}
120119
}
121120

llvm/unittests/ADT/BitFieldsTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ TEST(BitfieldsTest, ValueTooBigBounded) {
247247
Bitfield::set<A>(Storage, 0);
248248
Bitfield::set<A>(Storage, -1);
249249
Bitfield::set<A>(Storage, -2);
250-
EXPECT_DEBUG_DEATH(Bitfield::set<A>(Storage, 2), "value is too big");
251-
EXPECT_DEBUG_DEATH(Bitfield::set<A>(Storage, -3), "value is too small");
250+
EXPECT_DEBUG_DEATH(Bitfield::set<A>(Storage, 2), "value is out of range");
251+
EXPECT_DEBUG_DEATH(Bitfield::set<A>(Storage, -3), "value is out of range");
252252
}
253253

254254
#endif

0 commit comments

Comments
 (0)