[LLVMdev] LLVMBuilder vs LLVMFoldingBuilder

Dominic Hamon dom.hamon at gmail.com
Wed Apr 2 09:54:05 PDT 2008


Hello llvm dev peeps

I would like to use an LLVMBuilder pointer as a base pointer to 
reference either an LLVMBuilder or an LLVMFoldingBuilder. As the methods 
in the Folding builder have the same names as the base class, I thought 
about submitting a patch whereby the base class methods would become 
virtual. However, the base class methods return specific types while the 
Folding builder, for good reason, return more general Value* types.

Would it be reasonable for me to submit a patch whereby the LLVMBuilder 
methods also return the general Value* type and the LLVMFoldingBuilder 
methods become virtual overrides of the base class methods?

Users (such as myself) could then decide at runtime which type of 
builder they wish to use.

Another option that was discussed in #llvm is to nuke LLVMBuilder and 
rename LLVMFoldingBuilder to LLVMBuilder. If this was the case, I'd 
argue for a flag in the Builder that could retain the old non-folding 
functionality for debugging purposes.

Your thoughts please?



More information about the llvm-dev mailing list