[LLVMdev] question
Chris Lattner
sabre at nondot.org
Sat Nov 16 16:30:01 PST 2002
On Sat, 16 Nov 2002, Xiaodong Li wrote:
> be 'const DSNode *', I cannot use 'DSNode *' type. So as a result, I
> always get error message like this:
> How to use a 'Node *' type iterator? Or is there any other way to traverse
> the DSGraph?
I will have to add a new version of the iterator. I'll do this sometime
early next week. In the meantime, just cast stuff like crazy. :)
-Chris
> 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
> >
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/
More information about the llvm-dev
mailing list