AST representation constant time arrays defined with enums

I am using clang to do some code generation and one thing that is
tripping me up is a pattern like:

struct ArrayMembers
{
enum Enum
{
First,
Second,
Third,
Count,
};
};

struct GenericData
{
int NamedArray[ArrayMembers::Count];
};

From the AST, I get that the array is a statically-sized array of

length 3. This works fine. I can't get that that 3 was derived from
the ArrayMembers::Count declaration.

This is useful for something that analyzes code because people use
this system to give the entries in the array names that are
meaningful. I lose those meanings right now perhaps because I don't
understand clang's AST very well.

Is there a way from the array declaration in the clang AST can I
figure out 1. If it was declared using an enumeration value and 2.
what enumeration that value came from?

Chris

You can dig down to the ArrayTypeLoc that describes the type of NamedArray; that ArrayTypeLoc has a size expression in it, which is the expression as written in the source code.

  - Doug