From 19f10f16ffe08fd0d3e2aabeec02e0cd54dcfdd6 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 9 Jun 2025 09:47:08 -0700 Subject: [PATCH] [TextAPI] Use MapVector::try_emplace (NFC) - try_emplace(Key) is shorter than insert({Key, nullptr}). - try_emplace performs value initialization without value parameters. - We overwrite values on successful insertion anyway. --- llvm/lib/TextAPI/RecordsSlice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/TextAPI/RecordsSlice.cpp b/llvm/lib/TextAPI/RecordsSlice.cpp index 1500b8752115a..1d04b63606522 100644 --- a/llvm/lib/TextAPI/RecordsSlice.cpp +++ b/llvm/lib/TextAPI/RecordsSlice.cpp @@ -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(IVar, Linkage); return Result.first->second.get();