diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-01-23 11:22:12 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-01-23 11:22:12 +0000 |
commit | 562c4d90418996c927f43e89250570d9967d6ecc (patch) | |
tree | f36816cd229283bd25bb38d4482b811c9db88a3c /lib/Analysis/RegionStore.cpp | |
parent | cbb0b473034bf87ca75ac659dc6dbffe52f3125f (diff) |
Implement retrieval of the default value of element and field regions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62847 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r-- | lib/Analysis/RegionStore.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 2e82cc665c..f519d4d1cd 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -576,6 +576,15 @@ SVal RegionStoreManager::Retrieve(const GRState* St, Loc L, QualType T) { if (state.contains<RegionKills>(R)) return UnknownVal(); + // If the region is an element of field, it may have a default value. + if (isa<ElementRegion>(R) || isa<FieldRegion>(R)) { + const MemRegion* SuperR = cast<SubRegion>(R)->getSuperRegion(); + GRStateTrait<RegionDefaultValue>::lookup_type D = + state.get<RegionDefaultValue>(SuperR); + if (D) + return *D; + } + // The location does not have a bound value. This means that it has // the value it had upon its creation and/or entry to the analyzed // function/method. These are either symbolic values or 'undefined'. |