diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-04-30 02:36:29 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-04-30 02:36:29 +0000 |
commit | 262bc18e32500558af7cb0afa205b34bd37bafed (patch) | |
tree | 6948b171ad9895169475e9f5808700781231a710 /lib/StaticAnalyzer | |
parent | 298038352b34c5503db418201f3ddea6e56fd0e1 (diff) |
Remove the ref/value inconsistency in filter_decl_iterator.
filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.
This change errs on the side of value, making op-> return T* and op* return
T&.
(reviewed by Richard Smith)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155808 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp | 6 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp | 10 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp | 4 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp | 4 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Core/MemRegion.cpp | 2 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Core/RegionStore.cpp | 6 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp | 4 |
7 files changed, 18 insertions, 18 deletions
diff --git a/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp b/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp index f6014317c8..2c7c951f40 100644 --- a/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp @@ -144,9 +144,9 @@ bool CallAndMessageChecker::PreVisitProcessArg(CheckerContext &C, assert(RD && "Referred record has no definition"); for (RecordDecl::field_iterator I = RD->field_begin(), E = RD->field_end(); I!=E; ++I) { - const FieldRegion *FR = MrMgr.getFieldRegion(*I, R); - FieldChain.push_back(*I); - T = (*I)->getType(); + const FieldRegion *FR = MrMgr.getFieldRegion(&*I, R); + FieldChain.push_back(&*I); + T = I->getType(); if (T->getAsStructureType()) { if (Find(FR)) return true; diff --git a/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp index 133204a6d3..81b548b13f 100644 --- a/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp +++ b/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp @@ -114,7 +114,7 @@ static void checkObjCDealloc(const ObjCImplementationDecl *D, for (ObjCInterfaceDecl::ivar_iterator I=ID->ivar_begin(), E=ID->ivar_end(); I!=E; ++I) { - ObjCIvarDecl *ID = *I; + ObjCIvarDecl *ID = &*I; QualType T = ID->getType(); if (!T->isObjCObjectPointerType() || @@ -215,10 +215,10 @@ static void checkObjCDealloc(const ObjCImplementationDecl *D, E = D->propimpl_end(); I!=E; ++I) { // We can only check the synthesized properties - if ((*I)->getPropertyImplementation() != ObjCPropertyImplDecl::Synthesize) + if (I->getPropertyImplementation() != ObjCPropertyImplDecl::Synthesize) continue; - ObjCIvarDecl *ID = (*I)->getPropertyIvarDecl(); + ObjCIvarDecl *ID = I->getPropertyIvarDecl(); if (!ID) continue; @@ -226,7 +226,7 @@ static void checkObjCDealloc(const ObjCImplementationDecl *D, if (!T->isObjCObjectPointerType()) // Skip non-pointer ivars continue; - const ObjCPropertyDecl *PD = (*I)->getPropertyDecl(); + const ObjCPropertyDecl *PD = I->getPropertyDecl(); if (!PD) continue; @@ -261,7 +261,7 @@ static void checkObjCDealloc(const ObjCImplementationDecl *D, } PathDiagnosticLocation SDLoc = - PathDiagnosticLocation::createBegin((*I), BR.getSourceManager()); + PathDiagnosticLocation::createBegin(&*I, BR.getSourceManager()); BR.EmitBasicReport(MD, name, categories::CoreFoundationObjectiveC, os.str(), SDLoc); diff --git a/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp b/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp index 757a4ce288..7e5720deac 100644 --- a/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp @@ -231,7 +231,7 @@ static void CheckASTMemory(const CXXRecordDecl *R, BugReporter &BR) { for (RecordDecl::field_iterator I = R->field_begin(), E = R->field_end(); I != E; ++I) { ASTFieldVisitor walker(R, BR); - walker.Visit(*I); + walker.Visit(&*I); } } @@ -247,7 +247,7 @@ void ASTFieldVisitor::Visit(FieldDecl *D) { const RecordDecl *RD = RT->getDecl()->getDefinition(); for (RecordDecl::field_iterator I = RD->field_begin(), E = RD->field_end(); I != E; ++I) - Visit(*I); + Visit(&*I); } FieldChain.pop_back(); diff --git a/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp b/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp index 4718dc7c7a..ea6f8e109b 100644 --- a/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp @@ -76,7 +76,7 @@ static void Scan(IvarUsageMap& M, const ObjCContainerDecl *D) { // to an ivar. for (ObjCImplementationDecl::propimpl_iterator I = ID->propimpl_begin(), E = ID->propimpl_end(); I!=E; ++I) - Scan(M, *I); + Scan(M, &*I); // Scan the associated categories as well. for (const ObjCCategoryDecl *CD = @@ -109,7 +109,7 @@ static void checkObjCUnusedIvar(const ObjCImplementationDecl *D, for (ObjCInterfaceDecl::ivar_iterator I=ID->ivar_begin(), E=ID->ivar_end(); I!=E; ++I) { - const ObjCIvarDecl *ID = *I; + const ObjCIvarDecl *ID = &*I; // Ignore ivars that... // (a) aren't private diff --git a/lib/StaticAnalyzer/Core/MemRegion.cpp b/lib/StaticAnalyzer/Core/MemRegion.cpp index ed94c79df1..1969ebd435 100644 --- a/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -1016,7 +1016,7 @@ RegionOffset MemRegion::getAsOffset() const { unsigned idx = 0; for (RecordDecl::field_iterator FI = RD->field_begin(), FE = RD->field_end(); FI != FE; ++FI, ++idx) - if (FR->getDecl() == *FI) + if (FR->getDecl() == &*FI) break; const ASTRecordLayout &Layout = getContext().getASTRecordLayout(RD); diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp index e849333f94..d5db03d7ce 100644 --- a/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -1646,11 +1646,11 @@ StoreRef RegionStoreManager::BindStruct(Store store, const TypedValueRegion* R, break; // Skip any unnamed bitfields to stay in sync with the initializers. - if ((*FI)->isUnnamedBitfield()) + if (FI->isUnnamedBitfield()) continue; - QualType FTy = (*FI)->getType(); - const FieldRegion* FR = MRMgr.getFieldRegion(*FI, R); + QualType FTy = FI->getType(); + const FieldRegion* FR = MRMgr.getFieldRegion(&*FI, R); if (FTy->isArrayType()) newStore = BindArray(newStore.getStore(), FR, *VI); diff --git a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp index d0558f1af4..45be5db10c 100644 --- a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp +++ b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp @@ -845,9 +845,9 @@ SVal SimpleSValBuilder::evalBinOpLL(ProgramStateRef state, bool leftFirst = (op == BO_LT || op == BO_LE); for (RecordDecl::field_iterator I = RD->field_begin(), E = RD->field_end(); I!=E; ++I) { - if (*I == LeftFD) + if (&*I == LeftFD) return makeTruthVal(leftFirst, resultTy); - if (*I == RightFD) + if (&*I == RightFD) return makeTruthVal(!leftFirst, resultTy); } |