[cfe-commits] r59284 - in /cfe/trunk: include/clang/Analysis/Analyses/LiveVariables.h include/clang/Analysis/Analyses/UninitializedValues.h include/clang/Analysis/Support/BlkExprDeclBitVector.h include/clang/Analysis/Support/ExprDeclBitVector.h lib/Analysis/LiveVariables.cpp lib/Analysis/UninitializedValues.cpp

Ted Kremenek kremenek at apple.com
Thu Nov 13 17:14:18 PST 2008


Author: kremenek
Date: Thu Nov 13 19:14:18 2008
New Revision: 59284

URL: http://llvm.org/viewvc/llvm-project?rev=59284&view=rev
Log:
Rename header file.
Update include files.

Added:
    cfe/trunk/include/clang/Analysis/Support/BlkExprDeclBitVector.h   (props changed)
      - copied unchanged from r59283, cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h
Removed:
    cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h
Modified:
    cfe/trunk/include/clang/Analysis/Analyses/LiveVariables.h
    cfe/trunk/include/clang/Analysis/Analyses/UninitializedValues.h
    cfe/trunk/lib/Analysis/LiveVariables.cpp
    cfe/trunk/lib/Analysis/UninitializedValues.cpp

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/LiveVariables.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/LiveVariables.h Thu Nov 13 19:14:18 2008
@@ -15,7 +15,7 @@
 #define LLVM_CLANG_LIVEVARIABLES_H
 
 #include "clang/AST/Decl.h"
