Skip to content

Commit 6b08453

Browse files
shafiktomtor
authored andcommitted
[Clang][Tooling][NFC] Use move to avoid copies of large objects (llvm#143603)
Static analysis flagged these cases in which can use std::move and avoid copies of large objects.
1 parent 4679ebf commit 6b08453

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ void ModuleDepCollectorPP::moduleImport(SourceLocation ImportLoc,
657657
P1689ModuleInfo RequiredModule;
658658
RequiredModule.ModuleName = Path[0].getIdentifierInfo()->getName().str();
659659
RequiredModule.Type = P1689ModuleInfo::ModuleType::NamedCXXModule;
660-
MDC.RequiredStdCXXModules.push_back(RequiredModule);
660+
MDC.RequiredStdCXXModules.push_back(std::move(RequiredModule));
661661
return;
662662
}
663663

@@ -920,7 +920,7 @@ void ModuleDepCollectorPP::addAllSubmoduleDeps(
920920

921921
void ModuleDepCollectorPP::addOneModuleDep(const Module *M, const ModuleID ID,
922922
ModuleDeps &MD) {
923-
MD.ClangModuleDeps.push_back(ID);
923+
MD.ClangModuleDeps.push_back(std::move(ID));
924924
if (MD.IsInStableDirectories)
925925
MD.IsInStableDirectories = MDC.ModularDeps[M]->IsInStableDirectories;
926926
}

0 commit comments

Comments
 (0)