@@ -247,14 +247,14 @@ class MCDCRecordProcessor {
247
247
// / Each index of the bitmap corresponds to a possible test vector. An index
248
248
// / with a bit value of '1' indicates that the corresponding Test Vector
249
249
// / identified by that index was executed.
250
- BitVector &ExecutedTestVectorBitmap;
250
+ const BitVector &ExecutedTestVectorBitmap;
251
251
252
252
// / Decision Region to which the ExecutedTestVectorBitmap applies.
253
- CounterMappingRegion &Region;
253
+ const CounterMappingRegion &Region;
254
254
255
255
// / Array of branch regions corresponding each conditions in the boolean
256
256
// / expression.
257
- ArrayRef<CounterMappingRegion> Branches;
257
+ ArrayRef<const CounterMappingRegion * > Branches;
258
258
259
259
// / Total number of conditions in the boolean expression.
260
260
unsigned NumConditions;
@@ -276,8 +276,9 @@ class MCDCRecordProcessor {
276
276
MCDCRecord::TestVectors ExecVectors;
277
277
278
278
public:
279
- MCDCRecordProcessor (BitVector &Bitmap, CounterMappingRegion &Region,
280
- ArrayRef<CounterMappingRegion> Branches)
279
+ MCDCRecordProcessor (const BitVector &Bitmap,
280
+ const CounterMappingRegion &Region,
281
+ ArrayRef<const CounterMappingRegion *> Branches)
281
282
: ExecutedTestVectorBitmap(Bitmap), Region(Region), Branches(Branches),
282
283
NumConditions (Region.MCDCParams.NumConditions),
283
284
Folded(NumConditions, false ), IndependencePairs(NumConditions),
@@ -342,7 +343,7 @@ class MCDCRecordProcessor {
342
343
343
344
// / Walk the bits in the bitmap. A bit set to '1' indicates that the test
344
345
// / vector at the corresponding index was executed during a test run.
345
- void findExecutedTestVectors (BitVector &ExecutedTestVectorBitmap) {
346
+ void findExecutedTestVectors (const BitVector &ExecutedTestVectorBitmap) {
346
347
for (unsigned Idx = 0 ; Idx < ExecutedTestVectorBitmap.size (); ++Idx) {
347
348
if (ExecutedTestVectorBitmap[Idx] == 0 )
348
349
continue ;
@@ -445,11 +446,11 @@ class MCDCRecordProcessor {
445
446
// visualize where the condition is.
446
447
// - Record whether the condition is constant folded so that we exclude it
447
448
// 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 ());
453
454
}
454
455
455
456
// Initialize a base test vector as 'DontCare'.
@@ -473,8 +474,9 @@ class MCDCRecordProcessor {
473
474
};
474
475
475
476
Expected<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) {
478
480
479
481
MCDCRecordProcessor MCDCProcessor (ExecutedTestVectorBitmap, Region, Branches);
480
482
return MCDCProcessor.processMCDCRecord ();
@@ -638,7 +640,7 @@ Error CoverageMapping::loadFunctionRecord(
638
640
639
641
unsigned NumConds = 0 ;
640
642
const CounterMappingRegion *MCDCDecision;
641
- std::vector<CounterMappingRegion> MCDCBranches;
643
+ std::vector<const CounterMappingRegion * > MCDCBranches;
642
644
643
645
FunctionRecord Function (OrigFuncName, Record.Filenames );
644
646
for (const auto &Region : Record.MappingRegions ) {
@@ -666,7 +668,7 @@ Error CoverageMapping::loadFunctionRecord(
666
668
// correspond to it in a vector, according to the number of conditions
667
669
// recorded for the region (tracked by NumConds).
668
670
if (NumConds > 0 && Region.Kind == CounterMappingRegion::MCDCBranchRegion) {
669
- MCDCBranches.push_back (Region);
671
+ MCDCBranches.push_back (& Region);
670
672
671
673
// As we move through all of the MCDCBranchRegions that follow the
672
674
// MCDCDecisionRegion, decrement NumConds to make sure we account for
0 commit comments