[llvm] [Coverage] Rework Decision/Expansion/Branch (PR #78969)
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 05:02:56 PST 2024
================
@@ -580,6 +583,72 @@ static unsigned getMaxBitmapSize(const CounterMappingContext &Ctx,
return MaxBitmapID + (SizeInBits / CHAR_BIT);
}
+struct DecisionRow {
+ const CounterMappingRegion *DecisionRegion;
+ LineColPair DecisionStartLoc;
+ LineColPair DecisionEndLoc;
+
+ SmallVector<const CounterMappingRegion *, 6> Branches;
+ DenseSet<CounterMappingRegion::MCDCConditionID> IDs;
+ SmallVector<const CounterMappingRegion *> Expansions;
+
+ DecisionRow(const CounterMappingRegion &Decision)
+ : DecisionRegion(&Decision), DecisionStartLoc(Decision.startLoc()),
+ DecisionEndLoc(Decision.endLoc()) {}
+
+ bool insert(const CounterMappingRegion &Branch) {
+ auto ID = Branch.MCDCParams.ID;
+ if (ID == 1)
+ Branches.insert(Branches.begin(), &Branch);
+ else
+ Branches.push_back(&Branch);
+ IDs.insert(ID);
----------------
chapuni wrote:
Yes.
I had to introduce `DenseMap` to distinguish parallel sets of `Branch`(es).
https://github.com/llvm/llvm-project/pull/78969
More information about the llvm-commits
mailing list