Per conversations with Zhongxing, add an 'element type' to
ElementRegion. I also removed 'ElementRegion::getArrayRegion',
although we may need to add this back.
This breaks a few test cases with RegionStore:
- 'array-struct.c' triggers an infinite recursion in RegionStoreManager. Need to investigate.
- misc-ps.m triggers a failure with RegionStoreManager as we now get the diagnostic:
'Line 159: Uninitialized or undefined return value returned to caller.'
There were a bunch of places that needed to be edit
RegionStoreManager, and we may not be passing all the correct 'element
types' down from GRExprEngine.
Zhongxing: When you get a chance, could you review this? I could have
easily screwed up something basic in RegionStoreManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70830 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp
index 6f31e7a..e4ac6b9 100644
--- a/lib/Analysis/BasicStore.cpp
+++ b/lib/Analysis/BasicStore.cpp
@@ -79,7 +79,8 @@
const CompoundLiteralExpr* CL);
SVal getLValueIvar(const GRState* St, const ObjCIvarDecl* D, SVal Base);
SVal getLValueField(const GRState* St, SVal Base, const FieldDecl* D);
- SVal getLValueElement(const GRState* St, SVal Base, SVal Offset);
+ SVal getLValueElement(const GRState* St, QualType elementType,
+ SVal Base, SVal Offset);
/// ArrayToPointer - Used by GRExprEngine::VistCast to handle implicit
/// conversions between arrays and pointers.
@@ -193,8 +194,9 @@
return Loc::MakeVal(MRMgr.getFieldRegion(D, BaseR));
}
-SVal BasicStoreManager::getLValueElement(const GRState* St, SVal Base,
- SVal Offset) {
+SVal BasicStoreManager::getLValueElement(const GRState* St,
+ QualType elementType,
+ SVal Base, SVal Offset) {
if (Base.isUnknownOrUndef())
return Base;
@@ -246,7 +248,8 @@
}
if (BaseR)
- return Loc::MakeVal(MRMgr.getElementRegion(UnknownVal(), BaseR));
+ return Loc::MakeVal(MRMgr.getElementRegion(elementType, UnknownVal(),
+ BaseR));
else
return UnknownVal();
}