[cfe-commits] r95539 - /cfe/trunk/lib/Checker/RegionStore.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Mon Feb 8 00:43:04 PST 2010
Author: zhongxingxu
Date: Mon Feb 8 02:43:02 2010
New Revision: 95539
URL: http://llvm.org/viewvc/llvm-project?rev=95539&view=rev
Log:
Like for symbolic region, automatically create a element zero region for
alloca region.
Modified:
cfe/trunk/lib/Checker/RegionStore.cpp
Modified: cfe/trunk/lib/Checker/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/RegionStore.cpp?rev=95539&r1=95538&r2=95539&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/RegionStore.cpp (original)
+++ cfe/trunk/lib/Checker/RegionStore.cpp Mon Feb 8 02:43:02 2010
@@ -354,8 +354,7 @@
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 @@
}
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 @@
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();
More information about the cfe-commits
mailing list