[clang] e632938 - [Sema] Avoid double hash lookup. NFCI

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 30 10:27:25 PST 2022


Author: Benjamin Kramer
Date: 2022-12-30T19:25:38+01:00
New Revision: e6329388c39d18c428afdbbfd0f1330e782bc348

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

LOG: [Sema] Avoid double hash lookup. NFCI

Added: 
    

Modified: 
    clang/lib/Sema/SemaLookup.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index c73acf1619930..97b3c97a9e51e 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -1623,10 +1623,8 @@ hasAcceptableDefaultArgument(Sema &S, const ParmDecl *D,
   if (!D->hasDefaultArgument())
     return false;
 
-  llvm::SmallDenseSet<const ParmDecl *, 4> Visited;
-  while (D && !Visited.count(D)) {
-    Visited.insert(D);
-
+  llvm::SmallPtrSet<const ParmDecl *, 4> Visited;
+  while (D && Visited.insert(D).second) {
     auto &DefaultArg = D->getDefaultArgStorage();
     if (!DefaultArg.isInherited() && S.isAcceptable(D, Kind))
       return true;


        


More information about the cfe-commits mailing list