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

Trevor Harmon trevor.w.harmon at nasa.gov
Fri Mar 26 10:49:57 PDT 2010


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




More information about the llvm-dev mailing list