Only provide explicit getCapturedRegion() and getOriginalRegion() from referenced_vars_iterator.

This is a nice conceptual cleanup.

llvm-svn: 169480
This commit is contained in:
Ted Kremenek 2012-12-06 07:17:20 +00:00
parent ff989016c1
commit bcf905326c
5 changed files with 9 additions and 17 deletions

View File

@ -642,22 +642,14 @@ public:
explicit referenced_vars_iterator(const MemRegion * const *r,
const MemRegion * const *originalR)
: R(r), OriginalR(originalR) {}
operator const MemRegion * const *() const {
return R;
}
const MemRegion *getCapturedRegion() const {
return *R;
}
const MemRegion *getOriginalRegion() const {
return *OriginalR;
}
const VarRegion* operator*() const {
const VarRegion *getCapturedRegion() const {
return cast<VarRegion>(*R);
}
const VarRegion *getOriginalRegion() const {
return cast<VarRegion>(*OriginalR);
}
bool operator==(const referenced_vars_iterator &I) const {
return I.R == R;
}

View File

@ -1204,7 +1204,7 @@ void MallocChecker::checkPostStmt(const BlockExpr *BE,
MemRegionManager &MemMgr = C.getSValBuilder().getRegionManager();
for ( ; I != E; ++I) {
const VarRegion *VR = *I;
const VarRegion *VR = I.getCapturedRegion();
if (VR->getSuperRegion() == R) {
VR = MemMgr.getVarRegion(VR->getDecl(), LC);
}

View File

@ -2602,7 +2602,7 @@ void RetainCountChecker::checkPostStmt(const BlockExpr *BE,
MemRegionManager &MemMgr = C.getSValBuilder().getRegionManager();
for ( ; I != E; ++I) {
const VarRegion *VR = *I;
const VarRegion *VR = I.getCapturedRegion();
if (VR->getSuperRegion() == R) {
VR = MemMgr.getVarRegion(VR->getDecl(), LC);
}

View File

@ -68,7 +68,7 @@ UndefCapturedBlockVarChecker::checkPostStmt(const BlockExpr *BE,
for (; I != E; ++I) {
// This VarRegion is the region associated with the block; we need
// the one associated with the encompassing context.
const VarRegion *VR = *I;
const VarRegion *VR = I.getCapturedRegion();
const VarDecl *VD = VR->getDecl();
if (VD->getAttr<BlocksAttr>() || !VD->hasLocalStorage())

View File

@ -740,7 +740,7 @@ void invalidateRegionsWorker::VisitBaseRegion(const MemRegion *baseR) {
for (BlockDataRegion::referenced_vars_iterator
BI = BR->referenced_vars_begin(), BE = BR->referenced_vars_end() ;
BI != BE; ++BI) {
const VarRegion *VR = *BI;
const VarRegion *VR = BI.getCapturedRegion();
const VarDecl *VD = VR->getDecl();
if (VD->getAttr<BlocksAttr>() || !VD->hasLocalStorage()) {
AddToWorkList(VR);