[clang] c765b5e - [AST] Avoid repeated set lookups (NFC) (#112155)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 06:53:53 PDT 2024


Author: Kazu Hirata
Date: 2024-10-14T06:53:49-07:00
New Revision: c765b5eda778ab30e9944c8c9606fa8ba5295792

URL: https://github.com/llvm/llvm-project/commit/c765b5eda778ab30e9944c8c9606fa8ba5295792
DIFF: https://github.com/llvm/llvm-project/commit/c765b5eda778ab30e9944c8c9606fa8ba5295792.diff

LOG: [AST] Avoid repeated set lookups (NFC) (#112155)

Added: 
    

Modified: 
    clang/lib/AST/InheritViz.cpp

Removed: 
    


################################################################################
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.


        


More information about the cfe-commits mailing list