When I tried to compile the program, I got this error: ../../../include/llvm/Analysis/DSGraph.h: In member function `virtual bool <unnamed>::GlobalMemLeakage::run(Module&)': ../../../include/llvm/Analysis/DSGraph.h:38: `void DSGraph::operator=(const DSGraph&)' is private MemLeakage.cpp:87: within this context gmake: *** [Debug/MemLeakage.o] Error 1 I don't understand what this means. Basically what I did is I defined: map<Function *, DSGraph> funsetmap; and I was trying to assign the DSGraph for each function to the map. funsetmap[&F] = dsg; Could you tell me what's wrong how to fix this? Another question is that when I iterate on the graph using this for (DSNode::iterator I = N->begin(), E = N->end(); I != E; ++I) if (I->getNode()) visit(I->getNode(), I->getOffset()); The return type of I->getNode() is 'const DSNode *' type. Is there a 'DSNode *' type iterator? Besides, Can I use the following code to visit the children of N? for( unsigned i=0; i < N->getNumLinks(); i++) { visit( N->getLink() ) } Thanks, Jerry
Also sprach Xiaodong Li: } } When I tried to compile the program, I got this error: } } ../../../include/llvm/Analysis/DSGraph.h: In member function `virtual bool } <unnamed>::GlobalMemLeakage::run(Module&)': } ../../../include/llvm/Analysis/DSGraph.h:38: `void } DSGraph::operator=(const } DSGraph&)' is private } MemLeakage.cpp:87: within this context } gmake: *** [Debug/MemLeakage.o] Error 1 } } I don't understand what this means. Basically what I did is I defined: } map<Function *, DSGraph> funsetmap; } and I was trying to assign the DSGraph for each function to the map. } funsetmap[&F] = dsg; } Could you tell me what's wrong how to fix this? } You're invoking the copy constructor in this code snippet: funsetmap[&F] = dsg; That is, the copy constructor for dsg (which I take to be a DSGraph object). Ways around this: - Store a pointer to DSGraph instead of the DSGraph object. So something like this: map<Function *, DSGraph *> funsetmap; // code funsetmap[&F] = &dsg; You have to be careful not to store local variables and pass them back from a function, of course. - Create a wrapper class for DSGraph and have its copy constructor clone the DSGraph object for you. This way is a bit more complicated and might not really be necessary for what you need to do though... -- || Bill Wendling "A computer without a Microsoft operating || wendling at isanbard.org system is like a dog without bricks tied || to its head." -- Anonymous
Thanks Bill. One more question, when I use the DSNode iterator to traverse a node's children. The return value of I.getNode() can only be 'const DSNode *', I cannot use 'DSNode *' type. So as a result, I always get error message like this: MemLeakage.cpp:159: invalid conversion from `const DSNode*' to `DSNode*' MemLeakage.cpp:159: initializing argument 1 of `void <unnamed>::GlobalMemLeakage::KillSetInsert(DSNode*, BBsets&)' How to use a 'Node *' type iterator? Or is there any other way to traverse the DSGraph? thanks, Jerry On Sat, 16 Nov 2002, Bill? Wendling wrote:> Also sprach Xiaodong Li: > } > } When I tried to compile the program, I got this error: > } > } ../../../include/llvm/Analysis/DSGraph.h: In member function `virtual bool > } <unnamed>::GlobalMemLeakage::run(Module&)': > } ../../../include/llvm/Analysis/DSGraph.h:38: `void > } DSGraph::operator=(const > } DSGraph&)' is private > } MemLeakage.cpp:87: within this context > } gmake: *** [Debug/MemLeakage.o] Error 1 > } > } I don't understand what this means. Basically what I did is I defined: > } map<Function *, DSGraph> funsetmap; > } and I was trying to assign the DSGraph for each function to the map. > } funsetmap[&F] = dsg; > } Could you tell me what's wrong how to fix this? > } > You're invoking the copy constructor in this code snippet: > > funsetmap[&F] = dsg; > > That is, the copy constructor for dsg (which I take to be a DSGraph > object). Ways around this: > > - Store a pointer to DSGraph instead of the DSGraph object. So > something like this: > > map<Function *, DSGraph *> funsetmap; > > // code > > funsetmap[&F] = &dsg; > > You have to be careful not to store local variables and pass them > back from a function, of course. > > - Create a wrapper class for DSGraph and have its copy constructor > clone the DSGraph object for you. This way is a bit more > complicated and might not really be necessary for what you need to > do though... > > -- > || Bill Wendling "A computer without a Microsoft operating > || wendling at isanbard.org system is like a dog without bricks tied > || to its head." -- Anonymous >