https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/112155

None

>From d484b61db4ac1645358faa30962d406413f0714b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <k...@google.com>
Date: Sun, 13 Oct 2024 07:42:03 -0700
Subject: [PATCH] [AST] Avoid repeated set lookups (NFC)

---
 clang/lib/AST/InheritViz.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/AST/InheritViz.cpp b/clang/lib/AST/InheritViz.cpp
index 2ed0ce1c79c5bd..1dafed837a3560 100644
--- a/clang/lib/AST/InheritViz.cpp
+++ b/clang/lib/AST/InheritViz.cpp
@@ -63,12 +63,11 @@ void InheritanceHierarchyWriter::WriteNode(QualType Type, 
bool FromVirtual) {
   QualType CanonType = Context.getCanonicalType(Type);
 
   if (FromVirtual) {
-    if (KnownVirtualBases.find(CanonType) != KnownVirtualBases.end())
+    if (!KnownVirtualBases.insert(CanonType).second)
       return;
 
     // We haven't seen this virtual base before, so display it and
     // its bases.
-    KnownVirtualBases.insert(CanonType);
   }
 
   // Declare the node itself.

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to