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

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 20 13:15:11 PDT 2024


Author: Kazu Hirata
Date: 2024-09-20T13:15:08-07:00
New Revision: d64fc57353c6e6f5796c97e9dc541ba7a7ab3cb4

URL: https://github.com/llvm/llvm-project/commit/d64fc57353c6e6f5796c97e9dc541ba7a7ab3cb4
DIFF: https://github.com/llvm/llvm-project/commit/d64fc57353c6e6f5796c97e9dc541ba7a7ab3cb4.diff

LOG: [TableGen] Use StringSet instead of StringMap (NFC) (#109441)

Added: 
    

Modified: 
    clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp

Removed: 
    


################################################################################
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