[clang] 68849a8 - [TableGen] Use StringSet instead of StringMap (NFC) (#109469)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 20 20:32:27 PDT 2024


Author: Kazu Hirata
Date: 2024-09-20T20:32:23-07:00
New Revision: 68849a878858f981e19c5a664310e0ff059f27e7

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

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

Added: 
    

Modified: 
    clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
index 2a369271cfc3f2..80cb2ee28e256a 100644
--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -20,7 +20,6 @@
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/SmallString.h"
 #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"
@@ -114,9 +113,8 @@ class BuiltinNameEmitter {
   // \param Output (out) String containing the enums to emit in the output file.
   // \param List (out) List containing the extracted Types, except the Types in
   //        TypesSeen.
-  void ExtractEnumTypes(ArrayRef<const Record *> Types,
-                        StringMap<bool> &TypesSeen, std::string &Output,
-                        std::vector<const Record *> &List);
+  void ExtractEnumTypes(ArrayRef<const Record *> Types, StringSet<> &TypesSeen,
+                        std::string &Output, std::vector<const Record *> &List);
 
   // Emit the enum or struct used in the generated file.
   // Populate the TypeList at the same time.
@@ -364,7 +362,7 @@ void BuiltinNameEmitter::Emit() {
 }
 
 void BuiltinNameEmitter::ExtractEnumTypes(ArrayRef<const Record *> Types,
-                                          StringMap<bool> &TypesSeen,
+                                          StringSet<> &TypesSeen,
                                           std::string &Output,
                                           std::vector<const Record *> &List) {
   raw_string_ostream SS(Output);
@@ -376,7 +374,7 @@ void BuiltinNameEmitter::ExtractEnumTypes(ArrayRef<const Record *> Types,
       // the Record can be a VectorType or something else, only the name is
       // important.
       List.push_back(T);
-      TypesSeen.insert(std::make_pair(T->getValueAsString("Name"), true));
+      TypesSeen.insert(T->getValueAsString("Name"));
     }
   }
 }
@@ -385,7 +383,7 @@ void BuiltinNameEmitter::EmitDeclarations() {
   // Enum of scalar type names (float, int, ...) and generic type sets.
   OS << "enum OpenCLTypeID {\n";
 
-  StringMap<bool> TypesSeen;
+  StringSet<> TypesSeen;
   std::string GenTypeEnums;
   std::string TypeEnums;
 


        


More information about the cfe-commits mailing list