diff options
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/BasicObjCFoundationChecks.cpp | 16 | ||||
-rw-r--r-- | lib/Analysis/BugReporter.cpp | 104 | ||||
-rw-r--r-- | lib/Analysis/BugReporterVisitors.cpp | 24 | ||||
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 126 | ||||
-rw-r--r-- | lib/Analysis/ExplodedGraph.cpp | 74 | ||||
-rw-r--r-- | lib/Analysis/GRCoreEngine.cpp | 54 | ||||
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 20 | ||||
-rw-r--r-- | lib/Analysis/GRExprEngineInternalChecks.cpp | 48 |
8 files changed, 237 insertions, 229 deletions
diff --git a/lib/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp index 684c88c998..d7631bc2c2 100644 --- a/lib/Analysis/BasicObjCFoundationChecks.cpp +++ b/lib/Analysis/BasicObjCFoundationChecks.cpp @@ -74,7 +74,7 @@ public: BasicObjCFoundationChecks(ASTContext& ctx, BugReporter& br) : BT(0), BR(br), Ctx(ctx) {} - bool Audit(ExplodedNode<GRState>* N, GRStateManager&); + bool Audit(ExplodedNode* N, GRStateManager&); private: void WarnNilArg(NodeTy* N, const ObjCMessageExpr* ME, unsigned Arg) { @@ -103,7 +103,7 @@ clang::CreateBasicObjCFoundationChecks(ASTContext& Ctx, BugReporter& BR) { -bool BasicObjCFoundationChecks::Audit(ExplodedNode<GRState>* N, +bool BasicObjCFoundationChecks::Audit(ExplodedNode* N, GRStateManager&) { const ObjCMessageExpr* ME = @@ -254,10 +254,10 @@ public: ~AuditCFNumberCreate() {} - bool Audit(ExplodedNode<GRState>* N, GRStateManager&); + bool Audit(ExplodedNode* N, GRStateManager&); private: - void AddError(const TypedRegion* R, const Expr* Ex, ExplodedNode<GRState> *N, + void AddError(const TypedRegion* R, const Expr* Ex, ExplodedNode *N, uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind); }; } // end anonymous namespace @@ -355,7 +355,7 @@ static const char* GetCFNumberTypeStr(uint64_t i) { } #endif -bool AuditCFNumberCreate::Audit(ExplodedNode<GRState>* N,GRStateManager&){ +bool AuditCFNumberCreate::Audit(ExplodedNode* N,GRStateManager&){ const CallExpr* CE = cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt()); const Expr* Callee = CE->getCallee(); @@ -422,7 +422,7 @@ bool AuditCFNumberCreate::Audit(ExplodedNode<GRState>* N,GRStateManager&){ } void AuditCFNumberCreate::AddError(const TypedRegion* R, const Expr* Ex, - ExplodedNode<GRState> *N, + ExplodedNode *N, uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind) { @@ -478,12 +478,12 @@ public: ~AuditCFRetainRelease() {} - bool Audit(ExplodedNode<GRState>* N, GRStateManager&); + bool Audit(ExplodedNode* N, GRStateManager&); }; } // end anonymous namespace -bool AuditCFRetainRelease::Audit(ExplodedNode<GRState>* N, GRStateManager&) { +bool AuditCFRetainRelease::Audit(ExplodedNode* N, GRStateManager&) { const CallExpr* CE = cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt()); // If the CallExpr doesn't have exactly 1 argument just give up checking. diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index f00583e8c4..19a031a1ae 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -49,17 +49,17 @@ static inline const Stmt* GetStmt(ProgramPoint P) { return 0; } -static inline const ExplodedNode<GRState>* -GetPredecessorNode(const ExplodedNode<GRState>* N) { +static inline const ExplodedNode* +GetPredecessorNode(const ExplodedNode* N) { return N->pred_empty() ? NULL : *(N->pred_begin()); } -static inline const ExplodedNode<GRState>* -GetSuccessorNode(const ExplodedNode<GRState>* N) { +static inline const ExplodedNode* +GetSuccessorNode(const ExplodedNode* N) { return N->succ_empty() ? NULL : *(N->succ_begin()); } -static const Stmt* GetPreviousStmt(const ExplodedNode<GRState>* N) { +static const Stmt* GetPreviousStmt(const ExplodedNode* N) { for (N = GetPredecessorNode(N); N; N = GetPredecessorNode(N)) if (const Stmt *S = GetStmt(N->getLocation())) return S; @@ -67,7 +67,7 @@ static const Stmt* GetPreviousStmt(const ExplodedNode<GRState>* N) { return 0; } -static const Stmt* GetNextStmt(const ExplodedNode<GRState>* N) { +static const Stmt* GetNextStmt(const ExplodedNode* N) { for (N = GetSuccessorNode(N); N; N = GetSuccessorNode(N)) if (const Stmt *S = GetStmt(N->getLocation())) { // Check if the statement is '?' or '&&'/'||'. These are "merges", @@ -96,7 +96,7 @@ static const Stmt* GetNextStmt(const ExplodedNode<GRState>* N) { } static inline const Stmt* -GetCurrentOrPreviousStmt(const ExplodedNode<GRState>* N) { +GetCurrentOrPreviousStmt(const ExplodedNode* N) { if (const Stmt *S = GetStmt(N->getLocation())) return S; @@ -104,7 +104,7 @@ GetCurrentOrPreviousStmt(const ExplodedNode<GRState>* N) { } static inline const Stmt* -GetCurrentOrNextStmt(const ExplodedNode<GRState>* N) { +GetCurrentOrNextStmt(const ExplodedNode* N) { if (const Stmt *S = GetStmt(N->getLocation())) return S; @@ -115,8 +115,8 @@ GetCurrentOrNextStmt(const ExplodedNode<GRState>* N) { // PathDiagnosticBuilder and its associated routines and helper objects. //===----------------------------------------------------------------------===// -typedef llvm::DenseMap<const ExplodedNode<GRState>*, -const ExplodedNode<GRState>*> NodeBackMap; +typedef llvm::DenseMap<const ExplodedNode*, +const ExplodedNode*> NodeBackMap; namespace { class VISIBILITY_HIDDEN NodeMapClosure : public BugReport::NodeResolver { @@ -125,7 +125,7 @@ public: NodeMapClosure(NodeBackMap *m) : M(*m) {} ~NodeMapClosure() {} - const ExplodedNode<GRState>* getOriginalNode(const ExplodedNode<GRState>* N) { + const ExplodedNode* getOriginalNode(const ExplodedNode* N) { NodeBackMap::iterator I = M.find(N); return I == M.end() ? 0 : I->second; } @@ -146,10 +146,10 @@ public: addVisitor(R); } - PathDiagnosticLocation ExecutionContinues(const ExplodedNode<GRState>* N); + PathDiagnosticLocation ExecutionContinues(const ExplodedNode* N); PathDiagnosticLocation ExecutionContinues(llvm::raw_string_ostream& os, - const ExplodedNode<GRState>* N); + const ExplodedNode* N); ParentMap& getParentMap() { if (PM.get() == 0) @@ -185,7 +185,7 @@ public: } // end anonymous namespace PathDiagnosticLocation -PathDiagnosticBuilder::ExecutionContinues(const ExplodedNode<GRState>* N) { +PathDiagnosticBuilder::ExecutionContinues(const ExplodedNode* N) { if (const Stmt *S = GetNextStmt(N)) return PathDiagnosticLocation(S, getSourceManager()); @@ -194,7 +194,7 @@ PathDiagnosticBuilder::ExecutionContinues(const ExplodedNode<GRState>* N) { PathDiagnosticLocation PathDiagnosticBuilder::ExecutionContinues(llvm::raw_string_ostream& os, - const ExplodedNode<GRState>* N) { + const ExplodedNode* N) { // Slow, but probably doesn't matter. if (os.str().empty()) @@ -327,7 +327,7 @@ PathDiagnosticBuilder::getEnclosingStmtLocation(const Stmt *S) { //===----------------------------------------------------------------------===// static const VarDecl* -GetMostRecentVarDeclBinding(const ExplodedNode<GRState>* N, +GetMostRecentVarDeclBinding(const ExplodedNode* N, GRStateManager& VMgr, SVal X) { for ( ; N ; N = N->pred_empty() ? 0 : *N->pred_begin()) { @@ -366,14 +366,14 @@ class VISIBILITY_HIDDEN NotableSymbolHandler const GRState* PrevSt; const Stmt* S; GRStateManager& VMgr; - const ExplodedNode<GRState>* Pred; + const ExplodedNode* Pred; PathDiagnostic& PD; BugReporter& BR; public: NotableSymbolHandler(SymbolRef sym, const GRState* prevst, const Stmt* s, - GRStateManager& vmgr, const ExplodedNode<GRState>* pred, + GRStateManager& vmgr, const ExplodedNode* pred, PathDiagnostic& pd, BugReporter& br) : Sym(sym), PrevSt(prevst), S(s), VMgr(vmgr), Pred(pred), PD(pd), BR(br) {} @@ -440,12 +440,12 @@ public: }; } -static void HandleNotableSymbol(const ExplodedNode<GRState>* N, +static void HandleNotableSymbol(const ExplodedNode* N, const Stmt* S, SymbolRef Sym, BugReporter& BR, PathDiagnostic& PD) { - const ExplodedNode<GRState>* Pred = N->pred_empty() ? 0 : *N->pred_begin(); + const ExplodedNode* Pred = N->pred_empty() ? 0 : *N->pred_begin(); const GRState* PrevSt = Pred ? Pred->getState() : 0; if (!PrevSt) @@ -463,13 +463,13 @@ class VISIBILITY_HIDDEN ScanNotableSymbols : public StoreManager::BindingsHandler { llvm::SmallSet<SymbolRef, 10> AlreadyProcessed; - const ExplodedNode<GRState>* N; + const ExplodedNode* N; const Stmt* S; GRBugReporter& BR; PathDiagnostic& PD; public: - ScanNotableSymbols(const ExplodedNode<GRState>* n, const Stmt* s, + ScanNotableSymbols(const ExplodedNode* n, const Stmt* s, GRBugReporter& br, PathDiagnostic& pd) : N(n), S(s), BR(br), PD(pd) {} @@ -503,10 +503,10 @@ static void CompactPathDiagnostic(PathDiagnostic &PD, const SourceManager& SM); static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD, PathDiagnosticBuilder &PDB, - const ExplodedNode<GRState> *N) { + const ExplodedNode *N) { SourceManager& SMgr = PDB.getSourceManager(); - const ExplodedNode<GRState>* NextNode = N->pred_empty() + const ExplodedNode* NextNode = N->pred_empty() ? NULL : *(N->pred_begin()); while (NextNode) { N = NextNode; @@ -1113,12 +1113,12 @@ void EdgeBuilder::addContext(const Stmt *S) { static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD, PathDiagnosticBuilder &PDB, - const ExplodedNode<GRState> *N) { + const ExplodedNode *N) { EdgeBuilder EB(PD, PDB); - const ExplodedNode<GRState>* NextNode = N->pred_empty() + const ExplodedNode* NextNode = N->pred_empty() ? NULL : *(N->pred_begin()); while (NextNode) { N = NextNode; @@ -1221,7 +1221,7 @@ const Stmt* BugReport::getStmt(BugReporter& BR) const { PathDiagnosticPiece* BugReport::getEndPath(BugReporterContext& BRC, - const ExplodedNode<GRState>* EndPathNode) { + const ExplodedNode* EndPathNode) { const Stmt* S = getStmt(BRC.getBugReporter()); @@ -1269,8 +1269,8 @@ SourceLocation BugReport::getLocation() const { return FullSourceLoc(); } -PathDiagnosticPiece* BugReport::VisitNode(const ExplodedNode<GRState>* N, - const ExplodedNode<GRState>* PrevN, +PathDiagnosticPiece* BugReport::VisitNode(const ExplodedNode* N, + const ExplodedNode* PrevN, BugReporterContext &BRC) { return NULL; } @@ -1333,17 +1333,17 @@ void BugReporter::FlushReports() { //===----------------------------------------------------------------------===// static std::pair<std::pair<ExplodedGraph<GRState>*, NodeBackMap*>, - std::pair<ExplodedNode<GRState>*, unsigned> > + std::pair<ExplodedNode*, unsigned> > MakeReportGraph(const ExplodedGraph<GRState>* G, - const ExplodedNode<GRState>** NStart, - const ExplodedNode<GRState>** NEnd) { + const ExplodedNode** NStart, + const ExplodedNode** NEnd) { // Create the trimmed graph. It will contain the shortest paths from the // error nodes to the root. In the new graph we should only have one // error node unless there are two or more error nodes with the same minimum // path length. ExplodedGraph<GRState>* GTrim; - InterExplodedGraphMap<GRState>* NMap; + InterExplodedGraphMap* NMap; llvm::DenseMap<const void*, const void*> InverseMap; llvm::tie(GTrim, NMap) = G->Trim(NStart, NEnd, &InverseMap); @@ -1351,18 +1351,18 @@ MakeReportGraph(const ExplodedGraph<GRState>* G, // Create owning pointers for GTrim and NMap just to ensure that they are // released when this function exists. llvm::OwningPtr<ExplodedGraph<GRState> > AutoReleaseGTrim(GTrim); - llvm::OwningPtr<InterExplodedGraphMap<GRState> > AutoReleaseNMap(NMap); + llvm::OwningPtr<InterExplodedGraphMap> AutoReleaseNMap(NMap); // Find the (first) error node in the trimmed graph. We just need to consult // the node map (NMap) which maps from nodes in the original graph to nodes // in the new graph. - std::queue<const ExplodedNode<GRState>*> WS; - typedef llvm::DenseMap<const ExplodedNode<GRState>*,unsigned> IndexMapTy; + std::queue<const ExplodedNode*> WS; + typedef llvm::DenseMap<const ExplodedNode*,unsigned> IndexMapTy; IndexMapTy IndexMap; - for (const ExplodedNode<GRState>** I = NStart; I != NEnd; ++I) - if (const ExplodedNode<GRState> *N = NMap->getMappedNode(*I)) { + for (const ExplodedNode** I = NStart; I != NEnd; ++I) + if (const ExplodedNode *N = NMap->getMappedNode(*I)) { unsigned NodeIndex = (I - NStart) / sizeof(*I); WS.push(N); IndexMap[*I] = NodeIndex; @@ -1382,10 +1382,10 @@ MakeReportGraph(const ExplodedGraph<GRState>* G, llvm::DenseMap<const void*,unsigned> Visited; unsigned cnt = 0; - const ExplodedNode<GRState>* Root = 0; + const ExplodedNode* Root = 0; while (!WS.empty()) { - const ExplodedNode<GRState>* Node = WS.front(); + const ExplodedNode* Node = WS.front(); WS.pop(); if (Visited.find(Node) != Visited.end()) @@ -1398,7 +1398,7 @@ MakeReportGraph(const ExplodedGraph<GRState>* G, break; } - for (ExplodedNode<GRState>::const_pred_iterator I=Node->pred_begin(), + for (ExplodedNode::const_pred_iterator I=Node->pred_begin(), E=Node->pred_end(); I!=E; ++I) WS.push(*I); } @@ -1407,24 +1407,24 @@ MakeReportGraph(const ExplodedGraph<GRState>* G, // Now walk from the root down the BFS path, always taking the successor // with the lowest number. - ExplodedNode<GRState> *Last = 0, *First = 0; + ExplodedNode *Last = 0, *First = 0; NodeBackMap *BM = new NodeBackMap(); unsigned NodeIndex = 0; - for ( const ExplodedNode<GRState> *N = Root ;;) { + for ( const ExplodedNode *N = Root ;;) { // Lookup the number associated with the current node. llvm::DenseMap<const void*,unsigned>::iterator I = Visited.find(N); assert(I != Visited.end()); // Create the equivalent node in the new graph with the same state // and location. - ExplodedNode<GRState>* NewN = + ExplodedNode* NewN = GNew->getNode(N->getLocation(), N->getState()); // Store the mapping to the original node. llvm::DenseMap<const void*, const void*>::iterator IMitr=InverseMap.find(N); assert(IMitr != InverseMap.end() && "No mapping to original node."); - (*BM)[NewN] = (const ExplodedNode<GRState>*) IMitr->second; + (*BM)[NewN] = (const ExplodedNode*) IMitr->second; // Link up the new node with the previous node. if (Last) @@ -1434,7 +1434,7 @@ MakeReportGraph(const ExplodedGraph<GRState>* G, // Are we at the final node? IndexMapTy::iterator IMI = - IndexMap.find((const ExplodedNode<GRState>*)(IMitr->second)); + IndexMap.find((const ExplodedNode*)(IMitr->second)); if (IMI != IndexMap.end()) { First = NewN; NodeIndex = IMI->second; @@ -1443,8 +1443,8 @@ MakeReportGraph(const ExplodedGraph<GRState>* G, // Find the next successor node. We choose the node that is marked // with the lowest DFS number. - ExplodedNode<GRState>::const_succ_iterator SI = N->succ_begin(); - ExplodedNode<GRState>::const_succ_iterator SE = N->succ_end(); + ExplodedNode::const_succ_iterator SI = N->succ_begin(); + ExplodedNode::const_succ_iterator SE = N->succ_end(); N = 0; for (unsigned MinVal = 0; SI != SE; ++SI) { @@ -1564,10 +1564,10 @@ static void CompactPathDiagnostic(PathDiagnostic &PD, const SourceManager& SM) { void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, BugReportEquivClass& EQ) { - std::vector<const ExplodedNode<GRState>*> Nodes; + std::vector<const ExplodedNode*> Nodes; for (BugReportEquivClass::iterator I=EQ.begin(), E=EQ.end(); I!=E; ++I) { - const ExplodedNode<GRState>* N = I->getEndNode(); + const ExplodedNode* N = I->getEndNode(); if (N) Nodes.push_back(N); } @@ -1577,7 +1577,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, // Construct a new graph that contains only a single path from the error // node to a root. const std::pair<std::pair<ExplodedGraph<GRState>*, NodeBackMap*>, - std::pair<ExplodedNode<GRState>*, unsigned> >& + std::pair<ExplodedNode*, unsigned> >& GPair = MakeReportGraph(&getGraph(), &Nodes[0], &Nodes[0] + Nodes.size()); // Find the BugReport with the original location. @@ -1590,7 +1590,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, llvm::OwningPtr<ExplodedGraph<GRState> > ReportGraph(GPair.first.first); llvm::OwningPtr<NodeBackMap> BackMap(GPair.first.second); - const ExplodedNode<GRState> *N = GPair.second.first; + const ExplodedNode *N = GPair.second.first; // Start building the path diagnostic... PathDiagnosticBuilder PDB(*this, R, BackMap.get(), getPathDiagnosticClient()); diff --git a/lib/Analysis/BugReporterVisitors.cpp b/lib/Analysis/BugReporterVisitors.cpp index 2efa4c6857..77501bbba2 100644 --- a/lib/Analysis/BugReporterVisitors.cpp +++ b/lib/Analysis/BugReporterVisitors.cpp @@ -24,7 +24,7 @@ using namespace clang; // Utility functions. //===----------------------------------------------------------------------===// -const Stmt *clang::bugreporter::GetDerefExpr(const ExplodedNode<GRState> *N) { +const Stmt *clang::bugreporter::GetDerefExpr(const ExplodedNode *N) { // Pattern match for a few useful cases (do something smarter later): // a[0], p->f, *p const Stmt *S = N->getLocationAs<PostStmt>()->getStmt(); @@ -46,7 +46,7 @@ const Stmt *clang::bugreporter::GetDerefExpr(const ExplodedNode<GRState> *N) { } const Stmt* -clang::bugreporter::GetReceiverExpr(const ExplodedNode<GRState> *N){ +clang::bugreporter::GetReceiverExpr(const ExplodedNode *N){ const Stmt *S = N->getLocationAs<PostStmt>()->getStmt(); if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S)) return ME->getReceiver(); @@ -54,7 +54,7 @@ clang::bugreporter::GetReceiverExpr(const ExplodedNode<GRState> *N){ } const Stmt* -clang::bugreporter::GetDenomExpr(const ExplodedNode<GRState> *N) { +clang::bugreporter::GetDenomExpr(const ExplodedNode *N) { const Stmt *S = N->getLocationAs<PostStmt>()->getStmt(); if (const BinaryOperator *BE = dyn_cast<BinaryOperator>(S)) return BE->getRHS(); @@ -62,7 +62,7 @@ clang::bugreporter::GetDenomExpr(const ExplodedNode<GRState> *N) { } const Stmt* -clang::bugreporter::GetCalleeExpr(const ExplodedNode<GRState> *N) { +clang::bugreporter::GetCalleeExpr(const ExplodedNode *N) { const Stmt *S = N->getLocationAs<PostStmt>()->getStmt(); if (const CallExpr *CE = dyn_cast<CallExpr>(S)) return CE->getCallee(); @@ -70,7 +70,7 @@ clang::bugreporter::GetCalleeExpr(const ExplodedNode<GRState> *N) { } const Stmt* -clang::bugreporter::GetRetValExpr(const ExplodedNode<GRState> *N) { +clang::bugreporter::GetRetValExpr(const ExplodedNode *N) { const Stmt *S = N->getLocationAs<PostStmt>()->getStmt(); if (const ReturnStmt *RS = dyn_cast<ReturnStmt>(S)) return RS->getRetValue(); @@ -86,20 +86,20 @@ class VISIBILITY_HIDDEN FindLastStoreBRVisitor : public BugReporterVisitor { const MemRegion *R; SVal V; bool satisfied; - const ExplodedNode<GRState> *StoreSite; + const ExplodedNode *StoreSite; public: FindLastStoreBRVisitor(SVal v, const MemRegion *r) : R(r), V(v), satisfied(false), StoreSite(0) {} - PathDiagnosticPiece* VisitNode(const ExplodedNode<GRState> *N, - const ExplodedNode<GRState> *PrevN, + PathDiagnosticPiece* VisitNode(const ExplodedNode *N, + const ExplodedNode *PrevN, BugReporterContext& BRC) { if (satisfied) return NULL; if (!StoreSite) { - const ExplodedNode<GRState> *Node = N, *Last = NULL; + const ExplodedNode *Node = N, *Last = NULL; for ( ; Node ; Last = Node, Node = Node->getFirstPred()) { @@ -234,8 +234,8 @@ public: TrackConstraintBRVisitor(SVal constraint, bool assumption) : Constraint(constraint), Assumption(assumption), isSatisfied(false) {} - PathDiagnosticPiece* VisitNode(const ExplodedNode<GRState> *N, - const ExplodedNode<GRState> *PrevN, + PathDiagnosticPiece* VisitNode(const ExplodedNode *N, + const ExplodedNode *PrevN, BugReporterContext& BRC) { if (isSatisfied) return NULL; @@ -297,7 +297,7 @@ static void registerTrackConstraint(BugReporterContext& BRC, SVal Constraint, void clang::bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC, const Stmt *S, - const ExplodedNode<GRState>* N) { + const ExplodedNode* N) { if (!S) return; diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 23482ca4af..0b8b488bf0 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -178,8 +178,8 @@ public: GenericNodeBuilder(GREndPathNodeBuilder<GRState> &enb) : SNB(0), S(0), tag(0), ENB(&enb) {} - ExplodedNode<GRState> *MakeNode(const GRState *state, - ExplodedNode<GRState> *Pred) { + ExplodedNode *MakeNode(const GRState *state, + ExplodedNode *Pred) { if (SNB) return SNB->generateNode(PostStmt(S, tag), state, Pred); @@ -1853,21 +1853,21 @@ private: const GRState * Update(const GRState * state, SymbolRef sym, RefVal V, ArgEffect E, RefVal::Kind& hasErr); - void ProcessNonLeakError(ExplodedNodeSet<GRState>& Dst, + void ProcessNonLeakError(ExplodedNodeSet& Dst, GRStmtNodeBuilder<GRState>& Builder, Expr* NodeExpr, Expr* ErrorExpr, - ExplodedNode<GRState>* Pred, + ExplodedNode* Pred, const GRState* St, RefVal::Kind hasErr, SymbolRef Sym); const GRState * HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V, llvm::SmallVectorImpl<SymbolRef> &Leaked); - ExplodedNode<GRState>* ProcessLeaks(const GRState * state, + ExplodedNode* ProcessLeaks(const GRState * state, llvm::SmallVectorImpl<SymbolRef> &Leaked, GenericNodeBuilder &Builder, GRExprEngine &Eng, - ExplodedNode<GRState> *Pred = 0); + ExplodedNode *Pred = 0); public: CFRefCount(ASTContext& Ctx, bool gcenabled, const LangOptions& lopts) @@ -1888,40 +1888,40 @@ public: bool isGCEnabled() const { return Summaries.isGCEnabled(); } const LangOptions& getLangOptions() const { return LOpts; } - const RetainSummary *getSummaryOfNode(const ExplodedNode<GRState> *N) const { + const RetainSummary *getSummaryOfNode(const ExplodedNode *N) const { SummaryLogTy::const_iterator I = SummaryLog.find(N); return I == SummaryLog.end() ? 0 : I->second; } // Calls. - void EvalSummary(ExplodedNodeSet<GRState>& Dst, + void EvalSummary(ExplodedNodeSet& Dst, GRExprEngine& Eng, GRStmtNodeBuilder<GRState>& Builder, Expr* Ex, Expr* Receiver, const RetainSummary& Summ, ExprIterator arg_beg, ExprIterator arg_end, - ExplodedNode<GRState>* Pred); + ExplodedNode* Pred); - virtual void EvalCall(ExplodedNodeSet<GRState>& Dst, + virtual void EvalCall(ExplodedNodeSet& Dst, GRExprEngine& Eng, GRStmtNodeBuilder<GRState>& Builder, CallExpr* CE, SVal L, - ExplodedNode<GRState>* Pred); + ExplodedNode* Pred); - virtual void EvalObjCMessageExpr(ExplodedNodeSet<GRState>& Dst, + virtual void EvalObjCMessageExpr(ExplodedNodeSet& Dst, GRExprEngine& Engine, GRStmtNodeBuilder<GRState>& Builder, ObjCMessageExpr* ME, - ExplodedNode<GRState>* Pred); + ExplodedNode* Pred); - bool EvalObjCMessageExprAux(ExplodedNodeSet<GRState>& Dst, + bool EvalObjCMessageExprAux(ExplodedNodeSet& Dst, GRExprEngine& Engine, GRStmtNodeBuilder<GRState>& Builder, ObjCMessageExpr* ME, - ExplodedNode<GRState>* Pred); + ExplodedNode* Pred); // Stores. virtual void EvalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val); @@ -1931,24 +1931,24 @@ public: virtual void EvalEndPath(GRExprEngine& Engine, GREndPathNodeBuilder<GRState>& Builder); - virtual void EvalDeadSymbols(ExplodedNodeSet<GRState>& Dst, + virtual void EvalDeadSymbols(ExplodedNodeSet& Dst, GRExprEngine& Engine, GRStmtNodeBuilder<GRState>& Builder, - ExplodedNode<GRState>* Pred, + ExplodedNode* Pred, Stmt* S, const GRState* state, SymbolReaper& SymReaper); - std::pair<ExplodedNode<GRState>*, const GRState *> + std::pair<ExplodedNode*, const GRState *> HandleAutoreleaseCounts(const GRState * state, GenericNodeBuilder Bd, - ExplodedNode<GRState>* Pred, GRExprEngine &Eng, + ExplodedNode* Pred, GRExprEngine &Eng, SymbolRef Sym, RefVal V, bool &stop); // Return statements. - virtual void EvalReturn(ExplodedNodeSet<GRState>& Dst, + virtual void EvalReturn(ExplodedNodeSet& Dst, GRExprEngine& Engine, GRStmtNodeBuilder<GRState>& Builder, ReturnStmt* S, - ExplodedNode<GRState>* Pred); + ExplodedNode* Pred); // Assumptions. @@ -2123,11 +2123,11 @@ namespace { const CFRefCount &TF; public: CFRefReport(CFRefBug& D, const CFRefCount &tf, - ExplodedNode<GRState> *n, SymbolRef sym) + ExplodedNode *n, SymbolRef sym) : RangedBugReport(D, D.getDescription(), n), Sym(sym), TF(tf) {} CFRefReport(CFRefBug& D, const CFRefCount &tf, - ExplodedNode<GRState> *n, SymbolRef sym, const char* endText) + ExplodedNode *n, SymbolRef sym, const char* endText) : RangedBugReport(D, D.getDescription(), endText, n), Sym(sym), TF(tf) {} virtual ~CFRefReport() {} @@ -2151,12 +2151,12 @@ namespace { SymbolRef getSymbol() const { return Sym; } PathDiagnosticPiece* getEndPath(BugReporterContext& BRC, - const ExplodedNode<GRState>* N); + const ExplodedNode* N); std::pair<const char**,const char**> getExtraDescriptiveText(); - PathDiagnosticPiece* VisitNode(const ExplodedNode<GRState>* N, - const ExplodedNode<GRState>* PrevN, + PathDiagnosticPiece* VisitNode(const ExplodedNode* N, + const ExplodedNode* PrevN, BugReporterContext& BRC); }; @@ -2165,11 +2165,11 @@ namespace { const MemRegion* AllocBinding; public: CFRefLeakReport(CFRefBug& D, const CFRefCount &tf, - ExplodedNode<GRState> *n, SymbolRef sym, + ExplodedNode *n, SymbolRef sym, GRExprEngine& Eng); PathDiagnosticPiece* getEndPath(BugReporterContext& BRC, - const ExplodedNode<GRState>* N); + const ExplodedNode* N); SourceLocation getLocation() const { return AllocSite; } }; @@ -2273,8 +2273,8 @@ static inline bool contains(const llvm::SmallVectorImpl<ArgEffect>& V, return false; } -PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N, - const ExplodedNode<GRState>* PrevN, +PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N, + const ExplodedNode* PrevN, BugReporterContext& BRC) { if (!isa<PostStmt>(N->getLocation())) @@ -2548,13 +2548,13 @@ namespace { }; } -static std::pair<const ExplodedNode<GRState>*,const MemRegion*> -GetAllocationSite(GRStateManager& StateMgr, const ExplodedNode<GRState>* N, +static std::pair<const ExplodedNode*,const MemRegion*> +GetAllocationSite(GRStateManager& StateMgr, const ExplodedNode* N, SymbolRef Sym) { // Find both first node that referred to the tracked symbol and the // memory location that value was store to. - const ExplodedNode<GRState>* Last = N; + const ExplodedNode* Last = N; const MemRegion* FirstBinding = 0; while (N) { @@ -2577,7 +2577,7 @@ GetAllocationSite(GRStateManager& StateMgr, const ExplodedNode<GRState>* N, PathDiagnosticPiece* CFRefReport::getEndPath(BugReporterContext& BRC, - const ExplodedNode<GRState>* EndN) { + const ExplodedNode* EndN) { // Tell the BugReporterContext to report cases when the tracked symbol is // assigned to different variables, etc. BRC.addNotableSymbol(Sym); @@ -2586,7 +2586,7 @@ CFRefReport::getEndPath(BugReporterContext& BRC, PathDiagnosticPiece* CFRefLeakReport::getEndPath(BugReporterContext& BRC, - const ExplodedNode<GRState>* EndN){ + const ExplodedNode* EndN){ // Tell the BugReporterContext to report cases when the tracked symbol is // assigned to different variables, etc. @@ -2595,7 +2595,7 @@ CFRefLeakReport::getEndPath(BugReporterContext& BRC, // We are reporting a leak. Walk up the graph to get to the first node where // the symbol appeared, and also get the first VarDecl that tracked object // is stored to. - const ExplodedNode<GRState>* AllocNode = 0; + const ExplodedNode* AllocNode = 0; const MemRegion* FirstBinding = 0; llvm::tie(AllocNode, FirstBinding) = @@ -2611,7 +2611,7 @@ CFRefLeakReport::getEndPath(BugReporterContext& BRC, // Compute an actual location for the leak. Sometimes a leak doesn't // occur at an actual statement (e.g., transition between blocks; end // of function) so we need to walk the graph and compute a real location. - const ExplodedNode<GRState>* LeakN = EndN; + const ExplodedNode* LeakN = EndN; PathDiagnosticLocation L; while (LeakN) { @@ -2674,7 +2674,7 @@ CFRefLeakReport::getEndPath(BugReporterContext& BRC, } CFRefLeakReport::CFRefLeakReport(CFRefBug& D, const CFRefCount &tf, - ExplodedNode<GRState> *n, + ExplodedNode *n, SymbolRef sym, GRExprEngine& Eng) : CFRefReport(D, tf, n, sym) { @@ -2687,7 +2687,7 @@ CFRefLeakReport::CFRefLeakReport(CFRefBug& D, const CFRefCount &tf, // Note that this is *not* the trimmed graph; we are guaranteed, however, // that all ancestor nodes that represent the allocation site have the // same SourceLocation. - const ExplodedNode<GRState>* AllocNode = 0; + const ExplodedNode* AllocNode = 0; llvm::tie(AllocNode, AllocBinding) = // Set AllocBinding. GetAllocationSite(Eng.getStateManager(), getEndNode(), getSymbol()); @@ -2741,14 +2741,14 @@ static QualType GetReturnType(const Expr* RetE, ASTContext& Ctx) { return RetTy; } -void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst, +void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, GRExprEngine& Eng, GRStmtNodeBuilder<GRState>& Builder, Expr* Ex, Expr* Receiver, const RetainSummary& Summ, ExprIterator arg_beg, ExprIterator arg_end, - ExplodedNode<GRState>* Pred) { + ExplodedNode* Pred) { // Get the state. const GRState *state = Builder.GetState(Pred); @@ -2962,11 +2962,11 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst, } -void CFRefCount::EvalCall(ExplodedNodeSet<GRState>& Dst, +void CFRefCount::EvalCall(ExplodedNodeSet& Dst, GRExprEngine& Eng, GRStmtNodeBuilder<GRState>& Builder, CallExpr* CE, SVal L, - ExplodedNode<GRState>* Pred) { + ExplodedNode* Pred) { const FunctionDecl* FD = L.getAsFunctionDecl(); RetainSummary* Summ = !FD ? Summaries.getDefaultSummary() : Summaries.getSummary(const_cast<FunctionDecl*>(FD)); @@ -2976,11 +2976,11 @@ void CFRefCount::EvalCall(ExplodedNodeSet<GRState>& Dst, CE->arg_begin(), CE->arg_end(), Pred); } -void CFRefCount::EvalObjCMessageExpr(ExplodedNodeSet<GRState>& Dst, +void CFRefCount::EvalObjCMessageExpr(ExplodedNodeSet& Dst, GRExprEngine& Eng, GRStmtNodeBuilder<GRState>& Builder, ObjCMessageExpr* ME, - ExplodedNode<GRState>* Pred) { + ExplodedNode* Pred) { RetainSummary* Summ = 0; if (Expr* Receiver = ME->getReceiver()) { @@ -3096,11 +3096,11 @@ void CFRefCount::EvalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val) { // Return statements. -void CFRefCount::EvalReturn(ExplodedNodeSet<GRState>& Dst, +void CFRefCount::EvalReturn(ExplodedNodeSet& Dst, GRExprEngine& Eng, GRStmtNodeBuilder<GRState>& Builder, ReturnStmt* S, - ExplodedNode<GRState>* Pred) { + ExplodedNode* Pred) { Expr* RetE = S->getRetValue(); if (!RetE) @@ -3202,7 +3202,7 @@ void CFRefCount::EvalReturn(ExplodedNodeSet<GRState>& Dst, // Generate an error node. static int ReturnOwnLeakTag = 0; state = state->set<RefBindings>(Sym, X); - ExplodedNode<GRState> *N = + ExplodedNode *N = Builder.generateNode(PostStmt(S, &ReturnOwnLeakTag), state, Pred); if (N) { CFRefReport *report = @@ -3223,7 +3223,7 @@ void CFRefCount::EvalReturn(ExplodedNodeSet<GRState>& Dst, s |