Skip to content

Conversation

@wingrez
Copy link
Contributor

@wingrez wingrez commented Sep 6, 2023

Fixes #65500

@zero9178
Copy link
Member

zero9178 commented Sep 6, 2023

Looks good!

Could you add a test exercising this code in https://github.com/llvm/llvm-project/blob/622354a522073b0a048a88c957b161fb376a40eb/llvm/unittests/ADT/BitVectorTest.cpp as well?
While you cannot do a lot with the result, checking that no assert is trigerred probably makes sense.
So I think just calling .data() and putting a comment that says something like "Make sure calling .data() is legal even on an empty BitVector" to make sure that we do not regress would be great.

Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to @zero9178's request

So I think just calling .data() and putting a comment that says something like "Make sure calling .data() is legal even on an empty BitVector" to make sure that we do not regress would be great.

We can also assert that that the arrayref is .empty().

Make sure calling getData() is legal even on an empty BitVector.
Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty BitVector call getData() got "Assertion `idx < size()' failed."

3 participants