aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-09-18 23:40:51 +0000
committerTed Kremenek <kremenek@apple.com>2007-09-18 23:40:51 +0000
commitfe1b1e686f6bd97995a15081cae343708f22b496 (patch)
tree9750b79ecdec16499f0866fec031fdd777cbe226
parentf5a9518ec408de44a4dac6e2cbfe44ddbfc45d89 (diff)
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
-rw-r--r--Analysis/DataflowSolver.h6
-rw-r--r--include/clang/Analysis/UninitializedValues.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/Analysis/DataflowSolver.h b/Analysis/DataflowSolver.h
index b89b45b677..d5e5bbbe80 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 @@ public:
/// 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 @@ private:
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 d116da595c..21e1ebd447 100644
--- a/include/clang/Analysis/UninitializedValues.h
+++ b/include/clang/Analysis/UninitializedValues.h
@@ -71,7 +71,7 @@ public:
ExprBV.reset();
}
- bool operator==(ValTy& RHS) const {
+ bool operator==(const ValTy& RHS) const {
return DeclBV == RHS.DeclBV && ExprBV == RHS.ExprBV;
}