Fix <rdar://problem/6611677>: Add basic transfer function support in the static
analyzer for array subscript expressions involving bases that are vectors. This
solution is probably a hack: it gets the lvalue of the vector instead of an
rvalue like all other types. This should be reviewed (big FIXME in
GRExprEngine).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65366 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index e2a1d36..c61094c 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -591,9 +591,14 @@
//
// Such funny addressing will occur due to layering of regions.
- if (const TypedRegion* TR = dyn_cast<TypedRegion>(R))
- if (TR->getRValueType(getContext())->isStructureType())
+ if (const TypedRegion* TR = dyn_cast<TypedRegion>(R)) {
+ QualType T =TR->getRValueType(getContext());
+ if (T->isStructureType())
return RetrieveStruct(St, TR);
+ // FIXME: handle Vector types.
+ if (T->isVectorType())
+ return UnknownVal();
+ }
RegionBindingsTy B = GetRegionBindings(St->getStore());
RegionBindingsTy::data_type* V = B.lookup(R);
@@ -636,6 +641,7 @@
return loc::MemRegionVal(getSelfRegion(0));
}
+
if (MRMgr.onStack(R) || MRMgr.onHeap(R)) {
// All stack variables are considered to have undefined values
// upon creation. All heap allocated blocks are considered to