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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/109469.diff


1 Files Affected:

- (modified) clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp (+5-7) 


``````````diff
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;
 

``````````

</details>


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


More information about the cfe-commits mailing list