aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/RegionStore.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-05-08 23:40:38 +0000
committerAnna Zaks <ganna@apple.com>2012-05-08 23:40:38 +0000
commita8f2362307b436023095e66efd678ae591c02184 (patch)
treee77c621d4f259cdd3736819ba8372cc7634a8aa0 /lib/StaticAnalyzer/Core/RegionStore.cpp
parentb3198a841e7f356f171f1e11faff014b2deb1eb8 (diff)
[analyzer] We currently do not fully support CompoundLiterals in
RegionStore, so be explicit about it and generate UnknownVal(). This is a hack to ensure we never produce undefined values for a value coming from a compound value. (The undefined values can lead to false positives.) radar://10127782 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156446 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/RegionStore.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp
index 8b1371d28f..487327e7fc 100644
--- a/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -1152,7 +1152,16 @@ RegionStoreManager::GetLazyBinding(RegionBindings B, const MemRegion *R,
}
SVal RegionStoreManager::getBindingForElement(Store store,
- const ElementRegion* R) {
+ const ElementRegion* R) {
+ // We do not currently model bindings of the CompoundLiteralregion.
+ const ElementRegion *Tmp = R;
+ while (Tmp) {
+ const MemRegion *Sup = Tmp->getSuperRegion();
+ if (isa<CompoundLiteralRegion>(Sup))
+ return UnknownVal();
+ Tmp = dyn_cast<ElementRegion>(Sup);
+ }
+
// Check if the region has a binding.
RegionBindings B = GetRegionBindings(store);
if (const Optional<SVal> &V = getDirectBinding(B, R))