Skip to content

Commit 6e3d129

Browse files
ccotterMichael137
authored andcommitted
[llvm][NFC] Use move instead of copy
Summary: For functions that accept an rvalue reference type parameter, use move to avoid copying the parameter. These were found when implementing CppCoreGuideline F.18 in clang-tidy. Committed on behalf of ccotter (Chris Cotter) Reviewers: Michael137 thieta Differential Revision: https://reviews.llvm.org/D142825
1 parent 0803241 commit 6e3d129

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,10 @@ void CodeViewDebug::recordLocalVariable(LocalVariable &&Var,
488488
// This variable was inlined. Associate it with the InlineSite.
489489
const DISubprogram *Inlinee = Var.DIVar->getScope()->getSubprogram();
490490
InlineSite &Site = getInlineSite(InlinedAt, Inlinee);
491-
Site.InlinedLocals.emplace_back(Var);
491+
Site.InlinedLocals.emplace_back(std::move(Var));
492492
} else {
493493
// This variable goes into the corresponding lexical scope.
494-
ScopeVariables[LS].emplace_back(Var);
494+
ScopeVariables[LS].emplace_back(std::move(Var));
495495
}
496496
}
497497

llvm/lib/MC/MCParser/MasmParser.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ struct IntFieldInfo {
151151

152152
IntFieldInfo() = default;
153153
IntFieldInfo(const SmallVector<const MCExpr *, 1> &V) { Values = V; }
154-
IntFieldInfo(SmallVector<const MCExpr *, 1> &&V) { Values = V; }
154+
IntFieldInfo(SmallVector<const MCExpr *, 1> &&V) { Values = std::move(V); }
155155
};
156156
struct RealFieldInfo {
157157
SmallVector<APInt, 1> AsIntValues;
158158

159159
RealFieldInfo() = default;
160160
RealFieldInfo(const SmallVector<APInt, 1> &V) { AsIntValues = V; }
161-
RealFieldInfo(SmallVector<APInt, 1> &&V) { AsIntValues = V; }
161+
RealFieldInfo(SmallVector<APInt, 1> &&V) { AsIntValues = std::move(V); }
162162
};
163163
struct StructFieldInfo {
164164
std::vector<StructInitializer> Initializers;
@@ -269,12 +269,12 @@ FieldInitializer::FieldInitializer(FieldType FT) : FT(FT) {
269269

270270
FieldInitializer::FieldInitializer(SmallVector<const MCExpr *, 1> &&Values)
271271
: FT(FT_INTEGRAL) {
272-
new (&IntInfo) IntFieldInfo(Values);
272+
new (&IntInfo) IntFieldInfo(std::move(Values));
273273
}
274274

275275
FieldInitializer::FieldInitializer(SmallVector<APInt, 1> &&AsIntValues)
276276
: FT(FT_REAL) {
277-
new (&RealInfo) RealFieldInfo(AsIntValues);
277+
new (&RealInfo) RealFieldInfo(std::move(AsIntValues));
278278
}
279279

280280
FieldInitializer::FieldInitializer(

0 commit comments

Comments
 (0)