Finish the implementation of VisitCompoundLiteralExpr. As VisitInitListExpr is
available, things get much simplified.
One addition is that CompoundLiteralExpr can appear both in rvalue and lvalue
context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58837 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index 2000d80..20a8ae0 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -46,17 +46,12 @@
return Retrieve(St, loc::MemRegionVal(R));
}
- Store BindCompoundLiteral(Store store, const CompoundLiteralRegion* R,
- const SVal* BegInit, const SVal* EndInit) {
-
- // FIXME: Let's discuss how we want to do the mapping in RegionStore
- // from CompoundLiteralRegion to values.
- assert (false && "Not yet implemented.");
- return store;
- }
+ Store BindCompoundLiteral(Store store, const CompoundLiteralExpr* CL, SVal V);
SVal getLValueString(const GRState* St, const StringLiteral* S);
+ SVal getLValueCompoundLiteral(const GRState* St, const CompoundLiteralExpr*);
+
SVal getLValueVar(const GRState* St, const VarDecl* VD);
SVal getLValueIvar(const GRState* St, const ObjCIvarDecl* D, SVal Base);
@@ -137,7 +132,12 @@
SVal RegionStoreManager::getLValueVar(const GRState* St, const VarDecl* VD) {
return loc::MemRegionVal(MRMgr.getVarRegion(VD));
}
-
+
+SVal RegionStoreManager::getLValueCompoundLiteral(const GRState* St,
+ const CompoundLiteralExpr* CL) {
+ return loc::MemRegionVal(MRMgr.getCompoundLiteralRegion(CL));
+}
+
SVal RegionStoreManager::getLValueIvar(const GRState* St, const ObjCIvarDecl* D,
SVal Base) {
return UnknownVal();
@@ -424,6 +424,14 @@
return store;
}
+Store RegionStoreManager::BindCompoundLiteral(Store store,
+ const CompoundLiteralExpr* CL,
+ SVal V) {
+ CompoundLiteralRegion* R = MRMgr.getCompoundLiteralRegion(CL);
+ store = Bind(store, loc::MemRegionVal(R), V);
+ return store;
+}
+
void RegionStoreManager::print(Store store, std::ostream& Out,
const char* nl, const char *sep) {
llvm::raw_os_ostream OS(Out);