Skip to content

CoverageMapping.cpp: Apply std::move to MCDCRecord #81220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,13 @@ struct MCDCRecord {
LineColPairMap CondLoc;

public:
MCDCRecord(CounterMappingRegion Region, TestVectors TV,
TVPairMap IndependencePairs, BoolVector Folded, CondIDMap PosToID,
LineColPairMap CondLoc)
: Region(Region), TV(TV), IndependencePairs(IndependencePairs),
Folded(Folded), PosToID(PosToID), CondLoc(CondLoc){};
MCDCRecord(const CounterMappingRegion &Region, TestVectors &&TV,
TVPairMap &&IndependencePairs, BoolVector &&Folded,
CondIDMap &&PosToID, LineColPairMap &&CondLoc)
: Region(Region), TV(std::move(TV)),
IndependencePairs(std::move(IndependencePairs)),
Folded(std::move(Folded)), PosToID(std::move(PosToID)),
CondLoc(std::move(CondLoc)){};

CounterMappingRegion getDecisionRegion() const { return Region; }
unsigned getNumConditions() const {
Expand Down Expand Up @@ -614,7 +616,9 @@ struct FunctionRecord {
FunctionRecord(FunctionRecord &&FR) = default;
FunctionRecord &operator=(FunctionRecord &&) = default;

void pushMCDCRecord(MCDCRecord Record) { MCDCRecords.push_back(Record); }
void pushMCDCRecord(MCDCRecord &&Record) {
MCDCRecords.push_back(std::move(Record));
}

void pushRegion(CounterMappingRegion Region, uint64_t Count,
uint64_t FalseCount) {
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ class MCDCRecordProcessor {
findIndependencePairs();

// Record Test vectors, executed vectors, and independence pairs.
MCDCRecord Res(Region, ExecVectors, IndependencePairs, Folded, PosToID,
CondLoc);
return Res;
return MCDCRecord(Region, std::move(ExecVectors),
std::move(IndependencePairs), std::move(Folded),
std::move(PosToID), std::move(CondLoc));
}
};

Expand Down Expand Up @@ -770,7 +770,7 @@ Error CoverageMapping::loadFunctionRecord(
}

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

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