diff --git a/clang/lib/Analysis/CloneDetection.cpp b/clang/lib/Analysis/CloneDetection.cpp index 52dd88bba024a..451aabc78b3a8 100644 --- a/clang/lib/Analysis/CloneDetection.cpp +++ b/clang/lib/Analysis/CloneDetection.cpp @@ -403,8 +403,8 @@ void RecursiveCloneTypeIIHashConstraint::constrain( Result.push_back(NewGroup); } } - // Sequences is the output parameter, so we copy our result into it. - Sequences = Result; + // Sequences is the output parameter, so we move our result into it. + Sequences = std::move(Result); } void RecursiveCloneTypeIIVerifyConstraint::constrain( @@ -519,7 +519,7 @@ void CloneConstraint::splitCloneGroups( assert(llvm::all_of(Indexes, [](char c) { return c == 1; })); } - CloneGroups = Result; + CloneGroups = std::move(Result); } void VariablePattern::addVariableOccurence(const VarDecl *VarDecl, diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index fd53e6573051c..9117a725843d9 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -1405,7 +1405,7 @@ TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &BaseLoc, DeclSpec DS(AttrFactory); DS.SetRangeStart(IdLoc); DS.SetRangeEnd(EndLocation); - DS.getTypeSpecScope() = SS; + DS.getTypeSpecScope() = std::move(SS); const char *PrevSpec = nullptr; unsigned DiagID; diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 255c6ace8f603..37309d057fbe7 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1413,7 +1413,8 @@ namespace { } void RememberSubstitution(MultiLevelTemplateArgumentList Old) { - const_cast(this->TemplateArgs) = Old; + const_cast(this->TemplateArgs) = + std::move(Old); } TemplateArgument diff --git a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp index c4790b0284281..6932714bb6be7 100644 --- a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp +++ b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp @@ -308,7 +308,7 @@ ProgramStateRef ProgramState::BindExpr(const Stmt *S, return this; ProgramState NewSt = *this; - NewSt.Env = NewEnv; + NewSt.Env = std::move(NewEnv); return getStateManager().getPersistentState(NewSt); } diff --git a/clang/lib/Tooling/DependencyScanningTool.cpp b/clang/lib/Tooling/DependencyScanningTool.cpp index 9f27cb59b9cc8..cc4c88fc42f5a 100644 --- a/clang/lib/Tooling/DependencyScanningTool.cpp +++ b/clang/lib/Tooling/DependencyScanningTool.cpp @@ -220,7 +220,7 @@ std::optional DependencyScanningTool::getP1689ModuleDependencyFile( Rule.Provides = Provided; if (Rule.Provides) Rule.Provides->SourcePath = Filename.str(); - Rule.Requires = Requires; + Rule.Requires = std::move(Requires); } StringRef getMakeFormatDependencyOutputPath() {