[clang] 661f7e7 - [clang][NFC] Replace push_back with emplace_back for vector insertions (#232260)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 22 13:00:33 PDT 2026
Author: Hardik Kumar
Date: 2026-10-22T22:00:28+02:00
New Revision: 661f7e71e4d32774e1b96fb57db5b595372604ac
URL: https://github.com/llvm/llvm-project/commit/661f7e71e4d32774e1b96fb57db5b595372604ac
DIFF: https://github.com/llvm/llvm-project/commit/661f7e71e4d32774e1b96fb57db5b595372604ac.diff
LOG: [clang][NFC] Replace push_back with emplace_back for vector insertions (#232260)
Replace the push_back() calls with emplace_back() to allow in place
construction of objects instead of the object creation and move calls
done by push_back().
Changes are only made to `LinkLibraries` small vector
Added:
Modified:
clang/lib/Lex/ModuleMap.cpp
Removed:
################################################################################
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index b75f5c98ba72b..662a7790cba64 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -1126,8 +1126,8 @@ static void inferFrameworkLink(Module *Mod) {
StringRef FrameworkName(Mod->Name);
FrameworkName.consume_back("_Private");
- Mod->LinkLibraries.push_back(Module::LinkLibrary(FrameworkName.str(),
- /*IsFramework=*/true));
+ Mod->LinkLibraries.emplace_back(FrameworkName.str(),
+ /*IsFramework=*/true);
}
Module *ModuleMap::inferFrameworkModule(DirectoryEntryRef FrameworkDir,
@@ -2301,8 +2301,8 @@ void ModuleMapLoader::handleUseDecl(const modulemap::UseDecl &UD) {
}
void ModuleMapLoader::handleLinkDecl(const modulemap::LinkDecl &LD) {
- ActiveModule->LinkLibraries.push_back(
- Module::LinkLibrary(std::string{LD.Library}, LD.Framework));
+ ActiveModule->LinkLibraries.emplace_back(std::string{LD.Library},
+ LD.Framework);
}
void ModuleMapLoader::handleConfigMacros(
More information about the cfe-commits
mailing list