https://github.com/shafik created https://github.com/llvm/llvm-project/pull/143603
Static analysis flagged these cases in which can use std::move and avoid copies of large objects. >From 6bcbd5e1691edd4cbc36bd0c318cdd3b526db1c3 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour <shafik.yaghm...@intel.com> Date: Tue, 10 Jun 2025 13:51:19 -0700 Subject: [PATCH] [Clang][Tooling][NFC] Use move to avoid copies of large objects Static analysis flagged these cases in which can use std::move and avoid copies of large objects. --- clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp index 44a270d5f7b35..b1495163ccc24 100644 --- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp +++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp @@ -657,7 +657,7 @@ void ModuleDepCollectorPP::moduleImport(SourceLocation ImportLoc, P1689ModuleInfo RequiredModule; RequiredModule.ModuleName = Path[0].getIdentifierInfo()->getName().str(); RequiredModule.Type = P1689ModuleInfo::ModuleType::NamedCXXModule; - MDC.RequiredStdCXXModules.push_back(RequiredModule); + MDC.RequiredStdCXXModules.push_back(std::move(RequiredModule)); return; } @@ -920,7 +920,7 @@ void ModuleDepCollectorPP::addAllSubmoduleDeps( void ModuleDepCollectorPP::addOneModuleDep(const Module *M, const ModuleID ID, ModuleDeps &MD) { - MD.ClangModuleDeps.push_back(ID); + MD.ClangModuleDeps.push_back(std::move(ID)); if (MD.IsInStableDirectories) MD.IsInStableDirectories = MDC.ModularDeps[M]->IsInStableDirectories; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits