[clang] [TableGen] Use StringSet instead of StringMap (NFC) (PR #109441)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 20 09:12:55 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/109441

None

>From 2d341c98063a16644c373b41390d681df4908034 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 20 Sep 2024 09:07:34 -0700
Subject: [PATCH] [TableGen] Use StringSet instead of StringMap (NFC)

---
 clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
index 25c7bf0306a891..2a369271cfc3f2 100644
--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -22,6 +22,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
@@ -889,14 +890,14 @@ static void OCL2Qual(Sema &S, const OpenCLTypeStruct &Ty,
   // Only insert the plain scalar type; vector information and type qualifiers
   // are added in step 2.
   ArrayRef<const Record *> Types = Records.getAllDerivedDefinitions("Type");
-  StringMap<bool> TypesSeen;
+  StringSet<> TypesSeen;
 
   for (const auto *T : Types) {
     // Check this is not an image type
     if (ImageTypesMap.contains(T->getValueAsString("Name")))
       continue;
     // Check we have not seen this Type
-    if (!TypesSeen.try_emplace(T->getValueAsString("Name"), true).second)
+    if (!TypesSeen.insert(T->getValueAsString("Name")).second)
       continue;
 
     // Check the Type does not have an "abstract" QualType



More information about the cfe-commits mailing list