Skip to content

Commit d7f98a4

Browse files
authored
[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.
1 parent a60984e commit d7f98a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/Lex/ModuleMap.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2010,7 +2010,8 @@ void ModuleMapLoader::handleConflict(const modulemap::ConflictDecl &CD) {
20102010
Conflict.Id = CD.Id;
20112011
Conflict.Message = CD.Message;
20122012

2013-
ActiveModule->UnresolvedConflicts.push_back(Conflict);
2013+
// FIXME: when we move to C++20 we should consider using emplace_back
2014+
ActiveModule->UnresolvedConflicts.push_back(std::move(Conflict));
20142015
}
20152016

20162017
void ModuleMapLoader::handleInferredModuleDecl(

0 commit comments

Comments
 (0)