From: Zhongxing Xu Date: Thu, 16 Oct 2008 06:09:51 +0000 (+0000) Subject: This is the first step to build a better evaluation model for GRExprEngine. A X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d69b5d82281992e981caa9bc038e3f6cac6594a;p=clang This is the first step to build a better evaluation model for GRExprEngine. A new VisitLValue method is added to replace the old VisitLVal. The semantics model becomes more explicit to separate rvalue evaluation from lvalue evaluation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57627 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/Environment.h b/include/clang/Analysis/PathSensitive/Environment.h index 8e1b97a3be..f1556a9be2 100644 --- a/include/clang/Analysis/PathSensitive/Environment.h +++ b/include/clang/Analysis/PathSensitive/Environment.h @@ -73,6 +73,9 @@ public: } RVal GetRVal(Expr* Ex, BasicValueFactory& BasicVals) const; + RVal GetRVal(const Expr* Ex, BasicValueFactory& BasicVals) const { + return GetRVal(const_cast(Ex), BasicVals); + } RVal GetBlkExprRVal(Expr* Ex, BasicValueFactory& BasicVals) const; /// Profile - Profile the contents of an Environment object for use diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h index 0bcc13781f..8a4f9cd6c9 100644 --- a/include/clang/Analysis/PathSensitive/GRExprEngine.h +++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h @@ -439,6 +439,11 @@ protected: RVal GetRVal(const GRState* St, LVal LV, QualType T = QualType()) { return StateMgr.GetRVal(St, LV, T); } + + // Get the lvalue of an expression. + RVal GetLValue(const GRState* St, const Expr* Ex) { + return StateMgr.GetLValue(St, Ex); + } inline NonLVal MakeConstantVal(uint64_t X, Expr* Ex) { return NonLVal::MakeVal(getBasicVals(), X, Ex->getType()); @@ -466,16 +471,14 @@ protected: /// other functions that handle specific kinds of statements. void Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst); - /// VisitLVal - Similar to Visit, but the specified expression is assummed - /// to be evaluated under the context where it evaluates to an LVal. For - /// example, if Ex is a DeclRefExpr, under Visit Ex would evaluate to the - /// value bound to Ex in the symbolic state, while under VisitLVal it would - /// evaluate to an LVal representing the location of the referred Decl. - void VisitLVal(Expr* Ex, NodeTy* Pred, NodeSet& Dst); + /// VisitLValue - Evaluate the lvalue of the expression. For example, if Ex is + /// a DeclRefExpr, it evaluates to the MemRegionVal which represents its + /// storage location. Note that not all kinds of expressions has lvalue. + void VisitLValue(Expr* Ex, NodeTy* Pred, NodeSet& Dst); /// VisitArraySubscriptExpr - Transfer function for array accesses. void VisitArraySubscriptExpr(ArraySubscriptExpr* Ex, NodeTy* Pred, - NodeSet& Dst, bool asLVal); + NodeSet& Dst, bool asLValue); /// VisitAsmStmt - Transfer function logic for inline asm. void VisitAsmStmt(AsmStmt* A, NodeTy* Pred, NodeSet& Dst); @@ -500,11 +503,11 @@ protected: NodeSet& Dst); /// VisitCast - Transfer function logic for all casts (implicit and explicit). - void VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst); + void VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst); /// VisitDeclRefExpr - Transfer function logic for DeclRefExprs. void VisitDeclRefExpr(DeclRefExpr* DR, NodeTy* Pred, NodeSet& Dst, - bool asLval); + bool asLValue); /// VisitDeclStmt - Transfer function logic for DeclStmts. void VisitDeclStmt(DeclStmt* DS, NodeTy* Pred, NodeSet& Dst); @@ -516,7 +519,7 @@ protected: void VisitLogicalExpr(BinaryOperator* B, NodeTy* Pred, NodeSet& Dst); /// VisitMemberExpr - Transfer function for member expressions. - void VisitMemberExpr(MemberExpr* M, NodeTy* Pred, NodeSet& Dst, bool asLVal); + void VisitMemberExpr(MemberExpr* M, NodeTy* Pred, NodeSet& Dst,bool asLValue); /// VisitObjCMessageExpr - Transfer function for ObjC message expressions. void VisitObjCMessageExpr(ObjCMessageExpr* ME, NodeTy* Pred, NodeSet& Dst); @@ -538,7 +541,7 @@ protected: /// VisitUnaryOperator - Transfer function logic for unary operators. void VisitUnaryOperator(UnaryOperator* B, NodeTy* Pred, NodeSet& Dst, - bool asLVal); + bool asLValue); bool CheckDivideZero(Expr* Ex, const GRState* St, NodeTy* Pred, RVal Denom); diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h index 54731b27b8..130160c4ed 100644 --- a/include/clang/Analysis/PathSensitive/GRState.h +++ b/include/clang/Analysis/PathSensitive/GRState.h @@ -234,7 +234,7 @@ class GRStateManager { private: EnvironmentManager EnvMgr; - llvm::OwningPtr StMgr; + llvm::OwningPtr StoreMgr; llvm::OwningPtr ConstraintMgr; GRState::IntSetTy::Factory ISetFactory; @@ -303,7 +303,7 @@ public: Alloc(alloc), cfg(c), Liveness(L) { - StMgr.reset((*CreateStoreManager)(*this)); + StoreMgr.reset((*CreateStoreManager)(*this)); ConstraintMgr.reset((*CreateConstraintManager)(*this)); } @@ -317,7 +317,7 @@ public: SymbolManager& getSymbolManager() { return SymMgr; } LiveVariables& getLiveVariables() { return Liveness; } llvm::BumpPtrAllocator& getAllocator() { return Alloc; } - MemRegionManager& getRegionManager() { return StMgr->getRegionManager(); } + MemRegionManager& getRegionManager() { return StoreMgr->getRegionManager(); } typedef StoreManager::DeadSymbolsTy DeadSymbolsTy; @@ -342,14 +342,25 @@ public: } LVal getLVal(const VarDecl* D) { - return StMgr->getLVal(D); + return StoreMgr->getLVal(D); } - + + // Get the lvalue of expression. + RVal GetLValue(const GRState* St, const Expr* Ex) { + // Forward to store manager. The lvalue of an expression is determined by + // the store manager. + return StoreMgr->getLValue(St, Ex); + } + // Methods that query & manipulate the Environment. RVal GetRVal(const GRState* St, Expr* Ex) { return St->getEnvironment().GetRVal(Ex, BasicVals); } + + RVal GetRVal(const GRState* St, const Expr* Ex) { + return St->getEnvironment().GetRVal(Ex, BasicVals); + } RVal GetBlkExprRVal(const GRState* St, Expr* Ex) { return St->getEnvironment().GetBlkExprRVal(Ex, BasicVals); @@ -397,22 +408,22 @@ public: // Methods that query & manipulate the Store. void iterBindings(const GRState* state, StoreManager::BindingsHandler& F) { - StMgr->iterBindings(state->getStore(), F); + StoreMgr->iterBindings(state->getStore(), F); } RVal GetRVal(const GRState* St, LVal LV, QualType T = QualType()) { - return StMgr->GetRVal(St->getStore(), LV, T); + return StoreMgr->GetRVal(St->getStore(), LV, T); } void SetRVal(GRState& St, LVal LV, RVal V) { - St.St = StMgr->SetRVal(St.St, LV, V); + St.St = StoreMgr->SetRVal(St.St, LV, V); } const GRState* SetRVal(const GRState* St, LVal LV, RVal V); void Unbind(GRState& St, LVal LV) { - St.St = StMgr->Remove(St.St, LV); + St.St = StoreMgr->Remove(St.St, LV); } const GRState* Unbind(const GRState* St, LVal LV); diff --git a/include/clang/Analysis/PathSensitive/Store.h b/include/clang/Analysis/PathSensitive/Store.h index 060bce5992..b6c9c5d302 100644 --- a/include/clang/Analysis/PathSensitive/Store.h +++ b/include/clang/Analysis/PathSensitive/Store.h @@ -24,10 +24,12 @@ namespace clang { typedef const void* Store; - + +class GRState; class GRStateManager; class LiveVariables; class Stmt; +class Expr; class MemRegion; class MemRegionManager; @@ -43,6 +45,10 @@ public: virtual Store getInitialStore() = 0; virtual MemRegionManager& getRegionManager() = 0; virtual LVal getLVal(const VarDecl* VD) = 0; + + // Get the lvalue of an expression. + virtual RVal getLValue(const GRState* St, const Expr* Ex) = 0; + virtual Store RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live, llvm::SmallVectorImpl& RegionRoots, diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp index 47e2905e02..f97f8b2c29 100644 --- a/lib/Analysis/BasicStore.cpp +++ b/lib/Analysis/BasicStore.cpp @@ -42,9 +42,12 @@ public: virtual MemRegionManager& getRegionManager() { return MRMgr; } + // FIXME: Investigate what is using this. This method should be removed. virtual LVal getLVal(const VarDecl* VD) { return lval::MemRegionVal(MRMgr.getVarRegion(VD)); } + + virtual RVal getLValue(const GRState* St, const Expr* Ex); virtual Store RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live, @@ -73,6 +76,35 @@ StoreManager* clang::CreateBasicStoreManager(GRStateManager& StMgr) { return new BasicStoreManager(StMgr); } +// FIXME: replace ArrayOffset and FieldOffset with some region value. +RVal BasicStoreManager::getLValue(const GRState* St, const Expr* Ex) { + if (const DeclRefExpr* DRE = dyn_cast(Ex)) { + const VarDecl* VD = cast(DRE->getDecl()); + QualType T = VD->getType(); + + // Array and struct variable have no lvalue. + assert(!T->isArrayType()); + + return lval::MemRegionVal(MRMgr.getVarRegion(VD)); + + } else if (const ArraySubscriptExpr* A = dyn_cast(Ex)) { + const Expr* Base = A->getBase()->IgnoreParens(); + const Expr* Idx = A->getIdx()->IgnoreParens(); + RVal BaseV = StateMgr.GetRVal(St, Base); + RVal IdxV = StateMgr.GetRVal(St, Idx); + return lval::ArrayOffset::Make(StateMgr.getBasicVals(), BaseV, IdxV); + + } else if (const MemberExpr* M = dyn_cast(Ex)) { + Expr* Base = M->getBase()->IgnoreParens(); + RVal BaseV = StateMgr.GetRVal(St, Base); + return lval::FieldOffset::Make(StateMgr.getBasicVals(), BaseV, + M->getMemberDecl()); + } else { + Ex->dump(); + assert(0); + } +} + RVal BasicStoreManager::GetRVal(Store St, LVal LV, QualType T) { if (isa(LV)) diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index c391c6f378..2d241344af 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -395,7 +395,7 @@ void GRExprEngine::Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst) { } } -void GRExprEngine::VisitLVal(Expr* Ex, NodeTy* Pred, NodeSet& Dst) { +void GRExprEngine::VisitLValue(Expr* Ex, NodeTy* Pred, NodeSet& Dst) { Ex = Ex->IgnoreParens(); @@ -406,8 +406,8 @@ void GRExprEngine::VisitLVal(Expr* Ex, NodeTy* Pred, NodeSet& Dst) { switch (Ex->getStmtClass()) { default: - Visit(Ex, Pred, Dst); - return; + Ex->dump(); + assert(0 && "Other kinds of expressions do not have lvalue."); case Stmt::ArraySubscriptExprClass: VisitArraySubscriptExpr(cast(Ex), Pred, Dst, true); @@ -788,59 +788,79 @@ void GRExprEngine::VisitLogicalExpr(BinaryOperator* B, NodeTy* Pred, // Transfer functions: Loads and stores. //===----------------------------------------------------------------------===// -void GRExprEngine::VisitDeclRefExpr(DeclRefExpr* D, NodeTy* Pred, NodeSet& Dst, - bool asLVal) { +void GRExprEngine::VisitDeclRefExpr(DeclRefExpr* Ex, NodeTy* Pred, NodeSet& Dst, + bool asLValue) { const GRState* St = GetState(Pred); - RVal X = RVal::MakeVal(getStateManager(), D); - - if (asLVal) - MakeNode(Dst, D, Pred, SetRVal(St, D, cast(X))); - else { - RVal V = isa(X) ? GetRVal(St, cast(X)) : X; - MakeNode(Dst, D, Pred, SetRVal(St, D, V)); + + const ValueDecl* D = Ex->getDecl(); + + if (const VarDecl* VD = dyn_cast(D)) { + + QualType T = VD->getType(); + if (T->isArrayType()) { + assert(!asLValue && "Array variable has no lvalue."); + + // C++ standard says array value should be implicitly converted to pointer + // in some cases. We don't have such context information right now. We + // use a MemRegionVal to represent this. May be changed in the future. + + RVal V = lval::MemRegionVal(StateMgr.getRegion(VD)); + MakeNode(Dst, Ex, Pred, SetRVal(St, Ex, V)); + return; + } + + RVal V = GetLValue(St, Ex); + if (asLValue) + MakeNode(Dst, Ex, Pred, SetRVal(St, Ex, V)); + else + EvalLoad(Dst, Ex, Pred, St, V); + return; + + } else if (const EnumConstantDecl* ED = dyn_cast(D)) { + assert(!asLValue && "EnumConstantDecl does not have lvalue."); + + BasicValueFactory& BasicVals = StateMgr.getBasicVals(); + RVal V = nonlval::ConcreteInt(BasicVals.getValue(ED->getInitVal())); + MakeNode(Dst, Ex, Pred, SetRVal(St, Ex, V)); + return; + + } else if (const FunctionDecl* FD = dyn_cast(D)) { + assert(!asLValue && "FunctionDecl does not have lvalue."); + + RVal V = lval::FuncVal(FD); + MakeNode(Dst, Ex, Pred, SetRVal(St, Ex, V)); + return; } + + assert (false && + "ValueDecl support for this ValueDecl not implemented."); } /// VisitArraySubscriptExpr - Transfer function for array accesses void GRExprEngine::VisitArraySubscriptExpr(ArraySubscriptExpr* A, NodeTy* Pred, - NodeSet& Dst, bool asLVal) { + NodeSet& Dst, bool asLValue) { Expr* Base = A->getBase()->IgnoreParens(); Expr* Idx = A->getIdx()->IgnoreParens(); - // Always visit the base as an LVal expression. This computes the - // abstract address of the base object. NodeSet Tmp; - - if (LVal::IsLValType(Base->getType())) // Base always is an LVal. - Visit(Base, Pred, Tmp); - else - VisitLVal(Base, Pred, Tmp); + + // Get Base's rvalue, which should be an LocVal. + Visit(Base, Pred, Tmp); for (NodeSet::iterator I1=Tmp.begin(), E1=Tmp.end(); I1!=E1; ++I1) { // Evaluate the index. - NodeSet Tmp2; Visit(Idx, *I1, Tmp2); for (NodeSet::iterator I2=Tmp2.begin(), E2=Tmp2.end(); I2!=E2; ++I2) { const GRState* St = GetState(*I2); - RVal BaseV = GetRVal(St, Base); - RVal IdxV = GetRVal(St, Idx); - - // If IdxV is 0, return just BaseV. - - bool useBase = false; - - if (nonlval::ConcreteInt* IdxInt = dyn_cast(&IdxV)) - useBase = IdxInt->getValue() == 0; - - RVal V = useBase ? BaseV : lval::ArrayOffset::Make(getBasicVals(), BaseV,IdxV); + RVal V = GetLValue(St, A); - if (asLVal) + if (asLValue) MakeNode(Dst, A, *I2, SetRVal(St, A, V)); else EvalLoad(Dst, A, *I2, St, V); @@ -850,65 +870,22 @@ void GRExprEngine::VisitArraySubscriptExpr(ArraySubscriptExpr* A, NodeTy* Pred, /// VisitMemberExpr - Transfer function for member expressions. void GRExprEngine::VisitMemberExpr(MemberExpr* M, NodeTy* Pred, - NodeSet& Dst, bool asLVal) { + NodeSet& Dst, bool asLValue) { Expr* Base = M->getBase()->IgnoreParens(); - // Always visit the base as an LVal expression. This computes the - // abstract address of the base object. NodeSet Tmp; - - if (asLVal) { - - if (LVal::IsLValType(Base->getType())) // Base always is an LVal. - Visit(Base, Pred, Tmp); - else - VisitLVal(Base, Pred, Tmp); - - for (NodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) { - const GRState* St = GetState(*I); - RVal BaseV = GetRVal(St, Base); - - RVal V = lval::FieldOffset::Make(getBasicVals(), GetRVal(St, Base), - M->getMemberDecl()); - - MakeNode(Dst, M, *I, SetRVal(St, M, V)); - } - - return; - } - // Evaluate the base. Can be an LVal or NonLVal (depends on whether - // or not isArrow() is true). + // Get Base expr's rvalue. Visit(Base, Pred, Tmp); - - for (NodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) { + for (NodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I != E; ++I) { const GRState* St = GetState(*I); - RVal BaseV = GetRVal(St, Base); - - if (LVal::IsLValType(Base->getType())) { - - assert (M->isArrow()); - - RVal V = lval::FieldOffset::Make(getBasicVals(), GetRVal(St, Base), - M->getMemberDecl()); - - EvalLoad(Dst, M, *I, St, V); - } - else { - - assert (!M->isArrow()); - - if (BaseV.isUnknownOrUndef()) { - MakeNode(Dst, M, *I, SetRVal(St, M, BaseV)); - continue; - } - - // FIXME: Implement nonlval objects representing struct temporaries. - assert (isa(BaseV)); - MakeNode(Dst, M, *I, SetRVal(St, M, UnknownVal())); - } + RVal L = GetLValue(St, M); + if (asLValue) + MakeNode(Dst, M, *I, SetRVal(St, M, L)); + else + EvalLoad(Dst, M, *I, St, L); } } @@ -1080,7 +1057,7 @@ void GRExprEngine::VisitCall(CallExpr* CE, NodeTy* Pred, NodeSet DstTmp; Expr* Callee = CE->getCallee()->IgnoreParens(); - VisitLVal(Callee, Pred, DstTmp); + Visit(Callee, Pred, DstTmp); // Finally, evaluate the function call. for (NodeSet::iterator DI = DstTmp.begin(), DE = DstTmp.end(); DI!=DE; ++DI) { @@ -1412,12 +1389,11 @@ void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME, //===----------------------------------------------------------------------===// void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst){ - NodeSet S1; QualType T = CastE->getType(); if (T->isReferenceType()) - VisitLVal(Ex, Pred, S1); + VisitLValue(Ex, Pred, S1); else Visit(Ex, Pred, S1); @@ -1562,7 +1538,7 @@ void GRExprEngine::VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr* Ex, void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred, - NodeSet& Dst, bool asLVal) { + NodeSet& Dst, bool asLValue) { switch (U->getOpcode()) { @@ -1580,7 +1556,7 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred, const GRState* St = GetState(*I); RVal location = GetRVal(St, Ex); - if (asLVal) + if (asLValue) MakeNode(Dst, U, *I, SetRVal(St, U, location)); else EvalLoad(Dst, U, *I, St, location); @@ -1642,7 +1618,7 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred, Dst.Add(Pred); return; - case UnaryOperator::Plus: assert (!asLVal); // FALL-THROUGH. + case UnaryOperator::Plus: assert (!asLValue); // FALL-THROUGH. case UnaryOperator::Extension: { // Unary "+" is a no-op, similar to a parentheses. We still have places @@ -1664,10 +1640,10 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred, case UnaryOperator::AddrOf: { - assert (!asLVal); + assert(!asLValue); Expr* Ex = U->getSubExpr()->IgnoreParens(); NodeSet Tmp; - VisitLVal(Ex, Pred, Tmp); + VisitLValue(Ex, Pred, Tmp); for (NodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) { const GRState* St = GetState(*I); @@ -1683,7 +1659,7 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred, case UnaryOperator::Minus: case UnaryOperator::Not: { - assert (!asLVal); + assert (!asLValue); Expr* Ex = U->getSubExpr()->IgnoreParens(); NodeSet Tmp; Visit(Ex, Pred, Tmp); @@ -1774,7 +1750,7 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred, assert (U->isIncrementDecrementOp()); NodeSet Tmp; Expr* Ex = U->getSubExpr()->IgnoreParens(); - VisitLVal(Ex, Pred, Tmp); + VisitLValue(Ex, Pred, Tmp); for (NodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I!=E; ++I) { @@ -1824,7 +1800,7 @@ void GRExprEngine::VisitAsmStmtHelperOutputs(AsmStmt* A, } NodeSet Tmp; - VisitLVal(*I, Pred, Tmp); + VisitLValue(*I, Pred, Tmp); ++I; @@ -1994,7 +1970,7 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, Expr* RHS = B->getRHS()->IgnoreParens(); if (B->isAssignmentOp()) - VisitLVal(LHS, Pred, Tmp1); + VisitLValue(LHS, Pred, Tmp1); else Visit(LHS, Pred, Tmp1); @@ -2033,7 +2009,7 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, // Simulate the effects of a "store": bind the value of the RHS // to the L-Value represented by the LHS. - EvalStore(Dst, B, LHS, *I2, SetRVal(St, B, RightV), LeftV, RightV); + EvalStore(Dst, B, LHS, *I2, SetRVal(St, B, RightV), LeftV, RightV); continue; } diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp index 0b519fc6a0..49bc24aa7d 100644 --- a/lib/Analysis/GRState.cpp +++ b/lib/Analysis/GRState.cpp @@ -52,7 +52,7 @@ GRStateManager::RemoveDeadBindings(const GRState* St, Stmt* Loc, // Clean up the store. DSymbols.clear(); - NewSt.St = StMgr->RemoveDeadBindings(St->getStore(), Loc, Liveness, + NewSt.St = StoreMgr->RemoveDeadBindings(St->getStore(), Loc, Liveness, RegionRoots, LSymbols, DSymbols); return ConstraintMgr->RemoveDeadBindings(getPersistentState(NewSt), @@ -63,7 +63,7 @@ const GRState* GRStateManager::SetRVal(const GRState* St, LVal LV, RVal V) { Store OldStore = St->getStore(); - Store NewStore = StMgr->SetRVal(OldStore, LV, V); + Store NewStore = StoreMgr->SetRVal(OldStore, LV, V); if (NewStore == OldStore) return St; @@ -79,10 +79,10 @@ const GRState* GRStateManager::AddDecl(const GRState* St, const VarDecl* VD, Store NewStore; if (Ex) - NewStore = StMgr->AddDecl(OldStore, VD, Ex, + NewStore = StoreMgr->AddDecl(OldStore, VD, Ex, GetRVal(St, Ex), Count); else - NewStore = StMgr->AddDecl(OldStore, VD, Ex); + NewStore = StoreMgr->AddDecl(OldStore, VD, Ex); if (NewStore == OldStore) return St; @@ -94,7 +94,7 @@ const GRState* GRStateManager::AddDecl(const GRState* St, const VarDecl* VD, const GRState* GRStateManager::Unbind(const GRState* St, LVal LV) { Store OldStore = St->getStore(); - Store NewStore = StMgr->Remove(OldStore, LV); + Store NewStore = StoreMgr->Remove(OldStore, LV); if (NewStore == OldStore) return St; @@ -107,7 +107,7 @@ const GRState* GRStateManager::Unbind(const GRState* St, LVal LV) { const GRState* GRStateManager::getInitialState() { GRState StateImpl(EnvMgr.getInitialEnvironment(), - StMgr->getInitialStore(), + StoreMgr->getInitialStore(), GDMFactory.GetEmptyMap()); return getPersistentState(StateImpl); @@ -196,7 +196,7 @@ void GRStateRef::printStdErr() const { void GRStateRef::print(std::ostream& Out, const char* nl, const char* sep)const{ GRState::Printer **beg = Mgr->Printers.empty() ? 0 : &Mgr->Printers[0]; GRState::Printer **end = !beg ? 0 : beg + Mgr->Printers.size(); - St->print(Out, *Mgr->StMgr, *Mgr->ConstraintMgr, beg, end, nl, sep); + St->print(Out, *Mgr->StoreMgr, *Mgr->ConstraintMgr, beg, end, nl, sep); } //===----------------------------------------------------------------------===// diff --git a/lib/Analysis/RValues.cpp b/lib/Analysis/RValues.cpp index 337d479255..2b573681e8 100644 --- a/lib/Analysis/RValues.cpp +++ b/lib/Analysis/RValues.cpp @@ -270,6 +270,7 @@ LVal LVal::MakeVal(StringLiteral* S) { // Utility methods for constructing RVals (both NonLVals and LVals). //===----------------------------------------------------------------------===// +// Remove this method? RVal RVal::MakeVal(GRStateManager& SMgr, DeclRefExpr* E) { ValueDecl* D = cast(E)->getDecl();