[clang] [TableGen] Avoid repeated hash lookups (NFC) (PR #108736)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 15 00:06:08 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/108736
None
>From 38db9c4e0d85afd6ece4ca91221205492d374d12 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 13 Sep 2024 21:32:36 -0700
Subject: [PATCH] [TableGen] Avoid repeated hash lookups (NFC)
---
clang/utils/TableGen/ClangAttrEmitter.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 9b2249ac90bc5c..637484149d4438 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -203,12 +203,11 @@ static ParsedAttrMap getParsedAttrList(const RecordKeeper &Records,
// If this attribute has already been handled, it does not need to be
// handled again.
- if (Seen.find(AN) != Seen.end()) {
+ if (!Seen.insert(AN).second) {
if (Dupes)
Dupes->push_back(std::make_pair(AN, Attr));
continue;
}
- Seen.insert(AN);
} else
AN = NormalizeAttrName(Attr->getName()).str();
@@ -1824,10 +1823,9 @@ CreateSemanticSpellings(const std::vector<FlattenedSpelling> &Spellings,
// reserved namespace, we may have inadvertently created duplicate
// enumerant names. These duplicates are not considered part of the
// semantic spelling, and can be elided.
- if (Uniques.find(EnumName) != Uniques.end())
+ if (!Uniques.insert(EnumName).second)
continue;
- Uniques.insert(EnumName);
if (I != Spellings.begin())
Ret += ",\n";
// Duplicate spellings are not considered part of the semantic spelling
More information about the cfe-commits
mailing list