Skip to content

Commit 56f061f

Browse files
[TableGen] Avoid repeated hash lookups (NFC) (#108736)
1 parent cc96ce8 commit 56f061f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

clang/utils/TableGen/ClangAttrEmitter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,11 @@ static ParsedAttrMap getParsedAttrList(const RecordKeeper &Records,
203203

204204
// If this attribute has already been handled, it does not need to be
205205
// handled again.
206-
if (Seen.find(AN) != Seen.end()) {
206+
if (!Seen.insert(AN).second) {
207207
if (Dupes)
208208
Dupes->push_back(std::make_pair(AN, Attr));
209209
continue;
210210
}
211-
Seen.insert(AN);
212211
} else
213212
AN = NormalizeAttrName(Attr->getName()).str();
214213

@@ -1824,10 +1823,9 @@ CreateSemanticSpellings(const std::vector<FlattenedSpelling> &Spellings,
18241823
// reserved namespace, we may have inadvertently created duplicate
18251824
// enumerant names. These duplicates are not considered part of the
18261825
// semantic spelling, and can be elided.
1827-
if (Uniques.find(EnumName) != Uniques.end())
1826+
if (!Uniques.insert(EnumName).second)
18281827
continue;
18291828

1830-
Uniques.insert(EnumName);
18311829
if (I != Spellings.begin())
18321830
Ret += ",\n";
18331831
// Duplicate spellings are not considered part of the semantic spelling

0 commit comments

Comments
 (0)