diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2008-11-07 10:38:33 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2008-11-07 10:38:33 +0000 |
commit | 2c677c34d5c5cd985ba730ed197772fc52089d49 (patch) | |
tree | 9ee9302c529eda85e0e9ed28e670237f962a34f2 /clang/lib/Analysis/RegionStore.cpp | |
parent | 7095cd2af2a301225b6ee3e55aac3a5f1629e142 (diff) | |
download | bcm5719-llvm-2c677c34d5c5cd985ba730ed197772fc52089d49.tar.gz bcm5719-llvm-2c677c34d5c5cd985ba730ed197772fc52089d49.zip |
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.
llvm-svn: 58837
Diffstat (limited to 'clang/lib/Analysis/RegionStore.cpp')
-rw-r--r-- | clang/lib/Analysis/RegionStore.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp index 2000d80ca52..20a8ae0d05c 100644 --- a/clang/lib/Analysis/RegionStore.cpp +++ b/clang/lib/Analysis/RegionStore.cpp @@ -46,17 +46,12 @@ public: 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::getLValueString(const GRState* St, 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 @@ Store RegionStoreManager::BindDecl(Store store, const VarDecl* VD, Expr* Ex, 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); |