diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-07-29 00:28:47 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-07-29 00:28:47 +0000 |
commit | 385f71b1f4b685b676cec88b608446e41307b643 (patch) | |
tree | 3fa5f2b072976227f485d180e201f7494abd687f /clang/lib/Checker/RegionStore.cpp | |
parent | 7f904e8ad5c0d09a5bdc3b0e1f276866e6460c08 (diff) | |
download | bcm5719-llvm-385f71b1f4b685b676cec88b608446e41307b643.tar.gz bcm5719-llvm-385f71b1f4b685b676cec88b608446e41307b643.zip |
Augment RegionStore::BindStruct() to bind symbolicated struct values. This fixes a false path issue reported in <rdar://problem/8243408> and also spurs another cause where the idempotent operations checker fires.
llvm-svn: 109710
Diffstat (limited to 'clang/lib/Checker/RegionStore.cpp')
-rw-r--r-- | clang/lib/Checker/RegionStore.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Checker/RegionStore.cpp b/clang/lib/Checker/RegionStore.cpp index 74a7fee0488..7d708f88772 100644 --- a/clang/lib/Checker/RegionStore.cpp +++ b/clang/lib/Checker/RegionStore.cpp @@ -289,7 +289,7 @@ public: // Part of public interface to class. Store BindArray(Store store, const TypedRegion* R, SVal V); /// KillStruct - Set the entire struct to unknown. - Store KillStruct(Store store, const TypedRegion* R); + Store KillStruct(Store store, const TypedRegion* R, SVal DefaultVal); Store Remove(Store store, Loc LV); @@ -1560,10 +1560,11 @@ Store RegionStoreManager::BindStruct(Store store, const TypedRegion* R, if (const nonloc::LazyCompoundVal *LCV=dyn_cast<nonloc::LazyCompoundVal>(&V)) return CopyLazyBindings(*LCV, store, R); - // We may get non-CompoundVal accidentally due to imprecise cast logic. - // Ignore them and kill the field values. + // We may get non-CompoundVal accidentally due to imprecise cast logic or + // that we are binding symbolic struct value. Kill the field values, and if + // the value is symbolic go and bind it as a "default" binding. if (V.isUnknown() || !isa<nonloc::CompoundVal>(V)) - return KillStruct(store, R); + return KillStruct(store, R, isa<nonloc::SymbolVal>(V) ? V : UnknownVal()); nonloc::CompoundVal& CV = cast<nonloc::CompoundVal>(V); nonloc::CompoundVal::iterator VI = CV.begin(), VE = CV.end(); @@ -1596,14 +1597,15 @@ Store RegionStoreManager::BindStruct(Store store, const TypedRegion* R, return store; } -Store RegionStoreManager::KillStruct(Store store, const TypedRegion* R) { +Store RegionStoreManager::KillStruct(Store store, const TypedRegion* R, + SVal DefaultVal) { RegionBindings B = GetRegionBindings(store); llvm::OwningPtr<RegionStoreSubRegionMap> SubRegions(getRegionStoreSubRegionMap(store)); RemoveSubRegionBindings(B, R, *SubRegions); // Set the default value of the struct region to "unknown". - return Add(B, R, BindingKey::Default, UnknownVal()).getRoot(); + return Add(B, R, BindingKey::Default, DefaultVal).getRoot(); } Store RegionStoreManager::CopyLazyBindings(nonloc::LazyCompoundVal V, |