@@ -271,8 +271,7 @@ void LTOModule::addObjCClass(const GlobalVariable *clgv) {
271271 // second slot in __OBJC,__class is pointer to superclass name
272272 std::string superclassName;
273273 if (objcClassNameFromExpression (c->getOperand (1 ), superclassName)) {
274- auto IterBool =
275- _undefines.insert (std::make_pair (superclassName, NameAndAttributes ()));
274+ auto IterBool = _undefines.try_emplace (superclassName);
276275 if (IterBool.second ) {
277276 NameAndAttributes &info = IterBool.first ->second ;
278277 info.name = IterBool.first ->first ();
@@ -307,8 +306,7 @@ void LTOModule::addObjCCategory(const GlobalVariable *clgv) {
307306 if (!objcClassNameFromExpression (c->getOperand (1 ), targetclassName))
308307 return ;
309308
310- auto IterBool =
311- _undefines.insert (std::make_pair (targetclassName, NameAndAttributes ()));
309+ auto IterBool = _undefines.try_emplace (targetclassName);
312310
313311 if (!IterBool.second )
314312 return ;
@@ -326,8 +324,7 @@ void LTOModule::addObjCClassRef(const GlobalVariable *clgv) {
326324 if (!objcClassNameFromExpression (clgv->getInitializer (), targetclassName))
327325 return ;
328326
329- auto IterBool =
330- _undefines.insert (std::make_pair (targetclassName, NameAndAttributes ()));
327+ auto IterBool = _undefines.try_emplace (targetclassName);
331328
332329 if (!IterBool.second )
333330 return ;
@@ -522,7 +519,7 @@ void LTOModule::addAsmGlobalSymbol(StringRef name,
522519// / addAsmGlobalSymbolUndef - Add a global symbol from module-level ASM to the
523520// / undefined list.
524521void LTOModule::addAsmGlobalSymbolUndef (StringRef name) {
525- auto IterBool = _undefines.insert ( std::make_pair ( name, NameAndAttributes ()) );
522+ auto IterBool = _undefines.try_emplace ( name);
526523
527524 _asm_undefines.push_back (IterBool.first ->first ());
528525
@@ -549,8 +546,7 @@ void LTOModule::addPotentialUndefinedSymbol(ModuleSymbolTable::Symbol Sym,
549546 name.c_str ();
550547 }
551548
552- auto IterBool =
553- _undefines.insert (std::make_pair (name.str (), NameAndAttributes ()));
549+ auto IterBool = _undefines.try_emplace (name.str ());
554550
555551 // we already have the symbol
556552 if (!IterBool.second )
0 commit comments