[cfe-dev] Array with size of an Enum Constant

Murat B murat8307 at yahoo.com
Wed Aug 18 10:55:54 PDT 2010


Dear all,

I have an enum declaration and a structure declaration of following kind:

typedef enum
{
  BITS_HEADER,
  BITS_TOTAL_MB,
  BITS_MB_MODE,
  BITS_INTER_MB,
  BITS_CBP_MB,
  BITS_COEFF_Y_MB,
  BITS_COEFF_UV_MB,
  BITS_DELTA_QUANT_MB,
  MAX_BITCOUNTER_MB
} BitCountType;

typedef struct macroblock
{
  ....... 
  int bitcounter[MAX_BITCOUNTER_MB];
  .......
} Macroblock;

In my clang plugin, the type of the field bitcounter is shown as ConstantArrayType of size 8.

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.

Thanks in advance.
Murat



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100818/372a1ed3/attachment.html>


More information about the cfe-dev mailing list