diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-28 13:59:24 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-28 13:59:24 +0000 |
commit | 6bd8a521aa0ed803b8f1b0aea8ea61460285fa0b (patch) | |
tree | e5de52cfc6394f6fb9d0287f6d2f224ab9bddde8 /lib/Analysis/CFRefCount.cpp | |
parent | 87453d1c39df791fb98618f6ba34b2edaae880e1 (diff) |
Invalidate a field of struct type by setting its default value to conjured
symbol.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index f4a28e0c19..1010b65209 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -2863,14 +2863,25 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst, // For now just handle scalar fields. FieldDecl *FD = *FI; QualType FT = FD->getType(); - + const FieldRegion* FR = MRMgr.getFieldRegion(FD, R); + if (Loc::IsLocType(FT) || (FT->isIntegerType() && FT->isScalarType())) { - const FieldRegion* FR = MRMgr.getFieldRegion(FD, R); - SVal V = ValMgr.getConjuredSymbolVal(*I, FT, Count); state = state->bindLoc(ValMgr.makeLoc(FR), V); - } + } + else if (FT->isStructureType()) { + // set the default value of the struct field to conjured + // symbol. Note that the type of the symbol is irrelavant. + // We cannot use the type of the struct otherwise ValMgr won't + // give us the conjured symbol. + StoreManager& StoreMgr = + Eng.getStateManager().getStoreManager(); + SVal V = ValMgr.getConjuredSymbolVal(*I, + Eng.getContext().IntTy, + Count); + state = StoreMgr.setDefaultValue(state, FR, V); + } } } else if (const ArrayType *AT = Ctx.getAsArrayType(T)) { // Set the default value of the array to conjured symbol. |