On Tue, 2021-07-06 at 18:46 -0400, David Malcolm wrote: > On Sat, 2021-07-03 at 20:07 +0530, Ankur Saini wrote: > > AIM for today : > > > > - update the call_stack to track something else other than > > supergraph > > edges > > > > — > > > > PROGRESS : > > > > - After some brainstorming about tracking the callstack, I think > > one > > better way to track the call stack is to keep track of source and > > destination of the call instead of supperedges representing them. > > > > - so I branched again and updated the call-string to now capture a > > pair > > of supernodes ( one representing callee and other representing > > caller > > ), like this I was not only able to easily port the entire code to > > adapt it without much difficulty, but now can also push calls to > > functions that doesn’t possess a superedge. > > > > - changes done can be seen on the " > > refs/users/arsenic/heads/call_string_update “ branch. ( currently > > this > > branch doesn’t contain other changes I have done till now, as I > > wanted > > to test the new call-string representation exclusively and make > > sure it > > doesn’t affect the functionality of the base analyser ) > > I'm not an expert at git, so it took me a while to figure out how to > access your branch. > > It's easier for me if you can also use "git format-patch" to generate > a > patch and "git send-email" to send it to this list (and me, please), > so > that the patch content is going to the list. > > The approach in the patch seems reasonable. > > I think you may have a memory leak, though: you're changing > call_string > from: > auto_vec<const return_superedge *> m_return_edges; > to: > auto_vec<const std::pair<const supernode *,const supernode *>*> > m_supernodes;
One other, unrelated idea that just occurred to me: those lines get very long, so maybe introduce a typedef e.g. typedef std::pair<const supernode *,const supernode *> element_t; so that you can refer to the pairs as call_string::element_t, and just element_t when you're in call_string scope, and just have a: auto_vec<element_t> m_supernodes; or auto_vec<element_t> m_elements; within the call_string, if that makes sense. Does that simplify things? Dave