<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 18, 2010, at 10:55 AM, Murat B wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><table cellspacing="0" cellpadding="0" border="0" style="position: static; z-index: auto; "><tbody><tr><td valign="top" style="font: inherit;">Dear all,<br><br>I have an enum declaration and a structure declaration of following kind:<br><br>typedef enum<br>{<br> BITS_HEADER,<br> BITS_TOTAL_MB,<br> BITS_MB_MODE,<br> BITS_INTER_MB,<br> BITS_CBP_MB,<br> BITS_COEFF_Y_MB,<br> BITS_COEFF_UV_MB,<br> BITS_DELTA_QUANT_MB,<br> MAX_BITCOUNTER_MB<br>} BitCountType;<br><br>typedef struct macroblock<br>{<br> ....... <br> int bitcounter[MAX_BITCOUNTER_MB];<br> .......<br>} Macroblock;<br><br>In my clang plugin, the type of the field bitcounter is shown as ConstantArrayType of size 8.<br><br>Is there a way to determine that the size of this array is MAX_BITCOUNTER_MB and not 8, so I can make this structure dependent to the enum.<br></td></tr></tbody></table></blockquote></div><br><div>Get the TypeSourceInfo (and, then, the TypeLoc) of the field. From there, you can find the actual size expression as written in the source code. It will be a DeclRefExpr pointing to the enumerator.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div></body></html>