[cfe-commits] r47898 - in /cfe/trunk/include/clang/Analysis/PathSensitive: ExplodedGraph.h ValueState.h

Ted Kremenek kremenek at apple.com
Tue Mar 4 11:52:15 PST 2008


Author: kremenek
Date: Tue Mar  4 13:52:15 2008
New Revision: 47898

URL: http://llvm.org/viewvc/llvm-project?rev=47898&view=rev
Log:
Fixed another obscure node-caching bug.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h
    cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h?rev=47898&r1=47897&r2=47898&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h Tue Mar  4 13:52:15 2008
@@ -162,8 +162,16 @@
   }
   
   // Profiling (for FoldingSet).
+  
+  static inline void Profile(llvm::FoldingSetNodeID& ID,
+                             const ProgramPoint& Loc,
+                             StateTy state) {
+    ID.Add(Loc);
+    GRTrait<StateTy>::Profile(ID, state);
+  }
+  
   inline void Profile(llvm::FoldingSetNodeID& ID) const {
-    GRTrait<StateTy>::Profile(ID, getState());
+    Profile(ID, getLocation(), getState());
   }
   
   // Iterators over successor and predecessor vertices.
@@ -307,8 +315,7 @@
     llvm::FoldingSetNodeID profile;    
     void* InsertPos = 0;
     
-    GRTrait<StateTy>::Profile(profile, State);
-    profile.Add(L);
+    NodeTy::Profile(profile, L, State);
     NodeTy* V = Nodes.FindNodeOrInsertPos(profile, InsertPos);
 
     if (!V) {

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h?rev=47898&r1=47897&r2=47898&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h Tue Mar  4 13:52:15 2008
@@ -145,8 +145,10 @@
 template<> struct GRTrait<ValueState*> {
   static inline void* toPtr(ValueState* St)  { return (void*) St; }
   static inline ValueState* toState(void* P) { return (ValueState*) P; }
-  static inline void Profile(llvm::FoldingSetNodeID& profile, ValueState* St) {
-    ValueState::Profile(profile, St);
+  static inline void Profile(llvm::FoldingSetNodeID& profile, ValueState* St) {    
+    // At this point states have already been uniqued.  Just
+    // add the pointer.
+    profile.AddPointer(St);
   }
 };    
   





More information about the cfe-commits mailing list