[cfe-dev] Total size of array type

Trevor Harmon trevor at vocaro.com
Fri Feb 10 13:03:53 PST 2012


Given a QualType (or Type) handle to an array declaration, I need to 
get the total size in bytes. For example:

int foo[2]    // 8 bytes
char foo[2]   // 2 bytes

I can get the number of elements using ConstantArray::getSize (which 
returns 2 in the above cases), but I need the size of the element type 
as well, in order to compute the total bytes. However, there's no 
getSize or equivalent for QualType or Type. What am I missing? Thanks,


More information about the cfe-dev mailing list