@@ -247,14 +247,14 @@ class MCDCRecordProcessor {
247247 // / Each index of the bitmap corresponds to a possible test vector. An index
248248 // / with a bit value of '1' indicates that the corresponding Test Vector
249249 // / identified by that index was executed.
250- BitVector &ExecutedTestVectorBitmap;
250+ const BitVector &ExecutedTestVectorBitmap;
251251
252252 // / Decision Region to which the ExecutedTestVectorBitmap applies.
253- CounterMappingRegion &Region;
253+ const CounterMappingRegion &Region;
254254
255255 // / Array of branch regions corresponding each conditions in the boolean
256256 // / expression.
257- ArrayRef<CounterMappingRegion> Branches;
257+ ArrayRef<const CounterMappingRegion * > Branches;
258258
259259 // / Total number of conditions in the boolean expression.
260260 unsigned NumConditions;
@@ -276,8 +276,9 @@ class MCDCRecordProcessor {
276276 MCDCRecord::TestVectors ExecVectors;
277277
278278public:
279- MCDCRecordProcessor (BitVector &Bitmap, CounterMappingRegion &Region,
280- ArrayRef<CounterMappingRegion> Branches)
279+ MCDCRecordProcessor (const BitVector &Bitmap,
280+ const CounterMappingRegion &Region,
281+ ArrayRef<const CounterMappingRegion *> Branches)
281282 : ExecutedTestVectorBitmap(Bitmap), Region(Region), Branches(Branches),
282283 NumConditions (Region.MCDCParams.NumConditions),
283284 Folded(NumConditions, false ), IndependencePairs(NumConditions),
@@ -342,7 +343,7 @@ class MCDCRecordProcessor {
342343
343344 // / Walk the bits in the bitmap. A bit set to '1' indicates that the test
344345 // / vector at the corresponding index was executed during a test run.
345- void findExecutedTestVectors (BitVector &ExecutedTestVectorBitmap) {
346+ void findExecutedTestVectors (const BitVector &ExecutedTestVectorBitmap) {
346347 for (unsigned Idx = 0 ; Idx < ExecutedTestVectorBitmap.size (); ++Idx) {
347348 if (ExecutedTestVectorBitmap[Idx] == 0 )
348349 continue ;
@@ -445,11 +446,11 @@ class MCDCRecordProcessor {
445446 // visualize where the condition is.
446447 // - Record whether the condition is constant folded so that we exclude it
447448 // from being measured.
448- for (const auto & B : Branches) {
449- Map[B. MCDCParams .ID ] = & B;
450- PosToID[I] = B. MCDCParams .ID - 1 ;
451- CondLoc[I] = B. startLoc ();
452- Folded[I++] = (B. Count .isZero () && B. FalseCount .isZero ());
449+ for (const auto * B : Branches) {
450+ Map[B-> MCDCParams .ID ] = B;
451+ PosToID[I] = B-> MCDCParams .ID - 1 ;
452+ CondLoc[I] = B-> startLoc ();
453+ Folded[I++] = (B-> Count .isZero () && B-> FalseCount .isZero ());
453454 }
454455
455456 // Initialize a base test vector as 'DontCare'.
@@ -473,8 +474,9 @@ class MCDCRecordProcessor {
473474};
474475
475476Expected<MCDCRecord> CounterMappingContext::evaluateMCDCRegion (
476- CounterMappingRegion Region, BitVector ExecutedTestVectorBitmap,
477- ArrayRef<CounterMappingRegion> Branches) {
477+ const CounterMappingRegion &Region,
478+ const BitVector &ExecutedTestVectorBitmap,
479+ ArrayRef<const CounterMappingRegion *> Branches) {
478480
479481 MCDCRecordProcessor MCDCProcessor (ExecutedTestVectorBitmap, Region, Branches);
480482 return MCDCProcessor.processMCDCRecord ();
@@ -638,7 +640,7 @@ Error CoverageMapping::loadFunctionRecord(
638640
639641 unsigned NumConds = 0 ;
640642 const CounterMappingRegion *MCDCDecision;
641- std::vector<CounterMappingRegion> MCDCBranches;
643+ std::vector<const CounterMappingRegion * > MCDCBranches;
642644
643645 FunctionRecord Function (OrigFuncName, Record.Filenames );
644646 for (const auto &Region : Record.MappingRegions ) {
@@ -666,7 +668,7 @@ Error CoverageMapping::loadFunctionRecord(
666668 // correspond to it in a vector, according to the number of conditions
667669 // recorded for the region (tracked by NumConds).
668670 if (NumConds > 0 && Region.Kind == CounterMappingRegion::MCDCBranchRegion) {
669- MCDCBranches.push_back (Region);
671+ MCDCBranches.push_back (& Region);
670672
671673 // As we move through all of the MCDCBranchRegions that follow the
672674 // MCDCDecisionRegion, decrement NumConds to make sure we account for
0 commit comments