[llvm] Refactor processing of BranchRegions associated with an MCDCDecisionRegion (PR #78819)
Alan Phipps via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 16:26:31 PST 2024
================
@@ -636,20 +657,56 @@ Error CoverageMapping::loadFunctionRecord(
Record.MappingRegions[0].Count.isZero() && Counts[0] > 0)
return Error::success();
- unsigned NumConds = 0;
- const CounterMappingRegion *MCDCDecision;
- std::vector<CounterMappingRegion> MCDCBranches;
-
FunctionRecord Function(OrigFuncName, Record.Filenames);
- for (const auto &Region : Record.MappingRegions) {
+
+ const auto &RegionsBegin = Record.MappingRegions.begin();
+ const auto &RegionsEnd = Record.MappingRegions.end();
+ for (auto It = RegionsBegin; It != RegionsEnd; ++It) {
+ const auto &Region = *It;
+
// If an MCDCDecisionRegion is seen, track the BranchRegions that follow
// it according to Region.NumConditions.
if (Region.Kind == CounterMappingRegion::MCDCDecisionRegion) {
----------------
evodius96 wrote:
I think the handling of DecisionRegions is much cleaner -- being assembled and processed in one iteration rather than rely on successive iterations of the loop.
https://github.com/llvm/llvm-project/pull/78819
More information about the llvm-commits
mailing list