forked from OSchip/llvm-project
Make BlockDataRegion::referenced_vars_iterator an actual class that enforces that all MemRegions iterated over are VarRegions.
llvm-svn: 90430
This commit is contained in:
parent
f05330a5c8
commit
4a815fc82e
|
@ -340,7 +340,31 @@ public:
|
|||
|
||||
const BlockTextRegion *getCodeRegion() const { return BC; }
|
||||
|
||||
typedef const MemRegion * const * referenced_vars_iterator;
|
||||
class referenced_vars_iterator {
|
||||
const MemRegion * const *R;
|
||||
public:
|
||||
explicit referenced_vars_iterator(const MemRegion * const *r) : R(r) {}
|
||||
|
||||
operator const MemRegion * const *() const {
|
||||
return R;
|
||||
}
|
||||
|
||||
const VarRegion* operator*() const {
|
||||
return cast<VarRegion>(*R);
|
||||
}
|
||||
|
||||
bool operator==(const referenced_vars_iterator &I) const {
|
||||
return I.R == R;
|
||||
}
|
||||
bool operator!=(const referenced_vars_iterator &I) const {
|
||||
return I.R != R;
|
||||
}
|
||||
referenced_vars_iterator& operator++() {
|
||||
++R;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
referenced_vars_iterator referenced_vars_begin() const;
|
||||
referenced_vars_iterator referenced_vars_end() const;
|
||||
|
||||
|
|
|
@ -573,7 +573,8 @@ BlockDataRegion::referenced_vars_begin() const {
|
|||
BumpVector<const MemRegion*> *Vec =
|
||||
static_cast<BumpVector<const MemRegion*>*>(ReferencedVars);
|
||||
|
||||
return Vec == (void*) 0x1 ? NULL : Vec->begin();
|
||||
return BlockDataRegion::referenced_vars_iterator(Vec == (void*) 0x1 ?
|
||||
NULL : Vec->begin());
|
||||
}
|
||||
|
||||
BlockDataRegion::referenced_vars_iterator
|
||||
|
@ -583,5 +584,6 @@ BlockDataRegion::referenced_vars_end() const {
|
|||
BumpVector<const MemRegion*> *Vec =
|
||||
static_cast<BumpVector<const MemRegion*>*>(ReferencedVars);
|
||||
|
||||
return Vec == (void*) 0x1 ? NULL : Vec->end();
|
||||
return BlockDataRegion::referenced_vars_iterator(Vec == (void*) 0x1 ?
|
||||
NULL : Vec->end());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue