[cfe-commits] r42115 - in /cfe/trunk: Analysis/DataflowSolver.h include/clang/Analysis/UninitializedValues.h

Ted Kremenek kremenek at apple.com
Tue Sep 18 16:40:51 PDT 2007


Author: kremenek
Date: Tue Sep 18 18:40:51 2007
New Revision: 42115

URL: http://llvm.org/viewvc/llvm-project?rev=42115&view=rev
Log:
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.

Modified:
    cfe/trunk/Analysis/DataflowSolver.h
    cfe/trunk/include/clang/Analysis/UninitializedValues.h

Modified: cfe/trunk/Analysis/DataflowSolver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/DataflowSolver.h?rev=42115&r1=42114&r2=42115&view=diff

==============================================================================
--- cfe/trunk/Analysis/DataflowSolver.h (original)
+++ cfe/trunk/Analysis/DataflowSolver.h Tue Sep 18 18:40:51 2007
@@ -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);
     }

Modified: cfe/trunk/include/clang/Analysis/UninitializedValues.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/UninitializedValues.h?rev=42115&r1=42114&r2=42115&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/UninitializedValues.h (original)
+++ cfe/trunk/include/clang/Analysis/UninitializedValues.h Tue Sep 18 18:40:51 2007
@@ -71,7 +71,7 @@
       ExprBV.reset();
     }
     
-    bool operator==(ValTy& RHS) const { 
+    bool operator==(const ValTy& RHS) const { 
       return DeclBV == RHS.DeclBV && ExprBV == RHS.ExprBV; 
     }
     





More information about the cfe-commits mailing list