Author: Shafik Yaghmour Date: 2025-05-01T12:06:49-07:00 New Revision: d7f98a4ef9992936a92c2a71fec743ea6f3493d0
URL: https://github.com/llvm/llvm-project/commit/d7f98a4ef9992936a92c2a71fec743ea6f3493d0 DIFF: https://github.com/llvm/llvm-project/commit/d7f98a4ef9992936a92c2a71fec743ea6f3493d0.diff LOG: [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. Added: Modified: clang/lib/Lex/ModuleMap.cpp Removed: ################################################################################ diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 74fe55fbe24f2..c2f13fa48d464 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( _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits