Skip to content

Commit 05ad0d4

Browse files
authored
CoverageMapping.cpp: Apply std::move to MCDCRecord (#81220)
1 parent f0db35b commit 05ad0d4

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,13 @@ struct MCDCRecord {
396396
LineColPairMap CondLoc;
397397

398398
public:
399-
MCDCRecord(CounterMappingRegion Region, TestVectors TV,
400-
TVPairMap IndependencePairs, BoolVector Folded, CondIDMap PosToID,
401-
LineColPairMap CondLoc)
402-
: Region(Region), TV(TV), IndependencePairs(IndependencePairs),
403-
Folded(Folded), PosToID(PosToID), CondLoc(CondLoc){};
399+
MCDCRecord(const CounterMappingRegion &Region, TestVectors &&TV,
400+
TVPairMap &&IndependencePairs, BoolVector &&Folded,
401+
CondIDMap &&PosToID, LineColPairMap &&CondLoc)
402+
: Region(Region), TV(std::move(TV)),
403+
IndependencePairs(std::move(IndependencePairs)),
404+
Folded(std::move(Folded)), PosToID(std::move(PosToID)),
405+
CondLoc(std::move(CondLoc)){};
404406

405407
CounterMappingRegion getDecisionRegion() const { return Region; }
406408
unsigned getNumConditions() const {
@@ -603,7 +605,9 @@ struct FunctionRecord {
603605
FunctionRecord(FunctionRecord &&FR) = default;
604606
FunctionRecord &operator=(FunctionRecord &&) = default;
605607

606-
void pushMCDCRecord(MCDCRecord Record) { MCDCRecords.push_back(Record); }
608+
void pushMCDCRecord(MCDCRecord &&Record) {
609+
MCDCRecords.push_back(std::move(Record));
610+
}
607611

608612
void pushRegion(CounterMappingRegion Region, uint64_t Count,
609613
uint64_t FalseCount) {

llvm/lib/ProfileData/Coverage/CoverageMapping.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ class MCDCRecordProcessor {
385385
findIndependencePairs();
386386

387387
// Record Test vectors, executed vectors, and independence pairs.
388-
MCDCRecord Res(Region, ExecVectors, IndependencePairs, Folded, PosToID,
389-
CondLoc);
390-
return Res;
388+
return MCDCRecord(Region, std::move(ExecVectors),
389+
std::move(IndependencePairs), std::move(Folded),
390+
std::move(PosToID), std::move(CondLoc));
391391
}
392392
};
393393

@@ -761,7 +761,7 @@ Error CoverageMapping::loadFunctionRecord(
761761
}
762762

763763
// Save the MC/DC Record so that it can be visualized later.
764-
Function.pushMCDCRecord(*Record);
764+
Function.pushMCDCRecord(std::move(*Record));
765765
}
766766

767767
// Don't create records for (filenames, function) pairs we've already seen.

0 commit comments

Comments
 (0)