-#include "clang/Analysis/Support/ExprDeclBitVector.h"
+#include "clang/Analysis/Support/BlkExprDeclBitVector.h"
 #include "clang/Analysis/FlowSensitive/DataflowValues.h"
 
 namespace clang {
@@ -29,14 +29,14 @@
   struct ObserverTy;
 
   // We keep dataflow state for declarations and block-level expressions;
-  typedef ExprDeclBitVector_Types::ValTy ValTy;
+  typedef StmtDeclBitVector_Types::ValTy ValTy;
 
   // We need to keep track of both declarations and CFGBlock-level expressions,
   // (so that we don't explore such expressions twice).  We also want
   // to compute liveness information for block-level expressions, since these
   // act as "temporary" values.
   
-  struct AnalysisDataTy : public ExprDeclBitVector_Types::AnalysisDataTy {
+  struct AnalysisDataTy : public StmtDeclBitVector_Types::AnalysisDataTy {
     ObserverTy* Observer;
     ValTy AlwaysLive;
     

Modified: cfe/trunk/include/clang/Analysis/Analyses/UninitializedValues.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/UninitializedValues.h?rev=59284&r1=59283&r2=59284&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/UninitializedValues.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/UninitializedValues.h Thu Nov 13 19:14:18 2008
@@ -15,7 +15,7 @@
 #ifndef LLVM_CLANG_UNITVALS_H
 #define LLVM_CLANG_UNITVALS_H
 
-#include "clang/Analysis/Support/ExprDeclBitVector.h"
+#include "clang/Analysis/Support/BlkExprDeclBitVector.h"
 #include "clang/Analysis/FlowSensitive/DataflowValues.h"
 
 namespace clang {
@@ -33,7 +33,7 @@
 
   struct ObserverTy;
   
-  struct AnalysisDataTy : public ExprDeclBitVector_Types::AnalysisDataTy {    
+  struct AnalysisDataTy : public StmtDeclBitVector_Types::AnalysisDataTy {    
     AnalysisDataTy() : Observer(NULL), FullUninitTaint(true) {}
     virtual ~AnalysisDataTy() {};
     
@@ -41,7 +41,7 @@
     bool FullUninitTaint;
   };
   
-  typedef ExprDeclBitVector_Types::ValTy ValTy;
+  typedef StmtDeclBitVector_Types::ValTy ValTy;
   
   //===--------------------------------------------------------------------===//
   // ObserverTy - Observer for querying DeclRefExprs that use an uninitalized

Propchange: cfe/trunk/include/clang/Analysis/Support/BlkExprDeclBitVector.h

------------------------------------------------------------------------------
    svn:mergeinfo = 

Removed: cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h?rev=59283&view=auto

==============================================================================
--- cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h (original)
+++ cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h (removed)
@@ -1,295 +0,0 @@
-// BlkExprDeclBitVector.h - Dataflow types for Bitvector Analysis --*- C++ --*--
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides definition of dataflow types used by analyses such
-// as LiveVariables and UninitializedValues.  The underlying dataflow values
-// are implemented as bitvectors, but the definitions in this file include
-// the necessary boilerplate to use with our dataflow framework.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_STMTDECLBVDVAL_H
-#define LLVM_CLANG_STMTDECLBVDVAL_H
-
-#include "clang/AST/CFG.h"
-#include "clang/AST/Decl.h" // for ScopedDecl* -> NamedDecl* conversion
-#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/DenseMap.h"
-
-namespace clang {
-  
-  class Stmt;
-
-struct DeclBitVector_Types {
-  
-  class Idx {
-    unsigned I;
-  public:
-    explicit Idx(unsigned i) : I(i) {}
-    Idx() : I(~0U) {}
-    
-    bool isValid() const {
-      return I != ~0U;
-    }
-    operator unsigned() const {
-      assert (isValid());
-      return I;
-    }
-  };    
-    
-  //===--------------------------------------------------------------------===//
-  // AnalysisDataTy - Whole-function meta data.
-  //===--------------------------------------------------------------------===//
-  
-  class AnalysisDataTy {
-  public:
-    typedef llvm::DenseMap<const NamedDecl*, unsigned > DMapTy;
-    typedef DMapTy::const_iterator decl_iterator;
-    
-  protected:
-    DMapTy DMap;    
-    unsigned NDecls;
-    
-  public:
-    
-    AnalysisDataTy() : NDecls(0) {}
-    virtual ~AnalysisDataTy() {}
-    
-    bool isTracked(const NamedDecl* SD) { return DMap.find(SD) != DMap.end(); }
-    
-    Idx getIdx(const NamedDecl* SD) const {
-      DMapTy::const_iterator I = DMap.find(SD);
-      return I == DMap.end() ? Idx() : Idx(I->second);
-    }
-
-    unsigned getNumDecls() const { return NDecls; }
-    
-    void Register(const NamedDecl* SD) {
-      if (!isTracked(SD)) DMap[SD] = NDecls++;
-    }
-
-    decl_iterator begin_decl() const { return DMap.begin(); }
-    decl_iterator end_decl() const { return DMap.end(); }
-  };
-  
-  //===--------------------------------------------------------------------===//
-  // ValTy - Dataflow value.
-  //===--------------------------------------------------------------------===//
-  
-  class ValTy {
-    llvm::BitVector DeclBV;
-  public:
-    
-    void resetDeclValues(AnalysisDataTy& AD) {
-      DeclBV.resize(AD.getNumDecls()); 
-      DeclBV.reset();
-    }
-
-    void setDeclValues(AnalysisDataTy& AD) {
-      DeclBV.resize(AD.getNumDecls()); 
-      DeclBV.set();
-    }
-    
-    void resetValues(AnalysisDataTy& AD) {
-      resetDeclValues(AD);
-    }    
-    
-    bool operator==(const ValTy& RHS) const { 
-      assert (sizesEqual(RHS));
-      return DeclBV == RHS.DeclBV;
-    }
-    
-    void copyValues(const ValTy& RHS) { DeclBV = RHS.DeclBV; }
-    
-    llvm::BitVector::reference getBit(unsigned i) {
-      return DeclBV[i];
-    }
-    
-    bool getBit(unsigned i) const {
-      return DeclBV[i];
-    }
-    
-    llvm::BitVector::reference
-    operator()(const ScopedDecl* SD, const AnalysisDataTy& AD) {
-      return getBit(AD.getIdx(SD));
-    }
-
-    bool operator()(const ScopedDecl* SD, const AnalysisDataTy& AD) const {
-      return getBit(AD.getIdx(SD));
-    }
-    
-    llvm::BitVector::reference getDeclBit(unsigned i) { return DeclBV[i]; }    
-    const llvm::BitVector::reference getDeclBit(unsigned i) const {
-      return const_cast<llvm::BitVector&>(DeclBV)[i];
-    }
-        
-    ValTy& operator|=(const ValTy& RHS) {
-      assert (sizesEqual(RHS));
-      DeclBV |= RHS.DeclBV;
-      return *this;
-    }
-    
-    ValTy& operator&=(const ValTy& RHS) {
-      assert (sizesEqual(RHS));
-      DeclBV &= RHS.DeclBV;
-      return *this;
-    }
-    
-    ValTy& OrDeclBits(const ValTy& RHS) {
-      return operator|=(RHS);
-    }
-    
-    ValTy& AndDeclBits(const ValTy& RHS) {
-      return operator&=(RHS);
-    }
-        
-    bool sizesEqual(const ValTy& RHS) const {
-      return DeclBV.size() == RHS.DeclBV.size();
-    }
-  };
-  
-  //===--------------------------------------------------------------------===//
-  // Some useful merge operations.
-  //===--------------------------------------------------------------------===//
-    
-  struct Union { void operator()(ValTy& Dst, ValTy& Src) { Dst |= Src; } };
-  struct Intersect { void operator()(ValTy& Dst, ValTy& Src) { Dst &= Src; } };
-};
-
-
-struct StmtDeclBitVector_Types {
-  
-  //===--------------------------------------------------------------------===//
-  // AnalysisDataTy - Whole-function meta data.
-  //===--------------------------------------------------------------------===//
-
-  class AnalysisDataTy : public DeclBitVector_Types::AnalysisDataTy {
-    CFG* cfg;
-  public:
-    AnalysisDataTy() {}
-    virtual ~AnalysisDataTy() {}
-
-    void setCFG(CFG* c) { cfg = c; }
-    CFG& getCFG() { assert(cfg && "CFG should not be NULL."); return *cfg; }
-    
-    bool isTracked(const Stmt* S) { return cfg->isBlkExpr(S); }
-    using DeclBitVector_Types::AnalysisDataTy::isTracked;
-
-    unsigned getIdx(const Stmt* S) const {
-      CFG::BlkExprNumTy I = cfg->getBlkExprNum(S);
-      assert(I && "Stmtession not tracked for bitvector.");
-      return I;
-    }
-    using DeclBitVector_Types::AnalysisDataTy::getIdx;
-    
-    unsigned getNumBlkExprs() const { return cfg->getNumBlkExprs(); }
-  };
-
-  //===--------------------------------------------------------------------===//
-  // ValTy - Dataflow value.
-  //===--------------------------------------------------------------------===//
-
-  class ValTy : public DeclBitVector_Types::ValTy {
-    llvm::BitVector BlkExprBV;
-    typedef DeclBitVector_Types::ValTy ParentTy;
-    
-    static inline ParentTy& ParentRef(ValTy& X) {
-      return static_cast<ParentTy&>(X);
-    }
-    
-    static inline const ParentTy& ParentRef(const ValTy& X) {
-      return static_cast<const ParentTy&>(X);
-    }
-    
-  public:
-    
-    
-    void resetBlkExprValues(AnalysisDataTy& AD) {
-      BlkExprBV.resize(AD.getNumBlkExprs());
-      BlkExprBV.reset();
-    }
-    
-    void setBlkExprValues(AnalysisDataTy& AD) {
-      BlkExprBV.resize(AD.getNumBlkExprs());
-      BlkExprBV.set();
-    }
-    
-    void resetValues(AnalysisDataTy& AD) {
-      resetDeclValues(AD);
-      resetBlkExprValues(AD);
-    }
-    
-    bool operator==(const ValTy& RHS) const { 
-      return ParentRef(*this) == ParentRef(RHS) 
-          && BlkExprBV == RHS.BlkExprBV;
-    }
-    
-    void copyValues(const ValTy& RHS) {
-      ParentRef(*this).copyValues(ParentRef(RHS));
-      BlkExprBV = RHS.BlkExprBV;
-    }
-        
-    llvm::BitVector::reference
-    operator()(const Stmt* S, const AnalysisDataTy& AD) {
-      return BlkExprBV[AD.getIdx(S)];      
-    }    
-    const llvm::BitVector::reference
-    operator()(const Stmt* S, const AnalysisDataTy& AD) const {
-      return const_cast<ValTy&>(*this)(S,AD);
-    }
-    
-    using DeclBitVector_Types::ValTy::operator();
-
-    
-    llvm::BitVector::reference getStmtBit(unsigned i) { return BlkExprBV[i]; }    
-    const llvm::BitVector::reference getStmtBit(unsigned i) const {
-      return const_cast<llvm::BitVector&>(BlkExprBV)[i];
-    }
-    
-    ValTy& OrBlkExprBits(const ValTy& RHS) {
-      BlkExprBV |= RHS.BlkExprBV;
-      return *this;
-    }
-    
-    ValTy& AndBlkExprBits(const ValTy& RHS) {
-      BlkExprBV &= RHS.BlkExprBV;
-      return *this;
-    }
-    
-    ValTy& operator|=(const ValTy& RHS) {
-      assert (sizesEqual(RHS));
-      ParentRef(*this) |= ParentRef(RHS);
-      BlkExprBV |= RHS.BlkExprBV;
-      return *this;
-    }
-    
-    ValTy& operator&=(const ValTy& RHS) {
-      assert (sizesEqual(RHS));
-      ParentRef(*this) &= ParentRef(RHS);
-      BlkExprBV &= RHS.BlkExprBV;
-      return *this;
-    }
-    
-    bool sizesEqual(const ValTy& RHS) const {
-      return ParentRef(*this).sizesEqual(ParentRef(RHS))
-          && BlkExprBV.size() == RHS.BlkExprBV.size();
-    }
-  };
-  
-  //===--------------------------------------------------------------------===//
-  // Some useful merge operations.
-  //===--------------------------------------------------------------------===//
-  
-  struct Union { void operator()(ValTy& Dst, ValTy& Src) { Dst |= Src; } };
-  struct Intersect { void operator()(ValTy& Dst, ValTy& Src) { Dst &= Src; } };
-  
-};
-} // end namespace clang
-
-#endif

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

==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Thu Nov 13 19:14:18 2008
@@ -276,11 +276,11 @@
 namespace {
 
 struct Merge {
-  typedef ExprDeclBitVector_Types::ValTy ValTy; 
+  typedef StmtDeclBitVector_Types::ValTy ValTy; 
     
   void operator()(ValTy& Dst, const ValTy& Src) {
     Dst.OrDeclBits(Src);
-    Dst.AndExprBits(Src);
+    Dst.AndBlkExprBits(Src);
   }
 };
   

Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=59284&r1=59283&r2=59284&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Thu Nov 13 19:14:18 2008
@@ -65,7 +65,7 @@
   
   void SetTopValue(UninitializedValues::ValTy& X) {
     X.setDeclValues(AD);
-    X.resetExprValues(AD);
+    X.resetBlkExprValues(AD);
   }
     
   bool VisitDeclRefExpr(DeclRefExpr* DR);
@@ -251,7 +251,7 @@
 //===----------------------------------------------------------------------===//      
 
 namespace {
-  typedef ExprDeclBitVector_Types::Union Merge;
+  typedef StmtDeclBitVector_Types::Union Merge;
   typedef DataflowSolver<UninitializedValues,TransferFuncs,Merge> Solver;
 }
 





More information about the cfe-commits mailing list