diff options
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/BasicObjCFoundationChecks.cpp | 40 | ||||
-rw-r--r-- | lib/Analysis/BasicObjCFoundationChecks.h | 8 | ||||
-rw-r--r-- | lib/Analysis/BugReporter.cpp | 80 | ||||
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 218 | ||||
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 124 | ||||
-rw-r--r-- | lib/Analysis/GRExprEngineInternalChecks.cpp | 22 | ||||
-rw-r--r-- | lib/Analysis/GRSimpleVals.cpp | 24 | ||||
-rw-r--r-- | lib/Analysis/GRSimpleVals.h | 16 | ||||
-rw-r--r-- | lib/Analysis/GRTransferFuncs.cpp | 14 | ||||
-rw-r--r-- | lib/Analysis/ValueState.cpp | 100 |
10 files changed, 323 insertions, 323 deletions
diff --git a/lib/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp index 29c0b92432..236cbed013 100644 --- a/lib/Analysis/BasicObjCFoundationChecks.cpp +++ b/lib/Analysis/BasicObjCFoundationChecks.cpp @@ -18,7 +18,7 @@ #include "clang/Analysis/PathSensitive/ExplodedGraph.h" #include "clang/Analysis/PathSensitive/GRSimpleAPICheck.h" #include "clang/Analysis/PathSensitive/GRExprEngine.h" -#include "clang/Analysis/PathSensitive/ValueState.h" +#include "clang/Analysis/PathSensitive/GRState.h" #include "clang/Analysis/PathSensitive/BugReporter.h" #include "clang/Analysis/PathDiagnostic.h" #include "clang/Analysis/LocalCheckers.h" @@ -73,7 +73,7 @@ public: SourceRange R; public: - Report(NilArg& Desc, ExplodedNode<ValueState>* N, + Report(NilArg& Desc, ExplodedNode<GRState>* N, ObjCMessageExpr* ME, unsigned Arg) : BugReport(Desc, N) { @@ -105,12 +105,12 @@ public: class VISIBILITY_HIDDEN BasicObjCFoundationChecks : public GRSimpleAPICheck { NilArg Desc; ASTContext &Ctx; - ValueStateManager* VMgr; + GRStateManager* VMgr; typedef std::vector<BugReport*> ErrorsTy; ErrorsTy Errors; - RVal GetRVal(const ValueState* St, Expr* E) { return VMgr->GetRVal(St, E); } + RVal GetRVal(const GRState* St, Expr* E) { return VMgr->GetRVal(St, E); } bool isNSString(ObjCInterfaceType* T, const char* suffix); bool AuditNSString(NodeTy* N, ObjCMessageExpr* ME); @@ -121,7 +121,7 @@ class VISIBILITY_HIDDEN BasicObjCFoundationChecks : public GRSimpleAPICheck { bool CheckNilArg(NodeTy* N, unsigned Arg); public: - BasicObjCFoundationChecks(ASTContext& ctx, ValueStateManager* vmgr) + BasicObjCFoundationChecks(ASTContext& ctx, GRStateManager* vmgr) : Ctx(ctx), VMgr(vmgr) {} virtual ~BasicObjCFoundationChecks() { @@ -129,7 +129,7 @@ public: delete *I; } - virtual bool Audit(ExplodedNode<ValueState>* N, ValueStateManager&); + virtual bool Audit(ExplodedNode<GRState>* N, GRStateManager&); virtual void EmitWarnings(BugReporter& BR); @@ -149,15 +149,15 @@ private: GRSimpleAPICheck* clang::CreateBasicObjCFoundationChecks(ASTContext& Ctx, - ValueStateManager* VMgr) { + GRStateManager* VMgr) { return new BasicObjCFoundationChecks(Ctx, VMgr); } -bool BasicObjCFoundationChecks::Audit(ExplodedNode<ValueState>* N, - ValueStateManager&) { +bool BasicObjCFoundationChecks::Audit(ExplodedNode<GRState>* N, + GRStateManager&) { ObjCMessageExpr* ME = cast<ObjCMessageExpr>(cast<PostStmt>(N->getLocation()).getStmt()); @@ -322,7 +322,7 @@ class VISIBILITY_HIDDEN StrBugReport : public RangedBugReport { std::string str; const char* cstr; public: - StrBugReport(BugType& D, ExplodedNode<ValueState>* N, std::string s) + StrBugReport(BugType& D, ExplodedNode<GRState>* N, std::string s) : RangedBugReport(D, N), str(s) { cstr = str.c_str(); } @@ -340,19 +340,19 @@ class VISIBILITY_HIDDEN AuditCFNumberCreate : public GRSimpleAPICheck { // approach makes this class more stateless. ASTContext& Ctx; IdentifierInfo* II; - ValueStateManager* VMgr; + GRStateManager* VMgr; - RVal GetRVal(const ValueState* St, Expr* E) { return VMgr->GetRVal(St, E); } - RVal GetRVal(const ValueState* St, LVal LV) { return VMgr->GetRVal(St, LV); } + RVal GetRVal(const GRState* St, Expr* E) { return VMgr->GetRVal(St, E); } + RVal GetRVal(const GRState* St, LVal LV) { return VMgr->GetRVal(St, LV); } public: - AuditCFNumberCreate(ASTContext& ctx, ValueStateManager* vmgr) + AuditCFNumberCreate(ASTContext& ctx, GRStateManager* vmgr) : Ctx(ctx), II(&Ctx.Idents.get("CFNumberCreate")), VMgr(vmgr) {} virtual ~AuditCFNumberCreate() {} - virtual bool Audit(ExplodedNode<ValueState>* N, ValueStateManager&); + virtual bool Audit(ExplodedNode<GRState>* N, GRStateManager&); virtual void EmitWarnings(BugReporter& BR) { Desc.EmitWarnings(BR); @@ -360,7 +360,7 @@ public: private: - void AddError(VarDecl* V, Expr* Ex, ExplodedNode<ValueState> *N, + void AddError(VarDecl* V, Expr* Ex, ExplodedNode<GRState> *N, uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind); }; } // end anonymous namespace @@ -458,7 +458,7 @@ static const char* GetCFNumberTypeStr(uint64_t i) { } #endif -bool AuditCFNumberCreate::Audit(ExplodedNode<ValueState>* N,ValueStateManager&){ +bool AuditCFNumberCreate::Audit(ExplodedNode<GRState>* N,GRStateManager&){ CallExpr* CE = cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt()); Expr* Callee = CE->getCallee(); RVal CallV = GetRVal(N->getState(), Callee); @@ -519,7 +519,7 @@ bool AuditCFNumberCreate::Audit(ExplodedNode<ValueState>* N,ValueStateManager&){ } void AuditCFNumberCreate::AddError(VarDecl* V, Expr* Ex, - ExplodedNode<ValueState> *N, + ExplodedNode<GRState> *N, uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind) { @@ -545,7 +545,7 @@ void AuditCFNumberCreate::AddError(VarDecl* V, Expr* Ex, GRSimpleAPICheck* clang::CreateAuditCFNumberCreate(ASTContext& Ctx, - ValueStateManager* VMgr) { + GRStateManager* VMgr) { return new AuditCFNumberCreate(Ctx, VMgr); } @@ -555,7 +555,7 @@ clang::CreateAuditCFNumberCreate(ASTContext& Ctx, void clang::RegisterAppleChecks(GRExprEngine& Eng) { ASTContext& Ctx = Eng.getContext(); - ValueStateManager* VMgr = &Eng.getStateManager(); + GRStateManager* VMgr = &Eng.getStateManager(); Eng.AddCheck(CreateBasicObjCFoundationChecks(Ctx, VMgr), Stmt::ObjCMessageExprClass); diff --git a/lib/Analysis/BasicObjCFoundationChecks.h b/lib/Analysis/BasicObjCFoundationChecks.h index a0c0409f28..24415419ca 100644 --- a/lib/Analysis/BasicObjCFoundationChecks.h +++ b/lib/Analysis/BasicObjCFoundationChecks.h @@ -15,7 +15,7 @@ #include "clang/Analysis/PathSensitive/ExplodedGraph.h" #include "clang/Analysis/PathSensitive/GRSimpleAPICheck.h" -#include "clang/Analysis/PathSensitive/ValueState.h" +#include "clang/Analysis/PathSensitive/GRState.h" #include "clang/Analysis/PathDiagnostic.h" #include "clang/AST/Expr.h" #include "clang/AST/ASTContext.h" @@ -28,13 +28,13 @@ namespace clang { class GRSimpleAPICheck; class ASTContext; -class ValueStateManager; +class GRStateManager; GRSimpleAPICheck* CreateBasicObjCFoundationChecks(ASTContext& Ctx, - ValueStateManager* VMgr); + GRStateManager* VMgr); GRSimpleAPICheck* CreateAuditCFNumberCreate(ASTContext& Ctx, - ValueStateManager* VMgr); + GRStateManager* VMgr); } // end clang namespace diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index ed17c9d0cb..5002ed6f74 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -33,11 +33,11 @@ BugType::~BugType() {} BugReport::~BugReport() {} RangedBugReport::~RangedBugReport() {} -ExplodedGraph<ValueState>& GRBugReporter::getGraph() { +ExplodedGraph<GRState>& GRBugReporter::getGraph() { return Eng.getGraph(); } -ValueStateManager& GRBugReporter::getStateManager() { +GRStateManager& GRBugReporter::getStateManager() { return Eng.getStateManager(); } @@ -63,12 +63,12 @@ static inline Stmt* GetStmt(const CFGBlock* B) { return (*B)[0]; } -static inline ExplodedNode<ValueState>* -GetNextNode(ExplodedNode<ValueState>* N) { +static inline ExplodedNode<GRState>* +GetNextNode(ExplodedNode<GRState>* N) { return N->pred_empty() ? NULL : *(N->pred_begin()); } -static Stmt* GetLastStmt(ExplodedNode<ValueState>* N) { +static Stmt* GetLastStmt(ExplodedNode<GRState>* N) { assert (isa<BlockEntrance>(N->getLocation())); for (N = GetNextNode(N); N; N = GetNextNode(N)) { @@ -99,7 +99,7 @@ static void ExecutionContinues(std::ostringstream& os, SourceManager& SMgr, static inline void ExecutionContinues(std::ostringstream& os, SourceManager& SMgr, - ExplodedNode<ValueState>* N) { + ExplodedNode<GRState>* N) { ExecutionContinues(os, SMgr, GetStmt(N->getLocation())); } @@ -128,7 +128,7 @@ Stmt* BugReport::getStmt(BugReporter& BR) const { PathDiagnosticPiece* BugReport::getEndPath(BugReporter& BR, - ExplodedNode<ValueState>* EndPathNode) { + ExplodedNode<GRState>* EndPathNode) { Stmt* S = getStmt(BR); @@ -172,24 +172,24 @@ FullSourceLoc BugReport::getLocation(SourceManager& Mgr) { return FullSourceLoc(S->getLocStart(), Mgr); } -PathDiagnosticPiece* BugReport::VisitNode(ExplodedNode<ValueState>* N, - ExplodedNode<ValueState>* PrevN, - ExplodedGraph<ValueState>& G, +PathDiagnosticPiece* BugReport::VisitNode(ExplodedNode<GRState>* N, + ExplodedNode<GRState>* PrevN, + ExplodedGraph<GRState>& G, BugReporter& BR) { return NULL; } -static std::pair<ExplodedGraph<ValueState>*, ExplodedNode<ValueState>*> -MakeReportGraph(ExplodedGraph<ValueState>* G, ExplodedNode<ValueState>* N) { +static std::pair<ExplodedGraph<GRState>*, ExplodedNode<GRState>*> +MakeReportGraph(ExplodedGraph<GRState>* G, ExplodedNode<GRState>* N) { - llvm::OwningPtr<ExplodedGraph<ValueState> > GTrim(G->Trim(&N, &N+1)); + llvm::OwningPtr<ExplodedGraph<GRState> > GTrim(G->Trim(&N, &N+1)); // Find the error node in the trimmed graph. - ExplodedNode<ValueState>* NOld = N; + ExplodedNode<GRState>* NOld = N; N = 0; - for (ExplodedGraph<ValueState>::node_iterator + for (ExplodedGraph<GRState>::node_iterator I = GTrim->nodes_begin(), E = GTrim->nodes_end(); I != E; ++I) { if (I->getState() == NOld->getState() && @@ -203,20 +203,20 @@ MakeReportGraph(ExplodedGraph<ValueState>* G, ExplodedNode<ValueState>* N) { // Create a new graph with a single path. - G = new ExplodedGraph<ValueState>(GTrim->getCFG(), GTrim->getCodeDecl(), + G = new ExplodedGraph<GRState>(GTrim->getCFG(), GTrim->getCodeDecl(), GTrim->getContext()); // Sometimes TrimGraph can contain a cycle. Perform a reverse DFS // to the root node, and then construct a new graph that contains only // a single path. llvm::DenseMap<void*,unsigned> Visited; - llvm::SmallVector<ExplodedNode<ValueState>*, 10> WS; + llvm::SmallVector<ExplodedNode<GRState>*, 10> WS; WS.push_back(N); unsigned cnt = 0; - ExplodedNode<ValueState>* Root = 0; + ExplodedNode<GRState>* Root = 0; while (!WS.empty()) { - ExplodedNode<ValueState>* Node = WS.back(); + ExplodedNode<GRState>* Node = WS.back(); WS.pop_back(); if (Visited.find(Node) != Visited.end()) @@ -229,7 +229,7 @@ MakeReportGraph(ExplodedGraph<ValueState>* G, ExplodedNode<ValueState>* N) { break; } - for (ExplodedNode<ValueState>::pred_iterator I=Node->pred_begin(), + for (ExplodedNode<GRState>::pred_iterator I=Node->pred_begin(), E=Node->pred_end(); I!=E; ++I) WS.push_back(*I); } @@ -238,7 +238,7 @@ MakeReportGraph(ExplodedGraph<ValueState>* G, ExplodedNode<ValueState>* N) { // Now walk from the root down the DFS path, always taking the successor // with the lowest number. - ExplodedNode<ValueState> *Last = 0, *First = 0; + ExplodedNode<GRState> *Last = 0, *First = 0; for ( N = Root ;;) { @@ -248,7 +248,7 @@ MakeReportGraph(ExplodedGraph<ValueState>* G, ExplodedNode<ValueState>* N) { // Create the equivalent node in the new graph with the same state // and location. - ExplodedNode<ValueState>* NewN = + ExplodedNode<GRState>* NewN = G->getNode(N->getLocation(), N->getState()); // Link up the new node with the previous node. @@ -265,8 +265,8 @@ MakeReportGraph(ExplodedGraph<ValueState>* G, ExplodedNode<ValueState>* N) { // Find the next successor node. We choose the node that is marked // with the lowest DFS number. - ExplodedNode<ValueState>::succ_iterator SI = N->succ_begin(); - ExplodedNode<ValueState>::succ_iterator SE = N->succ_end(); + ExplodedNode<GRState>::succ_iterator SI = N->succ_begin(); + ExplodedNode<GRState>::succ_iterator SE = N->succ_end(); N = 0; for (unsigned MinVal = 0; SI != SE; ++SI) { @@ -289,8 +289,8 @@ MakeReportGraph(ExplodedGraph<ValueState>* G, ExplodedNode<ValueState>* N) { return std::make_pair(G, First); } -static VarDecl* GetMostRecentVarDeclBinding(ExplodedNode<ValueState>* N, - ValueStateManager& VMgr, +static VarDecl* GetMostRecentVarDeclBinding(ExplodedNode<GRState>* N, + GRStateManager& VMgr, RVal X) { for ( ; N ; N = N->pred_empty() ? 0 : *N->pred_begin()) { @@ -322,12 +322,12 @@ static VarDecl* GetMostRecentVarDeclBinding(ExplodedNode<ValueState>* N, } -static void HandleNotableSymbol(ExplodedNode<ValueState>* N, Stmt* S, +static void HandleNotableSymbol(ExplodedNode<GRState>* N, Stmt* S, SymbolID Sym, BugReporter& BR, PathDiagnostic& PD) { - ExplodedNode<ValueState>* Pred = N->pred_empty() ? 0 : *N->pred_begin(); - const ValueState* PrevSt = Pred ? Pred->getState() : 0; + ExplodedNode<GRState>* Pred = N->pred_empty() ? 0 : *N->pred_begin(); + const GRState* PrevSt = Pred ? Pred->getState() : 0; if (!PrevSt) return; @@ -335,8 +335,8 @@ static void HandleNotableSymbol(ExplodedNode<ValueState>* N, Stmt* S, // Look at the variable bindings of the current state that map to the // specified symbol. Are any of them not in the previous state. - const ValueState* St = N->getState(); - ValueStateManager& VMgr = cast<GRBugReporter>(BR).getStateManager(); + const GRState* St = N->getState(); + GRStateManager& VMgr = cast<GRBugReporter>(BR).getStateManager(); // FIXME: Later generalize for a broader memory model. @@ -344,7 +344,7 @@ static void HandleNotableSymbol(ExplodedNode<ValueState>* N, Stmt* S, // doesn't matter, but keep an eye out for performance issues. It's // also a bunch of copy-paste. Bad. Cleanup later. - for (ValueState::vb_iterator I=St->vb_begin(), E=St->vb_end(); I!=E; ++I){ + for (GRState::vb_iterator I=St->vb_begin(), E=St->vb_end(); I!=E; ++I){ RVal V = I.getData(); SymbolID ScanSym; @@ -412,17 +412,17 @@ static void HandleNotableSymbol(ExplodedNode<ValueState>* N, Stmt* S, void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, BugReport& R) { - ExplodedNode<ValueState>* N = R.getEndNode(); + ExplodedNode<GRState>* N = R.getEndNode(); if (!N) return; // Construct a new graph that contains only a single path from the error // node to a root. - const std::pair<ExplodedGraph<ValueState>*,ExplodedNode<ValueState>*> + const std::pair<ExplodedGraph<GRState>*,ExplodedNode<GRState>*> GPair = MakeReportGraph(&getGraph(), N); - llvm::OwningPtr<ExplodedGraph<ValueState> > ReportGraph(GPair.first); + llvm::OwningPtr<ExplodedGraph<GRState> > ReportGraph(GPair.first); assert(GPair.second->getLocation() == N->getLocation()); N = GPair.second; @@ -433,7 +433,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, else return; - ExplodedNode<ValueState>* NextNode = N->pred_empty() + ExplodedNode<GRState>* NextNode = N->pred_empty() ? NULL : *(N->pred_begin()); ASTContext& Ctx = getContext(); @@ -441,7 +441,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, while (NextNode) { - ExplodedNode<ValueState>* LastNode = N; + ExplodedNode<GRState>* LastNode = N; N = NextNode; NextNode = GetNextNode(N); @@ -633,7 +633,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, if (const PostStmt* PS = dyn_cast<PostStmt>(&P)) { - const ValueState* St = N->getState(); + const GRState* St = N->getState(); // Scan the lval bindings, and see if a "notable" symbol has a new // lval binding. @@ -643,7 +643,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, llvm::SmallSet<SymbolID, 10> AlreadyProcessed; - for (ValueState::vb_iterator I=St->vb_begin(), E=St->vb_end(); I!=E; ++I){ + for (GRState::vb_iterator I=St->vb_begin(), E=St->vb_end(); I!=E; ++I){ RVal V = I.getData(); SymbolID ScanSym; @@ -674,7 +674,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, bool BugTypeCacheLocation::isCached(BugReport& R) { - ExplodedNode<ValueState>* N = R.getEndNode(); + ExplodedNode<GRState>* N = R.getEndNode(); if (!N) return false; diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index f36b4eb1fc..2d69d9bb3d 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -15,7 +15,7 @@ #include "GRSimpleVals.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/SourceManager.h" -#include "clang/Analysis/PathSensitive/ValueState.h" +#include "clang/Analysis/PathSensitive/GRState.h" #include "clang/Analysis/PathDiagnostic.h" #include "clang/Analysis/LocalCheckers.h" #include "clang/Analysis/PathDiagnostic.h" @@ -1211,7 +1211,7 @@ public: typedef llvm::DenseMap<GRExprEngine::NodeTy*, std::vector<SymbolID>*> LeaksTy; - class BindingsPrinter : public ValueState::CheckerStatePrinter { + class BindingsPrinter : public GRState::CheckerStatePrinter { public: virtual void PrintCheckerState(std::ostream& Out, void* State, const char* nl, const char* sep); @@ -1228,13 +1228,13 @@ private: public: - static RefBindings GetRefBindings(const ValueState& StImpl) { + static RefBindings GetRefBindings(const GRState& StImpl) { return RefBindings((const RefBindings::TreeTy*) StImpl.CheckerState); } private: - static void SetRefBindings(ValueState& StImpl, RefBindings B) { + static void SetRefBindings(GRState& StImpl, RefBindings B) { StImpl.CheckerState = B.getRoot(); } @@ -1245,18 +1245,18 @@ private: RefBindings Update(RefBindings B, SymbolID sym, RefVal V, ArgEffect E, RefVal::Kind& hasErr); - void ProcessNonLeakError(ExplodedNodeSet<ValueState>& Dst, - GRStmtNodeBuilder<ValueState>& Builder, + void ProcessNonLeakError(ExplodedNodeSet<GRState>& Dst, + GRStmtNodeBuilder<GRState>& Builder, Expr* NodeExpr, Expr* ErrorExpr, - ExplodedNode<ValueState>* Pred, - const ValueState* St, + ExplodedNode<GRState>* Pred, + const GRState* St, RefVal::Kind hasErr, SymbolID Sym); - const ValueState* HandleSymbolDeath(ValueStateManager& VMgr, - const ValueState* St, + const GRState* HandleSymbolDeath(GRStateManager& VMgr, + const GRState* St, SymbolID sid, RefVal V, bool& hasLeak); - const ValueState* NukeBinding(ValueStateManager& VMgr, const ValueState* St, + const GRState* NukeBinding(GRStateManager& VMgr, const GRState* St, SymbolID sid); public: @@ -1272,7 +1272,7 @@ public: virtual void RegisterChecks(GRExprEngine& Eng); - virtual ValueState::CheckerStatePrinter* getCheckerStatePrinter() { + virtual GRState::CheckerStatePrinter* getCheckerStatePrinter() { return &Printer; } @@ -1281,65 +1281,65 @@ public: // Calls. - void EvalSummary(ExplodedNodeSet<ValueState>& Dst, + void EvalSummary(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Eng, - GRStmtNodeBuilder<ValueState>& Builder, + GRStmtNodeBuilder<GRState>& Builder, Expr* Ex, Expr* Receiver, RetainSummary* Summ, ExprIterator arg_beg, ExprIterator arg_end, - ExplodedNode<ValueState>* Pred); + ExplodedNode<GRState>* Pred); - virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst, + virtual void EvalCall(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Eng, - GRStmtNodeBuilder<ValueState>& Builder, + GRStmtNodeBuilder<GRState>& Builder, CallExpr* CE, RVal L, - ExplodedNode<ValueState>* Pred); + ExplodedNode<GRState>* Pred); - virtual void EvalObjCMessageExpr(ExplodedNodeSet<ValueState>& Dst, + virtual void EvalObjCMessageExpr(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Engine, - GRStmtNodeBuilder<ValueState>& Builder, + GRStmtNodeBuilder<GRState>& Builder, ObjCMessageExpr* ME, - ExplodedNode<ValueState>* Pred); + ExplodedNode<GRState>* Pred); - bool EvalObjCMessageExprAux(ExplodedNodeSet<ValueState>& Dst, + bool EvalObjCMessageExprAux(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Engine, - GRStmtNodeBuilder<ValueState>& Builder, + GRStmtNodeBuilder<GRState>& Builder, ObjCMessageExpr* ME, - ExplodedNode<ValueState>* Pred); + ExplodedNode<GRState>* Pred); // Stores. - virtual void EvalStore(ExplodedNodeSet<ValueState>& Dst, + virtual void EvalStore(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Engine, - GRStmtNodeBuilder<ValueState>& Builder, - Expr* E, ExplodedNode<ValueState>* Pred, - const ValueState* St, RVal TargetLV, RVal Val); + GRStmtNodeBuilder<GRState>& Builder, + Expr* E, ExplodedNode<GRState>* Pred, + const GRState* St, RVal TargetLV, RVal Val); // End-of-path. virtual void EvalEndPath(GRExprEngine& Engine, - GREndPathNodeBuilder<ValueState>& Builder); + GREndPathNodeBuilder<GRState>& Builder); - virtual void EvalDeadSymbols(ExplodedNodeSet<ValueState>& Dst, + virtual void EvalDeadSymbols(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Engine, - GRStmtNodeBuilder<ValueState>& Builder, - ExplodedNode<ValueState>* Pred, + GRStmtNodeBuilder<GRState>& Builder, + ExplodedNode<GRState>* Pred, Stmt* S, - const ValueState* St, - const ValueStateManager::DeadSymbolsTy& Dead); + const GRState* St, + const GRStateManager::DeadSymbolsTy& Dead); // Return statements. - virtual void EvalReturn(ExplodedNodeSet<ValueState>& Dst, + virtual void EvalReturn(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Engine, - GRStmtNodeBuilder<ValueState>& Builder, + GRStmtNodeBuilder<GRState>& Builder, ReturnStmt* S, - ExplodedNode<ValueState>* Pred); + ExplodedNode<GRState>* Pred); // Assumptions. - virtual const ValueState* EvalAssume(ValueStateManager& VMgr, - const ValueState* St, RVal Cond, + virtual const GRState* EvalAssume(GRStateManager& VMgr, + const GRState* St, RVal Cond, bool Assumption, bool& isFeasible); // Error iterators. @@ -1394,11 +1394,11 @@ static inline bool IsEndPath(RetainSummary* Summ) { return Summ ? Summ->isEndPath() : false; } -void CFRefCount::ProcessNonLeakError(ExplodedNodeSet<ValueState>& Dst, - GRStmtNodeBuilder<ValueState>& Builder, +void CFRefCount::ProcessNonLeakError(ExplodedNodeSet<GRState>& Dst, + GRStmtNodeBuilder<GRState>& Builder, Expr* NodeExpr, Expr* ErrorExpr, - ExplodedNode<ValueState>* Pred, - const ValueState* St, + ExplodedNode<GRState>* Pred, + const GRState* St, RefVal::Kind hasErr, SymbolID Sym) { Builder.BuildSinks = true; GRExprEngine::NodeTy* N = Builder.MakeNode(Dst, NodeExpr, Pred, St); @@ -1450,21 +1450,21 @@ static QualType GetReturnType(Expr* RetE, ASTContext& Ctx) { } -void CFRefCount::EvalSummary(ExplodedNodeSet<ValueState>& Dst, +void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Eng, - GRStmtNodeBuilder<ValueState>& Builder, + GRStmtNodeBuilder<GRState>& Builder, Expr* Ex, Expr* Receiver, RetainSummary* Summ, ExprIterator arg_beg, ExprIterator arg_end, - ExplodedNode<ValueState>* Pred) { + ExplodedNode<GRState>* Pred) { // Get the state. - ValueStateManager& StateMgr = Eng.getStateManager(); - const ValueState* St = Builder.GetState(Pred); + GRStateManager& StateMgr = Eng.getStateManager(); + const GRState* St = Builder.GetState(Pred); // Evaluate the effect of the arguments. - ValueState StVals = *St; + GRState StVals = *St; RefVal::Kind hasErr = (RefVal::Kind) 0; unsigned idx = 0; Expr* ErrorExpr = NULL; @@ -1615,7 +1615,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<ValueState>& Dst, SymbolID Sym = Eng.getSymbolManager().getConjuredSymbol(Ex, Count); QualType RetT = GetReturnType(Ex, Eng.getContext()); - ValueState StImpl = *St; + GRState StImpl = *St; RefBindings B = GetRefBindings(StImpl); SetRefBindings(StImpl, RefBFactory.Add(B, Sym, RefVal::makeOwned(RetT))); @@ -1635,7 +1635,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<ValueState>& Dst, SymbolID Sym = Eng.getSymbolManager().getConjuredSymbol(Ex, Count); QualType RetT = GetReturnType(Ex, Eng.getContext()); - ValueState StImpl = *St; + GRState StImpl = *St; RefBindings B = GetRefBindings(StImpl); SetRefBindings(StImpl, RefBFactory.Add(B, Sym, RefVal::makeNotOwned(RetT))); @@ -1656,11 +1656,11 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<ValueState>& Dst, } -void CFRefCount::EvalCall(ExplodedNodeSet<ValueState>& Dst, +void CFRefCount::EvalCall(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Eng, - GRStmtNodeBuilder<ValueState>& Builder, + GRStmtNodeBuilder<GRState>& Builder, CallExpr* CE, RVal L, - ExplodedNode<ValueState>* Pred) { + ExplodedNode<GRState>* Pred) { RetainSummary* Summ = !isa<lval::FuncVal>(L) ? 0 : Summaries.getSummary(cast<lval::FuncVal>(L).getDecl()); @@ -1669,11 +1669,11 @@ void CFRefCount::EvalCall(ExplodedNodeSet<ValueState>& Dst, CE->arg_begin(), CE->arg_end(), Pred); } -void CFRefCount::EvalObjCMessageExpr(ExplodedNodeSet<ValueState>& Dst, +void CFRefCount::EvalObjCMessageExpr(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Eng, - GRStmtNodeBuilder<ValueState>& Builder, + GRStmtNodeBuilder<GRState>& Builder, ObjCMessageExpr* ME, - ExplodedNode<ValueState>* Pred) { + ExplodedNode<GRState>* Pred) { RetainSummary* Summ; if (Expr* Receiver = ME->getReceiver()) { @@ -1683,7 +1683,7 @@ void CFRefCount::EvalObjCMessageExpr(ExplodedNodeSet<ValueState>& Dst, // FIXME: Wouldn't it be great if this code could be reduced? It's just // a chain of lookups. - const ValueState* St = Builder.GetState(Pred); + const GRState* St = Builder.GetState(Pred); RVal V = Eng.getStateManager().GetRVal(St, Receiver ); if (isa<lval::SymbolVal>(V)) { @@ -1713,11 +1713,11 @@ void CFRefCount::EvalObjCMessageExpr(ExplodedNodeSet<ValueState>& Dst, // Stores. -void CFRefCount::EvalStore(ExplodedNodeSet<ValueState>& Dst, +void CFRefCount::EvalStore(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Eng, - GRStmtNodeBuilder<ValueState>& Builder, - Expr* E, ExplodedNode<ValueState>* Pred, - const ValueState* St, RVal TargetLV, RVal Val) { + GRStmtNodeBuilder<GRState>& Builder, + Expr* E, ExplodedNode<GRState>* Pred, + const GRState* St, RVal TargetLV, RVal Val) { // Check if we have a binding for "Val" and if we are storing it to something // we don't understand or otherwise the value "escapes" the function. @@ -1750,10 +1750,10 @@ void CFRefCount::EvalStore(ExplodedNodeSet<ValueState>& Dst, } -const ValueState* CFRefCount::NukeBinding(ValueStateManager& VMgr, - const ValueState* St, +const GRState* CFRefCount::NukeBinding(GRStateManager& VMgr, + const GRState* St, SymbolID sid) { - ValueState StImpl = *St; + GRState StImpl = *St; RefBindings B = GetRefBindings(StImpl); StImpl.CheckerState = RefBFactory.Remove(B, sid).getRoot(); return VMgr.getPersistentState(StImpl); @@ -1761,8 +1761,8 @@ const ValueState* CFRefCount::NukeBinding(ValueStateManager& VMgr, // End-of-path. -const ValueState* CFRefCount::HandleSymbolDeath(ValueStateManager& VMgr, - const ValueState* St, SymbolID sid, +const GRState* CFRefCount::HandleSymbolDeath(GRStateManager& VMgr, + const GRState* St, SymbolID sid, RefVal V, bool& hasLeak) { hasLeak = V.isOwned() || @@ -1772,16 +1772,16 @@ const ValueState* CFRefCount::HandleSymbolDeath(ValueStateManager& VMgr, return NukeBinding(VMgr, St, sid); RefBindings B = GetRefBindings(*St); - ValueState StImpl = *St; + GRState StImpl = *St; StImpl.CheckerState = RefBFactory.Add(B, sid, V^RefVal::ErrorLeak).getRoot(); return VMgr.getPersistentState(StImpl); } void CFRefCount::EvalEndPath(GRExprEngine& Eng, - GREndPathNodeBuilder<ValueState>& Builder) { + GREndPathNodeBuilder<GRState>& Builder) { - const ValueState* St = Builder.getState(); + const GRState* St = Builder.getState(); RefBindings B = GetRefBindings(*St); llvm::SmallVector<SymbolID, 10> Leaked; @@ -1798,7 +1798,7 @@ void CFRefCount::EvalEndPath(GRExprEngine& Eng, if (Leaked.empty()) return; - ExplodedNode<ValueState>* N = Builder.MakeNode(St); + ExplodedNode<GRState>* N = Builder.MakeNode(St); if (!N) return; @@ -1814,20 +1814,20 @@ void CFRefCount::EvalEndPath(GRExprEngine& Eng, // Dead symbols. -void CFRefCount::EvalDeadSymbols(ExplodedNodeSet<ValueState>& Dst, +void CFRefCount::EvalDeadSymbols(ExplodedNodeSet<GRState>& Dst, GRExprEngine& Eng, - GRStmtNodeBuilder<ValueState>& Builder, - ExplodedNode<ValueState>* Pred, + GRStmtNodeBuilder<GRState>& Builder, + ExplodedNode<GRState>* Pred, Stmt* S, - const ValueState* St, - const ValueStateManager::DeadSymbolsTy& Dead) { + const GRState* St, + const GRStateManager::DeadSymbolsTy& Dead) { // FIXME: a lot of copy-and-paste from EvalEndPath. Refactor. RefBindings B = GetRefBindings(*St); llvm::SmallVector<SymbolID, 10> Leaked; - for (ValueStateManager::DeadSymbolsTy::const_iterator + for (GRStateManager::DeadSymbolsTy::const_iterator I=Dead.begin(), E=Dead.end(); I!=E; ++I) { const RefVal* T = B.lookup(*I); @@ -1846,7 +1846,7 @@ void CFRefCount::EvalDeadSymbols(ExplodedNodeSet<ValueState>& Dst, if (Leaked.empty()) return; - ExplodedNode<ValueState>* N = Builder.MakeNode(Dst, S, Pred, St); + ExplodedNode<GRState>* N = Builder.MakeNode(Dst, S, Pred, St); if (!N) return; @@ -1862,17 +1862,17 @@ void CFRefCount::EvalDeadSymbols(ExplodedNodeSet<ValueState>& Dst, // Return statements. -void CFRefCount::EvalReturn(ExplodedNodeSet<ValueState>& Dst, +void CFRefCount::EvalReturn(ExplodedNodeSe |