DataflowSolver now acccepts an "_Equal" template parameter that allows the user
to specify how two dataflow values should be compared for equality. The default
is to use std::equal_to.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42115 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/DataflowSolver.h b/Analysis/DataflowSolver.h
index b89b45b..d5e5bbb 100644
--- a/Analysis/DataflowSolver.h
+++ b/Analysis/DataflowSolver.h
@@ -16,6 +16,7 @@
#include "clang/AST/CFG.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "functional" // STL
namespace clang {
@@ -47,7 +48,8 @@
/// DataflowSolverTy - Generic dataflow solver.
template <typename _DFValuesTy, // Usually a subclass of DataflowValues
typename _TransferFuncsTy,
- typename _MergeOperatorTy >
+ typename _MergeOperatorTy,
+ typename _Equal = std::equal_to<typename _DFValuesTy::ValTy> >
class DataflowSolver {
//===--------------------------------------------------------------------===//
@@ -228,7 +230,7 @@
M[E].copyValues(V);
WorkList.enqueue(TargetBlock);
}
- else if (!(V==I->second)) {
+ else if (!_Equal()(V,I->second)) {
I->second.copyValues(V);
WorkList.enqueue(TargetBlock);
}
diff --git a/include/clang/Analysis/UninitializedValues.h b/include/clang/Analysis/UninitializedValues.h
index d116da5..21e1ebd 100644
--- a/include/clang/Analysis/UninitializedValues.h
+++ b/include/clang/Analysis/UninitializedValues.h
@@ -71,7 +71,7 @@
ExprBV.reset();
}
- bool operator==(ValTy& RHS) const {
+ bool operator==(const ValTy& RHS) const {
return DeclBV == RHS.DeclBV && ExprBV == RHS.ExprBV;
}