]> granicus.if.org Git - clang/commitdiff
Fixed another obscure node-caching bug.
authorTed Kremenek <kremenek@apple.com>
Tue, 4 Mar 2008 19:52:15 +0000 (19:52 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 4 Mar 2008 19:52:15 +0000 (19:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47898 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/ExplodedGraph.h
include/clang/Analysis/PathSensitive/ValueState.h

index a56e7d3d14363d1b6fe28213cf5f357607defb19..db5f692699b7a01185b8319809094fdd6086221e 100644 (file)
@@ -162,8 +162,16 @@ public:
   }
   
   // 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 @@ public:
     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) {
index 73c4706db172ac57b2948d10330ab13d662eff78..ba323b5a865f8fc86afd6aeb4da705c3528243b2 100644 (file)
@@ -145,8 +145,10 @@ public:
 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);
   }
 };