[cfe-dev] Distinguish in the AST constant array declarations which size is set directly and by the initializer.

Paolo Bolzoni bolzoni at cs.unipr.it
Wed Feb 18 00:59:04 PST 2009


dear cfe-list,

Source code example:
-------<
const char a1[] = "abcd";
const char a2[5] = "abcd";

int* p1 = (int[ ]){0,1,2,3,4}
int* p2 = (int[5]){0,1,2,3,4}
------->


Visiting the clang AST, is there a way to distinguish between the arrays a1
and a2 and the two unnamed objects whose address will be stored in p1
and p2?

I need to check that the second form is not used.


It seems that in all cases the type is clang::ConstantArrayType, the storage
modifier is normal and the size 4.


thanks,
pb



More information about the cfe-dev mailing list