From: Ted Kremenek Date: Tue, 11 Jan 2011 02:34:50 +0000 (+0000) Subject: Rename misc. methods in ento::Worklist to start X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=55825aa2d88fe82bf3622f195046ae48532d3106;p=clang Rename misc. methods in ento::Worklist to start with lowercase letter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123212 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h index ab2cf3bebd..ab4634fde4 100644 --- a/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h +++ b/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h @@ -133,7 +133,7 @@ public: /// a DFS exploration of the exploded graph. CoreEngine(SubEngine& subengine) : SubEng(subengine), G(new ExplodedGraph()), - WList(WorkList::MakeBFS()), + WList(WorkList::makeBFS()), BCounterFactory(G->getAllocator()) {} /// Construct a CoreEngine object to analyze the provided CFG and to diff --git a/include/clang/StaticAnalyzer/PathSensitive/WorkList.h b/include/clang/StaticAnalyzer/PathSensitive/WorkList.h index be909061cd..e44375394c 100644 --- a/include/clang/StaticAnalyzer/PathSensitive/WorkList.h +++ b/include/clang/StaticAnalyzer/PathSensitive/WorkList.h @@ -28,29 +28,36 @@ class ExplodedNode; class ExplodedNodeImpl; class WorkListUnit { - ExplodedNode* Node; - BlockCounter Counter; - const CFGBlock* Block; - unsigned BlockIdx; // This is the index of the next statement. + ExplodedNode* node; + BlockCounter counter; + const CFGBlock* block; + unsigned blockIdx; // This is the index of the next statement. public: WorkListUnit(ExplodedNode* N, BlockCounter C, - const CFGBlock* B, unsigned idx) - : Node(N), - Counter(C), - Block(B), - BlockIdx(idx) {} + const CFGBlock* B, unsigned idx) + : node(N), + counter(C), + block(B), + blockIdx(idx) {} explicit WorkListUnit(ExplodedNode* N, BlockCounter C) - : Node(N), - Counter(C), - Block(NULL), - BlockIdx(0) {} - - ExplodedNode* getNode() const { return Node; } - BlockCounter getBlockCounter() const { return Counter; } - const CFGBlock* getBlock() const { return Block; } - unsigned getIndex() const { return BlockIdx; } + : node(N), + counter(C), + block(NULL), + blockIdx(0) {} + + /// Returns the node associated with the worklist unit. + ExplodedNode *getNode() const { return node; } + + /// Returns the block counter map associated with the worklist unit. + BlockCounter getBlockCounter() const { return counter; } + + /// Returns the CFGblock associated with the worklist unit. + const CFGBlock *getBlock() const { return block; } + + /// Return the index within the CFGBlock for the worklist unit. + unsigned getIndex() const { return blockIdx; } }; class WorkList { @@ -59,17 +66,17 @@ public: virtual ~WorkList(); virtual bool hasWork() const = 0; - virtual void Enqueue(const WorkListUnit& U) = 0; + virtual void enqueue(const WorkListUnit& U) = 0; - void Enqueue(ExplodedNode* N, const CFGBlock* B, unsigned idx) { - Enqueue(WorkListUnit(N, CurrentCounter, B, idx)); + void enqueue(ExplodedNode *N, const CFGBlock *B, unsigned idx) { + enqueue(WorkListUnit(N, CurrentCounter, B, idx)); } - void Enqueue(ExplodedNode* N) { - Enqueue(WorkListUnit(N, CurrentCounter)); + void enqueue(ExplodedNode *N) { + enqueue(WorkListUnit(N, CurrentCounter)); } - virtual WorkListUnit Dequeue() = 0; + virtual WorkListUnit dequeue() = 0; void setBlockCounter(BlockCounter C) { CurrentCounter = C; } BlockCounter getBlockCounter() const { return CurrentCounter; } @@ -78,13 +85,13 @@ public: public: Visitor() {} virtual ~Visitor(); - virtual bool Visit(const WorkListUnit &U) = 0; + virtual bool visit(const WorkListUnit &U) = 0; }; - virtual bool VisitItemsInWorkList(Visitor &V) = 0; + virtual bool visitItemsInWorkList(Visitor &V) = 0; - static WorkList *MakeDFS(); - static WorkList *MakeBFS(); - static WorkList *MakeBFSBlockDFSContents(); + static WorkList *makeDFS(); + static WorkList *makeBFS(); + static WorkList *makeBFSBlockDFSContents(); }; } // end GR namespace diff --git a/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp b/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp index 435d3d4a48..ecae797595 100644 --- a/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp @@ -577,7 +577,7 @@ bool IdempotentOperationChecker::PathWasCompletelyAnalyzed( VisitWL(const CFGStmtMap *cbm, const CFGBlock *targetBlock, CFGReachabilityAnalysis &cra) : CBM(cbm), TargetBlock(targetBlock), CRA(cra) {} - virtual bool Visit(const WorkListUnit &U) { + virtual bool visit(const WorkListUnit &U) { ProgramPoint P = U.getNode()->getLocation(); const CFGBlock *B = 0; if (StmtPoint *SP = dyn_cast(&P)) { @@ -601,7 +601,7 @@ bool IdempotentOperationChecker::PathWasCompletelyAnalyzed( VisitWL visitWL(CBM, CB, CRA); // Were there any items in the worklist that could potentially reach // this block? - if (CE.getWorkList()->VisitItemsInWorkList(visitWL)) + if (CE.getWorkList()->visitItemsInWorkList(visitWL)) return false; // Verify that this block is reachable from the entry block diff --git a/lib/StaticAnalyzer/CoreEngine.cpp b/lib/StaticAnalyzer/CoreEngine.cpp index 47fc1edd8e..5c02bd34f4 100644 --- a/lib/StaticAnalyzer/CoreEngine.cpp +++ b/lib/StaticAnalyzer/CoreEngine.cpp @@ -49,21 +49,21 @@ public: return !Stack.empty(); } - virtual void Enqueue(const WorkListUnit& U) { + virtual void enqueue(const WorkListUnit& U) { Stack.push_back(U); } - virtual WorkListUnit Dequeue() { + virtual WorkListUnit dequeue() { assert (!Stack.empty()); const WorkListUnit& U = Stack.back(); Stack.pop_back(); // This technically "invalidates" U, but we are fine. return U; } - virtual bool VisitItemsInWorkList(Visitor &V) { + virtual bool visitItemsInWorkList(Visitor &V) { for (llvm::SmallVectorImpl::iterator I = Stack.begin(), E = Stack.end(); I != E; ++I) { - if (V.Visit(*I)) + if (V.visit(*I)) return true; } return false; @@ -77,20 +77,20 @@ public: return !Queue.empty(); } - virtual void Enqueue(const WorkListUnit& U) { + virtual void enqueue(const WorkListUnit& U) { Queue.push_front(U); } - virtual WorkListUnit Dequeue() { + virtual WorkListUnit dequeue() { WorkListUnit U = Queue.front(); Queue.pop_front(); return U; } - virtual bool VisitItemsInWorkList(Visitor &V) { + virtual bool visitItemsInWorkList(Visitor &V) { for (std::deque::iterator I = Queue.begin(), E = Queue.end(); I != E; ++I) { - if (V.Visit(*I)) + if (V.visit(*I)) return true; } return false; @@ -103,8 +103,8 @@ public: // functions, and we the code for the dstor generated in one compilation unit. WorkList::~WorkList() {} -WorkList *WorkList::MakeDFS() { return new DFS(); } -WorkList *WorkList::MakeBFS() { return new BFS(); } +WorkList *WorkList::makeDFS() { return new DFS(); } +WorkList *WorkList::makeBFS() { return new BFS(); } namespace { class BFSBlockDFSContents : public WorkList { @@ -115,14 +115,14 @@ namespace { return !Queue.empty() || !Stack.empty(); } - virtual void Enqueue(const WorkListUnit& U) { + virtual void enqueue(const WorkListUnit& U) { if (isa(U.getNode()->getLocation())) Queue.push_front(U); else Stack.push_back(U); } - virtual WorkListUnit Dequeue() { + virtual WorkListUnit dequeue() { // Process all basic blocks to completion. if (!Stack.empty()) { const WorkListUnit& U = Stack.back(); @@ -137,15 +137,15 @@ namespace { Queue.pop_front(); return U; } - virtual bool VisitItemsInWorkList(Visitor &V) { + virtual bool visitItemsInWorkList(Visitor &V) { for (llvm::SmallVectorImpl::iterator I = Stack.begin(), E = Stack.end(); I != E; ++I) { - if (V.Visit(*I)) + if (V.visit(*I)) return true; } for (std::deque::iterator I = Queue.begin(), E = Queue.end(); I != E; ++I) { - if (V.Visit(*I)) + if (V.visit(*I)) return true; } return false; @@ -154,7 +154,7 @@ namespace { }; } // end anonymous namespace -WorkList* WorkList::MakeBFSBlockDFSContents() { +WorkList* WorkList::makeBFSBlockDFSContents() { return new BFSBlockDFSContents(); } @@ -204,7 +204,7 @@ bool CoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps, --Steps; } - const WorkListUnit& WU = WList->Dequeue(); + const WorkListUnit& WU = WList->dequeue(); // Set the current block counter. WList->setBlockCounter(WU.getBlockCounter()); @@ -445,7 +445,7 @@ void CoreEngine::generateNode(const ProgramPoint& Loc, } // Only add 'Node' to the worklist if it was freshly generated. - if (IsNew) WList->Enqueue(Node); + if (IsNew) WList->enqueue(Node); } StmtNodeBuilder::StmtNodeBuilder(const CFGBlock* b, unsigned idx, @@ -471,13 +471,13 @@ void StmtNodeBuilder::GenerateAutoTransition(ExplodedNode* N) { if (isa(N->getLocation())) { // Still use the index of the CallExpr. It's needed to create the callee // StackFrameContext. - Eng.WList->Enqueue(N, &B, Idx); + Eng.WList->enqueue(N, &B, Idx); return; } // Do not create extra nodes. Move to the next CFG element. if (isa(N->getLocation())) { - Eng.WList->Enqueue(N, &B, Idx+1); + Eng.WList->enqueue(N, &B, Idx+1); return; } @@ -486,7 +486,7 @@ void StmtNodeBuilder::GenerateAutoTransition(ExplodedNode* N) { if (Loc == N->getLocation()) { // Note: 'N' should be a fresh node because otherwise it shouldn't be // a member of Deferred. - Eng.WList->Enqueue(N, &B, Idx+1); + Eng.WList->enqueue(N, &B, Idx+1); return; } @@ -495,7 +495,7 @@ void StmtNodeBuilder::GenerateAutoTransition(ExplodedNode* N) { Succ->addPredecessor(N, *Eng.G); if (IsNew) - Eng.WList->Enqueue(Succ, &B, Idx+1); + Eng.WList->enqueue(Succ, &B, Idx+1); } ExplodedNode* StmtNodeBuilder::MakeNode(ExplodedNodeSet& Dst, const Stmt* S, @@ -598,7 +598,7 @@ BranchNodeBuilder::~BranchNodeBuilder() { if (!GeneratedFalse) generateNode(Pred->State, false); for (DeferredTy::iterator I=Deferred.begin(), E=Deferred.end(); I!=E; ++I) - if (!(*I)->isSink()) Eng.WList->Enqueue(*I); + if (!(*I)->isSink()) Eng.WList->enqueue(*I); } @@ -617,7 +617,7 @@ IndirectGotoNodeBuilder::generateNode(const iterator& I, const GRState* St, if (isSink) Succ->markAsSink(); else - Eng.WList->Enqueue(Succ); + Eng.WList->enqueue(Succ); return Succ; } @@ -636,7 +636,7 @@ SwitchNodeBuilder::generateCaseStmtNode(const iterator& I, const GRState* St){ Succ->addPredecessor(Pred, *Eng.G); if (IsNew) { - Eng.WList->Enqueue(Succ); + Eng.WList->enqueue(Succ); return Succ; } @@ -661,7 +661,7 @@ SwitchNodeBuilder::generateDefaultCaseNode(const GRState* St, bool isSink) { if (isSink) Succ->markAsSink(); else - Eng.WList->Enqueue(Succ); + Eng.WList->enqueue(Succ); return Succ; } @@ -714,7 +714,7 @@ void EndOfFunctionNodeBuilder::GenerateCallExitNode(const GRState *state) { Node->addPredecessor(Pred, *Eng.G); if (isNew) - Eng.WList->Enqueue(Node); + Eng.WList->enqueue(Node); } @@ -790,7 +790,7 @@ void CallEnterNodeBuilder::generateNode(const GRState *state) { Node->addPredecessor(const_cast(Pred), *Eng.G); if (isNew) - Eng.WList->Enqueue(Node); + Eng.WList->enqueue(Node); } void CallExitNodeBuilder::generateNode(const GRState *state) { @@ -804,6 +804,6 @@ void CallExitNodeBuilder::generateNode(const GRState *state) { ExplodedNode *Node = Eng.G->getNode(Loc, state, &isNew); Node->addPredecessor(const_cast(Pred), *Eng.G); if (isNew) - Eng.WList->Enqueue(Node, LocCtx->getCallSiteBlock(), + Eng.WList->enqueue(Node, LocCtx->getCallSiteBlock(), LocCtx->getIndex() + 1); }