summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Analysis/Support/ExprDeclBitVector.h20
-rw-r--r--clang/lib/Analysis/LiveVariables.cpp13
2 files changed, 30 insertions, 3 deletions
diff --git a/clang/include/clang/Analysis/Support/ExprDeclBitVector.h b/clang/include/clang/Analysis/Support/ExprDeclBitVector.h
index 558331e32eb..e54bacae7ba 100644
--- a/clang/include/clang/Analysis/Support/ExprDeclBitVector.h
+++ b/clang/include/clang/Analysis/Support/ExprDeclBitVector.h
@@ -119,7 +119,7 @@ struct DeclBitVector_Types {
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;
@@ -132,6 +132,14 @@ struct DeclBitVector_Types {
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();
}
@@ -225,6 +233,16 @@ struct ExprDeclBitVector_Types {
return const_cast<llvm::BitVector&>(ExprBV)[i];
}
+ ValTy& OrExprBits(const ValTy& RHS) {
+ ExprBV |= RHS.ExprBV;
+ return *this;
+ }
+
+ ValTy& AndExprBits(const ValTy& RHS) {
+ ExprBV &= RHS.ExprBV;
+ return *this;
+ }
+
ValTy& operator|=(const ValTy& RHS) {
assert (sizesEqual(RHS));
ParentRef(*this) |= ParentRef(RHS);
diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp
index e59a4885911..acc13dead85 100644
--- a/clang/lib/Analysis/LiveVariables.cpp
+++ b/clang/lib/Analysis/LiveVariables.cpp
@@ -168,8 +168,17 @@ void TransferFuncs::VisitDeclStmt(DeclStmt* DS) {
//===----------------------------------------------------------------------===//
namespace {
-typedef ExprDeclBitVector_Types::Union Merge;
-typedef DataflowSolver<LiveVariables,TransferFuncs,Merge> Solver;
+
+struct Merge {
+ typedef ExprDeclBitVector_Types::ValTy ValTy;
+
+ void operator()(ValTy& Dst, const ValTy& Src) {
+ Dst.OrDeclBits(Src);
+ Dst.AndExprBits(Src);
+ }
+};
+
+typedef DataflowSolver<LiveVariables, TransferFuncs, Merge> Solver;
} // end anonymous namespace
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud