]> granicus.if.org Git - clang/commitdiff
Reduce double set lookups by using the result of insert.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 14 Oct 2013 15:16:10 +0000 (15:16 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 14 Oct 2013 15:16:10 +0000 (15:16 +0000)
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192598 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/VTableBuilder.cpp
lib/Sema/SemaDeclObjC.cpp

index 027735dff05121972fc658e9e32a4ee1bf9c88be..045b7f1a42d223b7471d08aad8c63eeda861bc03 100644 (file)
@@ -3151,9 +3151,8 @@ static void EnumerateVFPtrs(
     CharUnits NextBaseOffset;
     const CXXRecordDecl *NextLastVBase;
     if (I->isVirtual()) {
-      if (VisitedVBases.count(BaseDecl))
+      if (!VisitedVBases.insert(BaseDecl))
         continue;
-      VisitedVBases.insert(BaseDecl);
       NextBaseOffset = MostDerivedClassLayout.getVBaseClassOffset(BaseDecl);
       NextLastVBase = BaseDecl;
     } else {
index 14f8658face69fe63d73feb029f348de267c64e4..d2566589a5f959d126022439bf1739949f128dd5 100644 (file)
@@ -1733,9 +1733,8 @@ void Sema::MatchAllMethodDeclarations(const SelectorSet &InsMap,
   // implemented in the implementation class. If so, their types match.
   for (ObjCInterfaceDecl::instmeth_iterator I = CDecl->instmeth_begin(),
        E = CDecl->instmeth_end(); I != E; ++I) {
-    if (InsMapSeen.count((*I)->getSelector()))
-        continue;
-    InsMapSeen.insert((*I)->getSelector());
+    if (!InsMapSeen.insert((*I)->getSelector()))
+      continue;
     if (!(*I)->isPropertyAccessor() &&
         !InsMap.count((*I)->getSelector())) {
       if (ImmediateClass)
@@ -1762,11 +1761,11 @@ void Sema::MatchAllMethodDeclarations(const SelectorSet &InsMap,
 
   // Check and see if class methods in class interface have been
   // implemented in the implementation class. If so, their types match.
-   for (ObjCInterfaceDecl::classmeth_iterator
-       I = CDecl->classmeth_begin(), E = CDecl->classmeth_end(); I != E; ++I) {
-     if (ClsMapSeen.count((*I)->getSelector()))
-       continue;
-     ClsMapSeen.insert((*I)->getSelector());
+  for (ObjCInterfaceDecl::classmeth_iterator I = CDecl->classmeth_begin(),
+                                             E = CDecl->classmeth_end();
+       I != E; ++I) {
+    if (!ClsMapSeen.insert((*I)->getSelector()))
+      continue;
     if (!ClsMap.count((*I)->getSelector())) {
       if (ImmediateClass)
         WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl,