[clang] [llvm] [clang][CoverageMapping] Refactor when setting MC/DC True/False (PR #78202)

NAKAMURA Takumi via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 22:57:38 PST 2024


================
@@ -1847,30 +1850,18 @@ struct CounterCoverageMappingBuilder
     // Extract the Parent Region Counter.
     Counter ParentCnt = getRegion().getCounter();
 
-    // Extract the MCDC condition IDs (returns 0 if not needed).
-    MCDCConditionID NextOrID = MCDCBuilder.getNextLOrCondID();
-    MCDCConditionID NextAndID = MCDCBuilder.getNextLAndCondID();
     MCDCConditionID LHSid = MCDCBuilder.getCondID(E->getLHS());
     MCDCConditionID RHSid = MCDCBuilder.getCondID(E->getRHS());
 
     // Create Branch Region around LHS condition.
-    // MC/DC: For "LHS && RHS"
-    // - If LHS is TRUE, execution goes to the RHS.
-    // - If LHS is FALSE, execution goes to the LHS of the next logical-OR.
-    //   If that does not exist, execution exits (ID == 0).
     createBranchRegion(E->getLHS(), RHSExecCnt,
-                       subtractCounters(ParentCnt, RHSExecCnt), LHSid, RHSid,
-                       NextOrID);
+                       subtractCounters(ParentCnt, RHSExecCnt), LHSid,
+                       DecisionLHS.TrueID, DecisionLHS.FalseID);
----------------
chapuni wrote:

They may be reduced to `const DecisionIDPair&` if its struct definition is move out of `MCDCCoverageBuilder`.

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


More information about the cfe-commits mailing list