From eb20499dab29e2180dd0ff106edb3233ab243323 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Thu, 29 Dec 2022 16:24:58 +0100 Subject: [PATCH] [clang] Use try_emplace instead of insert when getting new identifier This is both less verbose and slightly faster, according to: https://llvm-compile-time-tracker.com/compare.php?from=d9ab3e82f30d646deff054230b0c742704a1cf26&to=73405077ad913f634797ffc7a7bbb110ac9cae99&stat=instructions:u No functional change intended :-) --- clang/include/clang/Basic/IdentifierTable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h index f98ea48..1886b1d 100644 --- a/clang/include/clang/Basic/IdentifierTable.h +++ b/clang/include/clang/Basic/IdentifierTable.h @@ -595,7 +595,7 @@ public: /// Return the identifier token info for the specified named /// identifier. IdentifierInfo &get(StringRef Name) { - auto &Entry = *HashTable.insert(std::make_pair(Name, nullptr)).first; + auto &Entry = *HashTable.try_emplace(Name, nullptr).first; IdentifierInfo *&II = Entry.second; if (II) return *II; -- 2.7.4