Skip to content

Commit 9bda38f

Browse files
[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.
1 parent 30dd652 commit 9bda38f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/TextAPI/RecordsSlice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ ObjCInterfaceRecord::getObjCCategories() const {
259259

260260
ObjCIVarRecord *ObjCContainerRecord::addObjCIVar(StringRef IVar,
261261
RecordLinkage Linkage) {
262-
auto Result = IVars.insert({IVar, nullptr});
262+
auto Result = IVars.try_emplace(IVar);
263263
if (Result.second)
264264
Result.first->second = std::make_unique<ObjCIVarRecord>(IVar, Linkage);
265265
return Result.first->second.get();

0 commit comments

Comments
 (0)