[cfe-commits] r127664 - /cfe/trunk/lib/Analysis/UninitializedValues.cpp
Ted Kremenek
kremenek at apple.com
Mon Mar 14 21:57:30 PDT 2011
Author: kremenek
Date: Mon Mar 14 23:57:29 2011
New Revision: 127664
URL: http://llvm.org/viewvc/llvm-project?rev=127664&view=rev
Log:
UninitializedValues: wrap BitVector references in a new class ValueVector. No functionality change. This defines the minimum interface that ValueVector needs to support when we no longer base it strictly on a direct interpretation of BitVector.
Modified:
cfe/trunk/lib/Analysis/UninitializedValues.cpp
Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=127664&r1=127663&r2=127664&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Mon Mar 14 23:57:29 2011
@@ -74,7 +74,22 @@
// CFGBlockValues: dataflow values for CFG blocks.
//====------------------------------------------------------------------------//
-typedef llvm::BitVector ValueVector;
+static const bool Initialized = false;
+static const bool Uninitialized = true;
+
+class ValueVector {
+ llvm::BitVector vec;
+public:
+ ValueVector() {}
+ ValueVector(unsigned size) : vec(size) {}
+ typedef llvm::BitVector::reference reference;
+ void resize(unsigned n) { vec.resize(n); }
+ void merge(const ValueVector &rhs) { vec |= rhs.vec; }
+ bool operator!=(const ValueVector &rhs) const { return vec != rhs.vec; }
+ reference operator[](unsigned idx) { return vec[idx]; }
+ void reset() { vec.reset(); }
+};
+
typedef std::pair<ValueVector *, ValueVector *> BVPair;
namespace {
@@ -189,7 +204,7 @@
if (isFirst)
scratch = source;
else
- scratch |= source;
+ scratch.merge(source);
}
#if 0
static void printVector(const CFGBlock *block, ValueVector &bv,
@@ -286,9 +301,6 @@
// Transfer function for uninitialized values analysis.
//====------------------------------------------------------------------------//
-static const bool Initialized = false;
-static const bool Uninitialized = true;
-
namespace {
class FindVarResult {
const VarDecl *vd;
More information about the cfe-commits
mailing list