diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-08-19 16:51:45 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-08-19 16:51:45 +0000 |
commit | caa3724b1d525a888982f94a6ae2b527eb3bca7d (patch) | |
tree | fad69505b5fcf075b6ddabee24e00cb93428420e /lib/Analysis/GRExprEngine.cpp | |
parent | c7089f1be946f3ca6e59596f0e0f92d96136e4c8 (diff) |
Patch by Zhongxing Xu!
This patch extends BasicStoreManager::getInitialStore() to include code that symbolicates input variables.
It also removes redundant handling of ImplicitParamDecl, since it is a subclass of VarDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54993 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 18c5a5825e..7433509c85 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -121,7 +121,7 @@ GRExprEngine::GRExprEngine(CFG& cfg, Decl& CD, ASTContext& Ctx, Liveness(L), Builder(NULL), StateMgr(G.getContext(), CreateBasicStoreManager(G.getAllocator()), - G.getAllocator(), G.getCFG()), + G.getAllocator(), G.getCFG(), L), SymMgr(StateMgr.getSymbolManager()), CurrentStmt(NULL), NSExceptionII(NULL), NSExceptionInstanceRaiseSelectors(NULL), @@ -189,47 +189,7 @@ void GRExprEngine::AddCheck(GRSimpleAPICheck* A, Stmt::StmtClass C) { } const GRState* GRExprEngine::getInitialState() { - - // The LiveVariables information already has a compilation of all VarDecls - // used in the function. Iterate through this set, and "symbolicate" - // any VarDecl whose value originally comes from outside the function. - - typedef LiveVariables::AnalysisDataTy LVDataTy; - LVDataTy& D = Liveness.getAnalysisData(); - - GRState StateImpl = *StateMgr.getInitialState(); - - for (LVDataTy::decl_iterator I=D.begin_decl(), E=D.end_decl(); I != E; ++I) { - - ScopedDecl *SD = const_cast<ScopedDecl*>(I->first); - if (VarDecl* VD = dyn_cast<VarDecl>(SD)) { - // Punt on static variables for now. - if (VD->getStorageClass() == VarDecl::Static) - continue; - - // Only handle pointers and integers for now. - QualType T = VD->getType(); - if (!(LVal::IsLValType(T) || T->isIntegerType())) - continue; - - // Initialize globals and parameters to symbolic values. - // Initialize local variables to undefined. - RVal X = (VD->hasGlobalStorage() || isa<ParmVarDecl>(VD) || - isa<ImplicitParamDecl>(VD)) - ? RVal::GetSymbolValue(SymMgr, VD) - : UndefinedVal(); - - StateMgr.SetRVal(StateImpl, lval::DeclVal(VD), X); - - } else if (ImplicitParamDecl *IPD = dyn_cast<ImplicitParamDecl>(SD)) { - RVal X = RVal::GetSymbolValue(SymMgr, IPD); - StateMgr.SetRVal(StateImpl, lval::DeclVal(IPD), X); - } - - - } - - return StateMgr.getPersistentState(StateImpl); + return StateMgr.getInitialState(); } //===----------------------------------------------------------------------===// |