[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:
Kazu Hirata 2025-06-10 11:36:24 -07:00 committed by GitHub
parent 30dd652c29
commit 9bda38f8d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();