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

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


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

None

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

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

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