[llvm] [MC/DC] Introduce `class TestVector` with a pair of `BitVector` (PR #82174)
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 19 00:31:07 PST 2024
================
@@ -380,7 +380,70 @@ struct MCDCRecord {
/// are effectively ignored.
enum CondState { MCDC_DontCare = -1, MCDC_False = 0, MCDC_True = 1 };
- using TestVector = llvm::SmallVector<CondState>;
+ /// Emulate SmallVector<CondState> with a pair of BitVector.
+ ///
+ /// True False DontCare (Impossible)
+ /// Values: True False False True
+ /// Visited: True True False False
+ class TestVector {
+ BitVector Values; /// True/False (False when DontCare)
+ BitVector Visited; /// ~DontCare
+
+ public:
+ /// Assume filling DontCare.
+ TestVector(unsigned n, CondState Cond = MCDC_DontCare) {
+ assert(Cond == MCDC_DontCare);
+ Values.resize(n);
+ Visited.resize(n);
+ }
+
+ /// Emulate RHS SmallVector::operator[]
+ MCDCRecord::CondState operator[](int I) const {
----------------
chapuni wrote:
I think they might be redundant to explain here since this handles the enum.
https://github.com/llvm/llvm-project/pull/82174
More information about the llvm-commits
mailing list