From d7f98a4ef9992936a92c2a71fec743ea6f3493d0 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 1 May 2025 12:06:49 -0700 Subject: [Clang][NFC] Use std::move to avoid copy (#138073) Static analysis flagged this code for using copy when we could use std::move. Worth noting that CD.Message is a StringRef but Conflict.Message is std::string. Otherwise I would have used a temporary in place and avoid a local variable. --- clang/lib/Lex/ModuleMap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/lib/Lex/ModuleMap.cpp') diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 74fe55f..c2f13fa 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -2010,7 +2010,8 @@ void ModuleMapLoader::handleConflict(const modulemap::ConflictDecl &CD) { Conflict.Id = CD.Id; Conflict.Message = CD.Message; - ActiveModule->UnresolvedConflicts.push_back(Conflict); + // FIXME: when we move to C++20 we should consider using emplace_back + ActiveModule->UnresolvedConflicts.push_back(std::move(Conflict)); } void ModuleMapLoader::handleInferredModuleDecl( -- cgit v1.1