[clang] [TableGen] Avoid repeated hash lookups (NFC) (PR #109372)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 20 00:12:44 PDT 2024


================
@@ -896,9 +896,8 @@ static void OCL2Qual(Sema &S, const OpenCLTypeStruct &Ty,
     if (ImageTypesMap.contains(T->getValueAsString("Name")))
       continue;
     // Check we have not seen this Type
-    if (TypesSeen.contains(T->getValueAsString("Name")))
+    if (!TypesSeen.try_emplace(T->getValueAsString("Name"), true).second)
----------------
nikic wrote:

This is pretty weird, can we make it a StringSet instead? Doesn't look like the value is used.

https://github.com/llvm/llvm-project/pull/109372


More information about the cfe-commits mailing list