From fe1b1e686f6bd97995a15081cae343708f22b496 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 18 Sep 2007 23:40:51 +0000 Subject: [PATCH] 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 --- Analysis/DataflowSolver.h | 6 ++++-- include/clang/Analysis/UninitializedValues.h | 2 +- 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 _MergeOperatorTy, + typename _Equal = std::equal_to > 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; } -- 2.40.0