[TextAPI] Use MapVector::try_emplace (NFC) (#143564)
- try_emplace(Key) is shorter than insert({Key, nullptr}).
- try_emplace performs value initialization without value parameters.
- We overwrite values on successful insertion anyway.
This commit is contained in:
@@ -259,7 +259,7 @@ ObjCInterfaceRecord::getObjCCategories() const {
|
||||
|
||||
ObjCIVarRecord *ObjCContainerRecord::addObjCIVar(StringRef IVar,
|
||||
RecordLinkage Linkage) {
|
||||
auto Result = IVars.insert({IVar, nullptr});
|
||||
auto Result = IVars.try_emplace(IVar);
|
||||
if (Result.second)
|
||||
Result.first->second = std::make_unique<ObjCIVarRecord>(IVar, Linkage);
|
||||
return Result.first->second.get();
|
||||
|
||||
Reference in New Issue
Block a user