diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-23 09:02:15 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-23 09:02:15 +0000 |
commit | d91ee27950ef5c321db1ac2aa5becb75ffe7cb14 (patch) | |
tree | 6064163dc732234d6a2f17096178cf89442657d3 /lib/Analysis/RegionStore.cpp | |
parent | 2ace5cd1dc3340a4a12a3e0d3df51f094cbfde97 (diff) |
Move all factory methods from SVal to ValueManager. API cleanup!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73954 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r-- | lib/Analysis/RegionStore.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index f0374bd231..f76807beb2 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -513,7 +513,7 @@ SVal RegionStoreManager::getLValueElement(const GRState *St, if (OffI.isUnsigned()) { llvm::APSInt Tmp = OffI; Tmp.setIsSigned(true); - Offset = NonLoc::MakeVal(getBasicVals(), Tmp); + Offset = ValMgr.makeIntVal(Tmp); } } return loc::MemRegionVal(MRMgr.getElementRegion(elementType, Offset, @@ -547,7 +547,7 @@ SVal RegionStoreManager::getLValueElement(const GRState *St, Tmp.setIsSigned(true); Tmp += BaseIdxI; // Compute the new offset. - NewIdx = NonLoc::MakeVal(getBasicVals(), Tmp); + NewIdx = ValMgr.makeIntVal(Tmp); } else NewIdx = nonloc::ConcreteInt(getBasicVals().getValue(BaseIdxI + OffI)); @@ -572,7 +572,7 @@ SVal RegionStoreManager::getSizeInElements(const GRState *state, if (const ConstantArrayType* CAT = dyn_cast<ConstantArrayType>(T)) { // return the size as signed integer. - return NonLoc::MakeVal(getBasicVals(), CAT->getSize(), false); + return ValMgr.makeIntVal(CAT->getSize(), false); } const QualType* CastTy = state->get<RegionCasts>(VR); @@ -585,19 +585,19 @@ SVal RegionStoreManager::getSizeInElements(const GRState *state, uint64_t EleSize = getContext().getTypeSize(EleTy); uint64_t VarSize = getContext().getTypeSize(VarTy); assert(VarSize != 0); - return NonLoc::MakeIntVal(getBasicVals(), VarSize / EleSize, false); + return ValMgr.makeIntVal(VarSize/EleSize, false); } // Clients can use ordinary variables as if they were arrays. These // essentially are arrays of size 1. - return NonLoc::MakeIntVal(getBasicVals(), 1, false); + return ValMgr.makeIntVal(1, false); } if (const StringRegion* SR = dyn_cast<StringRegion>(R)) { const StringLiteral* Str = SR->getStringLiteral(); // We intentionally made the size value signed because it participates in // operations with signed indices. - return NonLoc::MakeIntVal(getBasicVals(), Str->getByteLength()+1, false); + return ValMgr.makeIntVal(Str->getByteLength()+1, false); } if (const FieldRegion* FR = dyn_cast<FieldRegion>(R)) { @@ -802,7 +802,7 @@ SVal RegionStoreManager::EvalBinOp(const GRState *state, const MemRegion* NewER = MRMgr.getElementRegion(ER->getElementType(), NewIdx,ER->getSuperRegion(), getContext()); - return Loc::MakeVal(NewER); + return ValMgr.makeLoc(NewER); } @@ -986,7 +986,7 @@ SVal RegionStoreManager::RetrieveStruct(const GRState *state, StructVal = getBasicVals().consVals(FieldValue, StructVal); } - return NonLoc::MakeCompoundVal(T, StructVal, getBasicVals()); + return ValMgr.makeCompoundVal(T, StructVal); } SVal RegionStoreManager::RetrieveArray(const GRState *state, @@ -1000,7 +1000,7 @@ SVal RegionStoreManager::RetrieveArray(const GRState *state, llvm::APSInt i = getBasicVals().getZeroWithPtrWidth(false); for (; i < Size; ++i) { - SVal Idx = NonLoc::MakeVal(getBasicVals(), i); + SVal Idx = ValMgr.makeIntVal(i); ElementRegion* ER = MRMgr.getElementRegion(CAT->getElementType(), Idx, R, getContext()); QualType ETy = ER->getElementType(); @@ -1008,7 +1008,7 @@ SVal RegionStoreManager::RetrieveArray(const GRState *state, ArrayVal = getBasicVals().consVals(ElementVal, ArrayVal); } - return NonLoc::MakeCompoundVal(T, ArrayVal, getBasicVals()); + return ValMgr.makeCompoundVal(T, ArrayVal); } //===----------------------------------------------------------------------===// @@ -1061,7 +1061,7 @@ const GRState *RegionStoreManager::BindDecl(const GRState *state, if (T->isStructureType()) return BindStruct(state, VR, InitVal); - return Bind(state, Loc::MakeVal(VR), InitVal); + return Bind(state, ValMgr.makeLoc(VR), InitVal); } // FIXME: this method should be merged into Bind(). @@ -1103,7 +1103,7 @@ const GRState *RegionStoreManager::BindArray(const GRState *state, SVal Idx = ValMgr.makeIntVal(i); ElementRegion* ER = MRMgr.getElementRegion(ElementTy, Idx,R,getContext()); - SVal V = NonLoc::MakeVal(getBasicVals(), str[j], sizeof(char)*8, true); + SVal V = ValMgr.makeIntVal(str[j], sizeof(char)*8, true); state = Bind(state, loc::MemRegionVal(ER), V); } @@ -1124,7 +1124,7 @@ const GRState *RegionStoreManager::BindArray(const GRState *state, if (CAT->getElementType()->isStructureType()) state = BindStruct(state, ER, *VI); else - state = Bind(state, Loc::MakeVal(ER), *VI); + state = Bind(state, ValMgr.makeLoc(ER), *VI); } // If the init list is shorter than the array length, bind the rest elements @@ -1134,7 +1134,7 @@ const GRState *RegionStoreManager::BindArray(const GRState *state, SVal Idx = ValMgr.makeIntVal(i); ElementRegion* ER = MRMgr.getElementRegion(ElementTy, Idx,R,getContext()); SVal V = ValMgr.makeZeroVal(ElementTy); - state = Bind(state, Loc::MakeVal(ER), V); + state = Bind(state, ValMgr.makeLoc(ER), V); ++i; } } @@ -1178,7 +1178,7 @@ RegionStoreManager::BindStruct(const GRState *state, const TypedRegion* R, FieldRegion* FR = MRMgr.getFieldRegion(*FI, R); if (Loc::IsLocType(FTy) || FTy->isIntegerType()) - state = Bind(state, Loc::MakeVal(FR), *VI); + state = Bind(state, ValMgr.makeLoc(FR), *VI); else if (FTy->isArrayType()) state = BindArray(state, FR, *VI); else if (FTy->isStructureType()) @@ -1190,7 +1190,7 @@ RegionStoreManager::BindStruct(const GRState *state, const TypedRegion* R, QualType FTy = (*FI)->getType(); if (FTy->isIntegerType()) { FieldRegion* FR = MRMgr.getFieldRegion(*FI, R); - state = Bind(state, Loc::MakeVal(FR), ValMgr.makeZeroVal(FTy)); + state = Bind(state, ValMgr.makeLoc(FR), ValMgr.makeZeroVal(FTy)); } ++FI; @@ -1213,7 +1213,7 @@ const GRState *RegionStoreManager::KillStruct(const GRState *state, const MemRegion* R = I.getKey(); if (const SubRegion* subRegion = dyn_cast<SubRegion>(R)) if (subRegion->isSubRegionOf(R)) - store = Remove(store, Loc::MakeVal(subRegion)); + store = Remove(store, ValMgr.makeLoc(subRegion)); // FIXME: Maybe we should also remove the bindings for the "views" of the // subregions. } @@ -1409,7 +1409,7 @@ Store RegionStoreManager::RemoveDeadBindings(const GRState *state, Stmt* Loc, continue; // Remove this dead region from the store. - store = Remove(store, Loc::MakeVal(R)); + store = Remove(store, ValMgr.makeLoc(R)); // Mark all non-live symbols that this region references as dead. if (const SymbolicRegion* SymR = dyn_cast<SymbolicRegion>(R)) |