Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand All @@ -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"));
}
}
}
Expand All @@ -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;

Expand Down
Loading