From: Ted Kremenek Date: Tue, 4 Mar 2008 19:52:15 +0000 (+0000) Subject: Fixed another obscure node-caching bug. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7fa6a4079fd68344e4d38c30f7681b3a7d30fbd1;p=clang Fixed another obscure node-caching bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47898 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/include/clang/Analysis/PathSensitive/ExplodedGraph.h index a56e7d3d14..db5f692699 100644 --- a/include/clang/Analysis/PathSensitive/ExplodedGraph.h +++ b/include/clang/Analysis/PathSensitive/ExplodedGraph.h @@ -162,8 +162,16 @@ public: } // Profiling (for FoldingSet). + + static inline void Profile(llvm::FoldingSetNodeID& ID, + const ProgramPoint& Loc, + StateTy state) { + ID.Add(Loc); + GRTrait::Profile(ID, state); + } + inline void Profile(llvm::FoldingSetNodeID& ID) const { - GRTrait::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::Profile(profile, State); - profile.Add(L); + NodeTy::Profile(profile, L, State); NodeTy* V = Nodes.FindNodeOrInsertPos(profile, InsertPos); if (!V) { diff --git a/include/clang/Analysis/PathSensitive/ValueState.h b/include/clang/Analysis/PathSensitive/ValueState.h index 73c4706db1..ba323b5a86 100644 --- a/include/clang/Analysis/PathSensitive/ValueState.h +++ b/include/clang/Analysis/PathSensitive/ValueState.h @@ -145,8 +145,10 @@ public: template<> struct GRTrait { 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); } };