aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/Store.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-11-16 04:49:44 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-11-16 04:49:44 +0000
commit652be346f74feba027bcbdeb6a3e3f4755a0e62c (patch)
tree7ac0e7954d742066961437ffac9fa882da4a7dca /lib/Analysis/Store.cpp
parent7f92f0362ef2cf218bc19bb83e1a97dd254b5527 (diff)
* Do the same thing to the basicstore as in r84163.
* Add a load type to GRExprEngine::EvalLoad(). * When retrieve from 'theValue' of OSAtomic funcitions, use the type of the region instead of the argument expression as the load type. * Then we can convert CastRetrievedSVal to a pure assertion. In the future we can let all Retrieve() methods simply return SVal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88888 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/Store.cpp')
-rw-r--r--lib/Analysis/Store.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp
index 16af1be91e..afe2b4e7bd 100644
--- a/lib/Analysis/Store.cpp
+++ b/lib/Analysis/Store.cpp
@@ -21,7 +21,7 @@ StoreManager::StoreManager(GRStateManager &stateMgr)
MRMgr(ValMgr.getRegionManager()) {}
const MemRegion *StoreManager::MakeElementRegion(const MemRegion *Base,
- QualType EleTy, uint64_t index) {
+ QualType EleTy, uint64_t index) {
SVal idx = ValMgr.makeArrayIndex(index);
return MRMgr.getElementRegion(EleTy, idx, Base, ValMgr.getContext());
}
@@ -192,14 +192,16 @@ const MemRegion *StoreManager::CastRegion(const MemRegion *R, QualType CastToTy)
/// CastRetrievedVal - Used by subclasses of StoreManager to implement
/// implicit casts that arise from loads from regions that are reinterpreted
/// as another region.
-SValuator::CastResult StoreManager::CastRetrievedVal(SVal V,
- const GRState *state,
- const TypedRegion *R,
- QualType castTy) {
+SVal StoreManager::CastRetrievedVal(SVal V, const TypedRegion *R,
+ QualType castTy) {
+ ASTContext &Ctx = ValMgr.getContext();
+
if (castTy.isNull())
- return SValuator::CastResult(state, V);
+ return V;
+
+ assert(Ctx.getCanonicalType(castTy).getUnqualifiedType() ==
+ Ctx.getCanonicalType(R->getValueType(Ctx)).getUnqualifiedType());
- ASTContext &Ctx = ValMgr.getContext();
- return ValMgr.getSValuator().EvalCast(V, state, castTy, R->getValueType(Ctx));
+ return V;
}