mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-08 09:03:18 +00:00
[ADT] Fix an empty BitVector call getData assert `idx < size()' failed (#65505)
Fixes #65500
This commit is contained in:
parent
d4c3c2872f
commit
3639d81f7e
@ -688,7 +688,7 @@ public:
|
||||
}
|
||||
bool isInvalid() const { return Size == (unsigned)-1; }
|
||||
|
||||
ArrayRef<BitWord> getData() const { return {&Bits[0], Bits.size()}; }
|
||||
ArrayRef<BitWord> getData() const { return {Bits.data(), Bits.size()}; }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Portable bit mask operations.
|
||||
|
@ -1134,6 +1134,14 @@ TYPED_TEST(BitVectorTest, EmptyVector) {
|
||||
testEmpty(E);
|
||||
}
|
||||
|
||||
/// Make sure calling getData() is legal even on an empty BitVector
|
||||
TYPED_TEST(BitVectorTest, EmptyVectorGetData) {
|
||||
BitVector A;
|
||||
testEmpty(A);
|
||||
auto B = A.getData();
|
||||
EXPECT_TRUE(B.empty());
|
||||
}
|
||||
|
||||
TYPED_TEST(BitVectorTest, Iterators) {
|
||||
TypeParam Filled(10, true);
|
||||
EXPECT_NE(Filled.set_bits_begin(), Filled.set_bits_end());
|
||||
|
Loading…
Reference in New Issue
Block a user