diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-02-06 03:57:59 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-02-06 03:57:59 +0000 |
commit | 4dc1566a80648a74a19409c425809fa6a1683bef (patch) | |
tree | d4f568590cb20cea67057b241e032b2aff60c2d9 /lib/Checker | |
parent | eafd1d60fdf4ad076aae64d148046251344ffb13 (diff) |
Fix regression in RegionStore (from BasicStore) where static variables were not treated as being implicitly initialized to 0 (and instead were getting symbolicated).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95478 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker')
-rw-r--r-- | lib/Checker/RegionStore.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp index 341bfe7a72..2e212db3e6 100644 --- a/lib/Checker/RegionStore.cpp +++ b/lib/Checker/RegionStore.cpp @@ -1394,11 +1394,23 @@ SVal RegionStoreManager::RetrieveVar(Store store, const VarRegion *R) { // Lazily derive a value for the VarRegion. const VarDecl *VD = R->getDecl(); + QualType T = VD->getType(); + const MemSpaceRegion *MS = R->getMemorySpace(); + + if (isa<UnknownSpaceRegion>(MS) || + isa<StackArgumentsSpaceRegion>(MS)) + return ValMgr.getRegionValueSymbolVal(R, T); - if (R->hasGlobalsOrParametersStorage() || - isa<UnknownSpaceRegion>(R->getMemorySpace())) - return ValMgr.getRegionValueSymbolVal(R, VD->getType()); + if (isa<GlobalsSpaceRegion>(MS)) { + if (VD->isFileVarDecl()) + return ValMgr.getRegionValueSymbolVal(R, T); + if (T->isIntegerType()) + return ValMgr.makeIntVal(0, T); + + return UnknownVal(); + } + return UndefinedVal(); } |