Skip to content

Commit 5b7b52f

Browse files
[TableGen] Avoid repeated hash lookups (NFC) (#109372)
1 parent 7f6bbb3 commit 5b7b52f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -896,9 +896,8 @@ static void OCL2Qual(Sema &S, const OpenCLTypeStruct &Ty,
896896
if (ImageTypesMap.contains(T->getValueAsString("Name")))
897897
continue;
898898
// Check we have not seen this Type
899-
if (TypesSeen.contains(T->getValueAsString("Name")))
899+
if (!TypesSeen.try_emplace(T->getValueAsString("Name"), true).second)
900900
continue;
901-
TypesSeen.insert(std::make_pair(T->getValueAsString("Name"), true));
902901

903902
// Check the Type does not have an "abstract" QualType
904903
auto QT = T->getValueAsDef("QTExpr");
@@ -1081,9 +1080,8 @@ void OpenCLBuiltinFileEmitterBase::expandTypesInSignature(
10811080
// the full type name to the extension.
10821081
StringRef Ext =
10831082
Type->getValueAsDef("Extension")->getValueAsString("ExtName");
1084-
if (!Ext.empty() && !TypeExtMap.contains(FullType)) {
1085-
TypeExtMap.insert({FullType, Ext});
1086-
}
1083+
if (!Ext.empty())
1084+
TypeExtMap.try_emplace(FullType, Ext);
10871085
}
10881086
}
10891087
NumSignatures = std::max<unsigned>(NumSignatures, ExpandedArg.size());

0 commit comments

Comments
 (0)