[LLVMdev] Why is BasicBlock's copy constructor private?

Villmow, Micah Micah.Villmow at amd.com
Fri Mar 26 10:53:43 PDT 2010


Trevor, 
 Check the programming manual.
http://llvm.org/docs/ProgrammersManual.html#iterate_convert

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Trevor Harmon
Sent: Friday, March 26, 2010 10:50 AM
To: me22
Cc: llvmdev at cs.uiuc.edu List
Subject: Re: [LLVMdev] Why is BasicBlock's copy constructor private?

On Mar 25, 2010, at 5:23 PM, me22 wrote:

> Given that LLVM is already managing the memory and presumably will do
> so for the life of your graph processing, could you just use a
> boost::directed_graph<llvm::BasicBlock*> instead?

Yeah, that was one of the first things I tried:

for (Function::iterator i = function.begin(), e = function.end(); i !=  
e; ++i) {
	BasicBlock *basicBlockPtr = &(*i);
	add_vertex(basicBlockPtr, timingGraph);
}

The "&(*i)" sure seems weird, but I don't know how else to grab a  
pointer to the BasicBlock from within the iterator.

Also, if I then try to extract a vertex from the graph:

BasicBlock *basicBlockPtr = timingGraph[0];
			
...the whole thing segfaults. So I'm basically stuck.

Trevor

_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev






More information about the llvm-dev mailing list