// Methods that manipulate the GDM.
const GRState* addGDM(const GRState* St, void* Key, void* Data);
- // Methods that query or create regions.
- bool hasStackStorage(const MemRegion* R) {
- return getRegionManager().hasStackStorage(R);
- }
-
// Methods that query & manipulate the Store.
void iterBindings(const GRState* state, StoreManager::BindingsHandler& F) {
virtual MemRegionManager* getMemRegionManager() const = 0;
std::string getString() const;
+
+ bool hasStackStorage() const;
+
+ bool hasHeapStorage() const;
virtual void print(llvm::raw_ostream& os) const;
assert(R);
return R == globals;
}
-
- bool hasStackStorage(const MemRegion* R);
-
- bool hasHeapStorage(const MemRegion* R);
private:
MemSpaceRegion* LazyAllocate(MemSpaceRegion*& region);
escapes = true;
else {
const MemRegion* R = cast<loc::MemRegionVal>(location).getRegion();
- escapes = !B.getStateManager().hasStackStorage(R);
+ escapes = !R->hasStackStorage();
if (!escapes) {
// To test (3), generate a new state with the binding removed. If it is
// Determine if the value is on the stack.
const MemRegion* R = cast<loc::MemRegionVal>(&X)->getRegion();
- if (R && getStateManager().hasStackStorage(R)) {
+ if (R && R->hasStackStorage()) {
// Create a special node representing the error.
if (NodeTy* N = Builder->generateNode(S, GetState(*I), *I)) {
N->markAsSink();
return getRegion<AllocaRegion>(E, cnt);
}
-bool MemRegionManager::hasStackStorage(const MemRegion* R) {
+bool MemRegion::hasStackStorage() const {
// Only subregions can have stack storage.
- const SubRegion* SR = dyn_cast<SubRegion>(R);
+ const SubRegion* SR = dyn_cast<SubRegion>(this);
if (!SR)
return false;
- MemSpaceRegion* S = getStackRegion();
+ MemSpaceRegion* S = getMemRegionManager()->getStackRegion();
while (SR) {
- R = SR->getSuperRegion();
+ const MemRegion *R = SR->getSuperRegion();
if (R == S)
return true;
return false;
}
-bool MemRegionManager::hasHeapStorage(const MemRegion* R) {
+bool MemRegion::hasHeapStorage() const {
// Only subregions can have stack storage.
- const SubRegion* SR = dyn_cast<SubRegion>(R);
+ const SubRegion* SR = dyn_cast<SubRegion>(this);
if (!SR)
return false;
- MemSpaceRegion* H = getHeapRegion();
+ MemSpaceRegion* H = getMemRegionManager()->getHeapRegion();
while (SR) {
- R = SR->getSuperRegion();
+ const MemRegion *R = SR->getSuperRegion();
if (R == H)
return true;
}
}
- if (MRMgr.hasStackStorage(R) || MRMgr.hasHeapStorage(R)) {
+ if (R->hasStackStorage() || R->hasHeapStorage()) {
// All stack variables are considered to have undefined values
// upon creation. All heap allocated blocks are considered to
// have undefined values as well unless they are explicitly bound