[cfe-commits] r41794 - in /cfe/trunk: Analysis/DeadStores.cpp Analysis/LiveVariables.cpp include/clang/Analysis/LiveVariables.h

Ted Kremenek kremenek at apple.com
Mon Sep 10 08:56:38 PDT 2007


Author: kremenek
Date: Mon Sep 10 10:56:38 2007
New Revision: 41794

URL: http://llvm.org/viewvc/llvm-project?rev=41794&view=rev
Log:
Renaming of the LiveVariablesAuditor interface.  Changed "Auditor" and
"Audit" to "Observer" and "Observe"

Modified:
    cfe/trunk/Analysis/DeadStores.cpp
    cfe/trunk/Analysis/LiveVariables.cpp
    cfe/trunk/include/clang/Analysis/LiveVariables.h

Modified: cfe/trunk/Analysis/DeadStores.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/DeadStores.cpp?rev=41794&r1=41793&r2=41794&view=diff

==============================================================================
--- cfe/trunk/Analysis/DeadStores.cpp (original)
+++ cfe/trunk/Analysis/DeadStores.cpp Mon Sep 10 10:56:38 2007
@@ -23,13 +23,13 @@
 
 namespace {
 
-class DeadStoreAuditor : public LiveVariablesAuditor {
+class DeadStoreObserver : public LiveVariablesObserver {
   Preprocessor& PP;
 public:
-  DeadStoreAuditor(Preprocessor& pp) : PP(pp) {}
-  virtual ~DeadStoreAuditor() {}
+  DeadStoreObserver(Preprocessor& pp) : PP(pp) {}
+  virtual ~DeadStoreObserver() {}
 
-  virtual void AuditStmt(Stmt* S, LiveVariables& L, llvm::BitVector& Live) {                                 
+  virtual void ObserveStmt(Stmt* S, LiveVariables& L, llvm::BitVector& Live) {                                 
     if (BinaryOperator* B = dyn_cast<BinaryOperator>(S)) {    
       // Is this an assignment?
       if (!B->isAssignmentOp())
@@ -68,7 +68,7 @@
 namespace clang {
 
 void CheckDeadStores(CFG& cfg, LiveVariables& L, Preprocessor& PP) {
-  DeadStoreAuditor A(PP);
+  DeadStoreObserver A(PP);
   
   for (CFG::iterator I = cfg.begin(), E = cfg.end(); I != E; ++I)
     L.runOnBlock(&(*I),&A);

Modified: cfe/trunk/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/LiveVariables.cpp?rev=41794&r1=41793&r2=41794&view=diff

==============================================================================
--- cfe/trunk/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/Analysis/LiveVariables.cpp Mon Sep 10 10:56:38 2007
@@ -117,11 +117,11 @@
   Stmt* CurrentStmt;
   const CFGBlock* CurrentBlock;
   bool blockPreviouslyProcessed;
-  LiveVariablesAuditor* Auditor;
+  LiveVariablesObserver* Observer;
 public:
-  LivenessTFuncs(LiveVariables& l, LiveVariablesAuditor* A = NULL)
+  LivenessTFuncs(LiveVariables& l, LiveVariablesObserver* A = NULL)
     : L(l), CurrentStmt(NULL), CurrentBlock(NULL),
-      blockPreviouslyProcessed(false), Auditor(A)
+      blockPreviouslyProcessed(false), Observer(A)
   {
     Live.resize(l.getNumDecls());
     KilledAtLeastOnce.resize(l.getNumDecls());
@@ -148,8 +148,8 @@
 };
 
 void LivenessTFuncs::VisitStmt(Stmt* S) {
-  if (Auditor)
-    Auditor->AuditStmt(S,L,Live);
+  if (Observer)
+    Observer->ObserveStmt(S,L,Live);
     
   // Evaluate the transfer functions for all subexpressions.  Note that
   // each invocation of "Visit" will have a side-effect: "Liveness" and "Kills"
@@ -159,8 +159,8 @@
 }
 
 void LivenessTFuncs::VisitDeclRefExpr(DeclRefExpr* DR) {
-  if (Auditor)
-    Auditor->AuditStmt(DR,L,Live);
+  if (Observer)
+    Observer->ObserveStmt(DR,L,Live);
     
   // Register a use of the variable.
   Live.set(getIdx(DR->getDecl()));
@@ -240,8 +240,8 @@
 }  
 
 void LivenessTFuncs::VisitAssign(BinaryOperator* B) {
-  if (Auditor)
-    Auditor->AuditStmt(B,L,Live);
+  if (Observer)
+    Observer->ObserveStmt(B,L,Live);
     
   // Check if we are assigning to a variable.
   Stmt* LHS = B->getLHS();
@@ -264,8 +264,8 @@
 }
 
 void LivenessTFuncs::VisitDeclStmt(DeclStmt* DS) {
-  if (Auditor)
-    Auditor->AuditStmt(DS,L,Live);
+  if (Observer)
+    Observer->ObserveStmt(DS,L,Live);
     
   // Declarations effectively "kill" a variable since they cannot possibly
   // be live before they are declared.  Declarations, however, are not kills
@@ -299,8 +299,8 @@
     if (llvm::BitVector* V = getBlockEntryLiveness(*I))    
       Live |= *V;
 
-  if (Auditor)
-    Auditor->AuditBlockExit(B,L,Live);
+  if (Observer)
+    Observer->ObserveBlockExit(B,L,Live);
       
   // Tentatively mark all variables alive at the end of the current block
   // as being alive during the whole block.  We then cull these out as
@@ -343,7 +343,7 @@
 // runOnCFG - Method to run the actual liveness computation.
 //
 
-void LiveVariables::runOnCFG(const CFG& cfg, LiveVariablesAuditor* Auditor) {
+void LiveVariables::runOnCFG(const CFG& cfg, LiveVariablesObserver* Observer) {
   // Scan a CFG for DeclRefStmts.  For each one, create a VarInfo object.
   {
     RegisterDecls R(*this,cfg);
@@ -355,7 +355,7 @@
   WorkList.enqueue(&cfg.getExit());
   
   // Create the state for transfer functions.
-  LivenessTFuncs TF(*this,Auditor);
+  LivenessTFuncs TF(*this,Observer);
   
   // Process the worklist until it is empty.
   
@@ -374,9 +374,10 @@
 }
 
 
-void LiveVariables::runOnBlock(const CFGBlock* B, LiveVariablesAuditor* Auditor)
+void LiveVariables::runOnBlock(const CFGBlock* B,
+                               LiveVariablesObserver* Observer)
 {
-  LivenessTFuncs TF(*this,Auditor);
+  LivenessTFuncs TF(*this,Observer);
   TF.ProcessBlock(B);
 }
 
@@ -423,13 +424,14 @@
 }
 
 //===----------------------------------------------------------------------===//
-// Defaults for LiveVariablesAuditor
+// Defaults for LiveVariablesObserver
 
-void LiveVariablesAuditor::AuditStmt(Stmt* S, LiveVariables& L,
-                                     llvm::BitVector& V) {}
+void LiveVariablesObserver::ObserveStmt(Stmt* S, LiveVariables& L,
+                                        llvm::BitVector& V) {}
 
-void LiveVariablesAuditor::AuditBlockExit(const CFGBlock* B, LiveVariables& L,
-                                          llvm::BitVector& V) {}
+void LiveVariablesObserver::ObserveBlockExit(const CFGBlock* B,
+                                             LiveVariables& L,
+                                             llvm::BitVector& V) {}
                             
 //===----------------------------------------------------------------------===//
 // printing liveness state for debugging

Modified: cfe/trunk/include/clang/Analysis/LiveVariables.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/LiveVariables.h?rev=41794&r1=41793&r2=41794&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/LiveVariables.h (original)
+++ cfe/trunk/include/clang/Analysis/LiveVariables.h Mon Sep 10 10:56:38 2007
@@ -28,23 +28,23 @@
   class SourceManager;
   class LiveVariables;
   
-class LiveVariablesAuditor {
+class LiveVariablesObserver {
 public:
-  virtual ~LiveVariablesAuditor() {}
+  virtual ~LiveVariablesObserver() {}
 
-  /// AuditStmt - A callback invoked right before invoking the liveness
+  /// ObserveStmt - A callback invoked right before invoking the liveness
   ///  transfer function on the given statement.  If the liveness information
   ///  has been previously calculated by running LiveVariables::runOnCFG,
   ///  then V contains the liveness information after the execution of
   ///  the given statement.
-  virtual void AuditStmt(Stmt* S, LiveVariables& L, llvm::BitVector& V);
+  virtual void ObserveStmt(Stmt* S, LiveVariables& L, llvm::BitVector& V);
 
-  /// AuditBlockExit - A callback invoked right before invoking the liveness
+  /// ObserveBlockExit - A callback invoked right before invoking the liveness
   ///  transfer function on the given block.  If the liveness information
   ///  has been previously calculated by running LiveVariables::runOnCFG,
   ///  then V contains the liveness information after the execution of
   ///  the given block.
-  virtual void AuditBlockExit(const CFGBlock* B, LiveVariables& L,
+  virtual void ObserveBlockExit(const CFGBlock* B, LiveVariables& L,
                               llvm::BitVector& V);  
 };
 
@@ -70,7 +70,7 @@
     void AddKill(Stmt* S, DeclRefExpr* DR) {
       Kills.push_back(std::make_pair(const_cast<const Stmt*>(S),
                                      const_cast<const DeclRefExpr*>(DR)));
-    }
+    }                                 
   };
   
   struct VPair {
@@ -86,13 +86,13 @@
   LiveVariables() : NumDecls(0) {}
 
   /// runOnCFG - Computes live variable information for a given CFG.
-  void runOnCFG(const CFG& cfg, LiveVariablesAuditor* A = NULL);
+  void runOnCFG(const CFG& cfg, LiveVariablesObserver* A = NULL);
   
   /// runOnBlock - Computes live variable information for a given block.
   ///  This should usually be invoked only after previously computing
   ///  live variable information using runOnCFG, and is intended to
   ///  only be used for auditing the liveness within a block.
-  void runOnBlock(const CFGBlock* B, LiveVariablesAuditor* A);
+  void runOnBlock(const CFGBlock* B, LiveVariablesObserver* A);
   
   /// KillsVar - Return true if the specified statement kills the
   ///  specified variable.
@@ -104,7 +104,7 @@
   
   /// IsLive - Return true if a variable is live according to the provided
   ///  livness bitvector.  This is typically used by classes that subclass
-  ///  LiveVariablesAuditor.
+  ///  LiveVariablesObserver.
   bool isLive(llvm::BitVector& V, const Decl* D) const;
   
   /// getVarInfo - Return the liveness information associated with a given





More information about the cfe-commits mailing list