[llvm] [ADT] Fix an empty BitVector call getData assert `idx < size()' failed (PR #65505)

Markus Böck via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 11:04:03 PDT 2023


zero9178 wrote:

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.

https://github.com/llvm/llvm-project/pull/65505


More information about the llvm-commits mailing list