[cfe-commits] r123212 - in /cfe/trunk: include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h include/clang/StaticAnalyzer/PathSensitive/WorkList.h lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp lib/StaticAnalyzer/CoreEngine.cpp

Ted Kremenek kremenek at apple.com
Mon Jan 10 18:34:50 PST 2011


Author: kremenek
Date: Mon Jan 10 20:34:50 2011
New Revision: 123212

URL: http://llvm.org/viewvc/llvm-project?rev=123212&view=rev
Log:
Rename misc. methods in ento::Worklist to start
with lowercase letter.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h
    cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/WorkList.h
    cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h?rev=123212&r1=123211&r2=123212&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h Mon Jan 10 20:34:50 2011
@@ -133,7 +133,7 @@
   ///  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

Modified: cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/WorkList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/WorkList.h?rev=123212&r1=123211&r2=123212&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/WorkList.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/WorkList.h Mon Jan 10 20:34:50 2011
@@ -28,29 +28,36 @@
 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 @@
   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:
     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

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp?rev=123212&r1=123211&r2=123212&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp Mon Jan 10 20:34:50 2011
@@ -577,7 +577,7 @@
     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<StmtPoint>(&P)) {
@@ -601,7 +601,7 @@
   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

Modified: cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp?rev=123212&r1=123211&r2=123212&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp Mon Jan 10 20:34:50 2011
@@ -49,21 +49,21 @@
     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<WorkListUnit>::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 @@
     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<WorkListUnit>::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 @@
 // 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 @@
       return !Queue.empty() || !Stack.empty();
     }
 
-    virtual void Enqueue(const WorkListUnit& U) {
+    virtual void enqueue(const WorkListUnit& U) {
       if (isa<BlockEntrance>(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 @@
       Queue.pop_front();
       return U;
     }
-    virtual bool VisitItemsInWorkList(Visitor &V) {
+    virtual bool visitItemsInWorkList(Visitor &V) {
       for (llvm::SmallVectorImpl<WorkListUnit>::iterator
            I = Stack.begin(), E = Stack.end(); I != E; ++I) {
-        if (V.Visit(*I))
+        if (V.visit(*I))
           return true;
       }
       for (std::deque<WorkListUnit>::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 @@
   };
 } // end anonymous namespace
 
-WorkList* WorkList::MakeBFSBlockDFSContents() {
+WorkList* WorkList::makeBFSBlockDFSContents() {
   return new BFSBlockDFSContents();
 }
 
@@ -204,7 +204,7 @@
       --Steps;
     }
 
-    const WorkListUnit& WU = WList->Dequeue();
+    const WorkListUnit& WU = WList->dequeue();
 
     // Set the current block counter.
     WList->setBlockCounter(WU.getBlockCounter());
@@ -445,7 +445,7 @@
   }
 
   // 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 @@
   if (isa<CallEnter>(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<PostInitializer>(N->getLocation())) {
-    Eng.WList->Enqueue(N, &B, Idx+1);
+    Eng.WList->enqueue(N, &B, Idx+1);
     return;
   }
 
@@ -486,7 +486,7 @@
   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 @@
   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 @@
   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 @@
     if (isSink)
       Succ->markAsSink();
     else
-      Eng.WList->Enqueue(Succ);
+      Eng.WList->enqueue(Succ);
 
     return Succ;
   }
@@ -636,7 +636,7 @@
   Succ->addPredecessor(Pred, *Eng.G);
 
   if (IsNew) {
-    Eng.WList->Enqueue(Succ);
+    Eng.WList->enqueue(Succ);
     return Succ;
   }
 
@@ -661,7 +661,7 @@
     if (isSink)
       Succ->markAsSink();
     else
-      Eng.WList->Enqueue(Succ);
+      Eng.WList->enqueue(Succ);
 
     return Succ;
   }
@@ -714,7 +714,7 @@
   Node->addPredecessor(Pred, *Eng.G);
 
   if (isNew)
-    Eng.WList->Enqueue(Node);
+    Eng.WList->enqueue(Node);
 }
                                                 
 
@@ -790,7 +790,7 @@
   Node->addPredecessor(const_cast<ExplodedNode*>(Pred), *Eng.G);
 
   if (isNew)
-    Eng.WList->Enqueue(Node);
+    Eng.WList->enqueue(Node);
 }
 
 void CallExitNodeBuilder::generateNode(const GRState *state) {
@@ -804,6 +804,6 @@
   ExplodedNode *Node = Eng.G->getNode(Loc, state, &isNew);
   Node->addPredecessor(const_cast<ExplodedNode*>(Pred), *Eng.G);
   if (isNew)
-    Eng.WList->Enqueue(Node, LocCtx->getCallSiteBlock(),
+    Eng.WList->enqueue(Node, LocCtx->getCallSiteBlock(),
                        LocCtx->getIndex() + 1);
 }





More information about the cfe-commits mailing list