Author: Kazu Hirata
Date: 2024-09-15T01:20:37-07:00
New Revision: 56f061f71b66a01a7f89069873f9c6dcda82b044

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

LOG: [TableGen] Avoid repeated hash lookups (NFC) (#108736)

Added: 
    

Modified: 
    clang/utils/TableGen/ClangAttrEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/utils/TableGen/ClangAttrEmitter.cpp 
b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 9b2249ac90bc5c..637484149d4438 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -203,12 +203,11 @@ static ParsedAttrMap getParsedAttrList(const RecordKeeper 
&Records,
 
         // If this attribute has already been handled, it does not need to be
         // handled again.
-        if (Seen.find(AN) != Seen.end()) {
+        if (!Seen.insert(AN).second) {
           if (Dupes)
             Dupes->push_back(std::make_pair(AN, Attr));
           continue;
         }
-        Seen.insert(AN);
       } else
         AN = NormalizeAttrName(Attr->getName()).str();
 
@@ -1824,10 +1823,9 @@ CreateSemanticSpellings(const 
std::vector<FlattenedSpelling> &Spellings,
     // reserved namespace, we may have inadvertently created duplicate
     // enumerant names. These duplicates are not considered part of the
     // semantic spelling, and can be elided.
-    if (Uniques.find(EnumName) != Uniques.end())
+    if (!Uniques.insert(EnumName).second)
       continue;
 
-    Uniques.insert(EnumName);
     if (I != Spellings.begin())
       Ret += ",\n";
     // Duplicate spellings are not considered part of the semantic spelling


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

Reply via email to