r192598 - Reduce double set lookups by using the result of insert.
Benjamin Kramer
benny.kra at googlemail.com
Mon Oct 14 08:16:10 PDT 2013
Author: d0k
Date: Mon Oct 14 10:16:10 2013
New Revision: 192598
URL: http://llvm.org/viewvc/llvm-project?rev=192598&view=rev
Log:
Reduce double set lookups by using the result of insert.
No functionality change.
Modified:
cfe/trunk/lib/AST/VTableBuilder.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=192598&r1=192597&r2=192598&view=diff
==============================================================================
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Mon Oct 14 10:16:10 2013
@@ -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 {
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=192598&r1=192597&r2=192598&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Oct 14 10:16:10 2013
@@ -1733,9 +1733,8 @@ void Sema::MatchAllMethodDeclarations(co
// 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(co
// 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,
More information about the cfe-commits
mailing list