[clang] [TableGen] Use StringSet instead of StringMap (NFC) (PR #109441)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 20 09:13:29 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/109441.diff
1 Files Affected:
- (modified) clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp (+3-2)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/109441
More information about the cfe-commits
mailing list