[cfe-dev] Howto get the dimension expression for a given ConstantArrayType

Frank Redeker via cfe-dev cfe-dev at lists.llvm.org
Fri Aug 17 07:01:26 PDT 2018


Hello, List,

is there an easy way to get the expression that is used to specify the
dimension for a given ConstantArrayType.

Source:
...
int Array[sizeof(int) + 2];
...


My code:

void Analyze (QualType qt) {
...
if (qt->isArrayType()) {
  if (isa<ConstantArrayType>(qt)) {
     const ConstantArrayType * cat(dyn_cast<ConstantArrayType>(qt));

     // Here I want to get the expression that was used to specify
     // the dimension.
  }
}



Frank



More information about the cfe-dev mailing list