[LLVMdev] Dereference PointerType?

Duncan Sands baldrick at free.fr
Tue Oct 20 04:02:56 PDT 2009


Óscar Fuentes wrote:
> Daniel Waterworth <da.waterworth at googlemail.com> writes:
> 
> [snip]
> 
> Use the getElementType method of PointerType.
> 
>>> size_t size;
>>> if (isa<PointerType>(allocated_type)) {
>>>   size = sizeof(void*) * 8;
>>> } else {
>>>   size = allocated_type->getPrimitiveSizeInBits();
>>> }
>>> // size now equals the size (in bits) of the type allocated
> 
> This looks suspicious to me.

Probably he wants getTypeAllocSize (available from target data).  The
special casing of PointerType is both useless and bogus.

Ciao,

Duncan.



More information about the llvm-dev mailing list