[LLVMdev] Explicitly Freeing Allocas

Duncan Sands baldrick at free.fr
Thu Jun 18 08:15:42 PDT 2009


> If this is not possible, an alternate solution would be for me to allocate
> an array of bytes larger than all the struct types I may be using, and cast
> that pointer to the right type each type. In that case, I would like to know
> how I can find out what the size of a struct is. I've heard of people
> talking about using "the right target data", but I have no idea how to
> actually do that, and I find the doxygen info doesn't make it any clearer.

you can get the size in a target independent way using
ConstantExpr::getSizeOf.  You can also get the alignment
using ConstantExpr::getAlignOf, but this is less useful.



More information about the llvm-dev mailing list