diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-02-08 08:43:02 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-02-08 08:43:02 +0000 |
commit | 81491854222ad25953a643ce8efa0d6ea295ccfe (patch) | |
tree | f94c071210af1b013d823ad0d0691517760c1559 /lib/Checker/RegionStore.cpp | |
parent | 52535688b1339e0b3898ac0d670052482851a3ab (diff) |
Like for symbolic region, automatically create a element zero region for
alloca region.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/RegionStore.cpp')
-rw-r--r-- | lib/Checker/RegionStore.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp index 93905a29da..c08be0cff6 100644 --- a/lib/Checker/RegionStore.cpp +++ b/lib/Checker/RegionStore.cpp @@ -354,8 +354,7 @@ public: // Part of public interface to class. Store CopyLazyBindings(nonloc::LazyCompoundVal V, Store store, const TypedRegion *R); - const ElementRegion *GetElementZeroRegion(const SymbolicRegion *SR, - QualType T); + const ElementRegion *GetElementZeroRegion(const MemRegion *R, QualType T); //===------------------------------------------------------------------===// // State pruning. @@ -927,11 +926,11 @@ static bool IsReinterpreted(QualType RTy, QualType UsedTy, ASTContext &Ctx) { } const ElementRegion * -RegionStoreManager::GetElementZeroRegion(const SymbolicRegion *SR, QualType T) { +RegionStoreManager::GetElementZeroRegion(const MemRegion *R, QualType T) { ASTContext &Ctx = getContext(); SVal idx = ValMgr.makeZeroArrayIndex(); assert(!T.isNull()); - return MRMgr.getElementRegion(T, idx, SR, Ctx); + return MRMgr.getElementRegion(T, idx, R, Ctx); } SVal RegionStoreManager::Retrieve(Store store, Loc L, QualType T) { @@ -945,17 +944,8 @@ SVal RegionStoreManager::Retrieve(Store store, Loc L, QualType T) { const MemRegion *MR = cast<loc::MemRegionVal>(L).getRegion(); - // FIXME: return symbolic value for these cases. - // Example: - // void f(int* p) { int x = *p; } - // char* p = alloca(); - // read(p); - // c = *p; - if (isa<AllocaRegion>(MR)) - return UnknownVal(); - - if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(MR)) - MR = GetElementZeroRegion(SR, T); + if (isa<AllocaRegion>(MR) || isa<SymbolicRegion>(MR)) + MR = GetElementZeroRegion(MR, T); if (isa<CodeTextRegion>(MR)) return UnknownVal(); |