https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/111628
None >From 04ac47ef9952eaeb4e9d8ef7f7b96cb050865a3a Mon Sep 17 00:00:00 2001 From: Kazu Hirata <k...@google.com> Date: Tue, 8 Oct 2024 20:42:13 -0700 Subject: [PATCH] [clang-tidy] Avoid repeated hash lookups (NFC) --- .../clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp index 9c3c7cc70c187b..225e867c9b24f7 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp @@ -474,10 +474,8 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer( // It only includes fields that have not been fixed SmallPtrSet<const FieldDecl *, 16> AllFieldsToInit; forEachField(ClassDecl, FieldsToInit, [&](const FieldDecl *F) { - if (!HasRecordClassMemberSet.contains(F)) { + if (HasRecordClassMemberSet.insert(F).second) AllFieldsToInit.insert(F); - HasRecordClassMemberSet.insert(F); - } }); if (FieldsToInit.empty()) return; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits