[llvm] [clang] [clang][CoverageMapping] Refactor when setting MC/DC True/False (PR #78202)
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 17 18:01:43 PST 2024
================
@@ -1018,13 +1011,15 @@ struct CounterCoverageMappingBuilder
return (Cond->EvaluateAsInt(Result, CVM.getCodeGenModule().getContext()));
}
+ using MCDCDecisionIDPair = MCDCCoverageBuilder::DecisionIDPair;
+
/// Create a Branch Region around an instrumentable condition for coverage
/// and add it to the function's SourceRegions. A branch region tracks a
/// "True" counter and a "False" counter for boolean expressions that
/// result in the generation of a branch.
- void createBranchRegion(const Expr *C, Counter TrueCnt, Counter FalseCnt,
- MCDCConditionID ID = 0, MCDCConditionID TrueID = 0,
- MCDCConditionID FalseID = 0) {
+ void
+ createBranchRegion(const Expr *C, Counter TrueCnt, Counter FalseCnt,
+ const MCDCDecisionIDPair &IDPair = MCDCDecisionIDPair()) {
----------------
chapuni wrote:
Oops, I have suggested dropping initial values in `DecisionIDPair`.
We have to introduce the explicit initializer, or use `Sentinel`, or leave `DecisionIDPair` with initializers.
It's also possible to pass `{poison, poison}` as the default value and assert they are not poison before using.
https://github.com/llvm/llvm-project/pull/78202
More information about the llvm-commits
mailing list