[cfe-dev] Number of elements in ArrayType?

Csaba Dabis via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 29 07:03:09 PDT 2019


Assume that you have the desired `VarDecl` `D`:
```
       const Expr *SizeExpr = nullptr;
        if (D->getType()->isArrayType())
          if (const TypeSourceInfo *TSI = D->getTypeSourceInfo())
            if (const auto ATL = TSI->getTypeLoc().getAs<ArrayTypeLoc>())
              SizeExpr = ATL.getSizeExpr();
```

On Tue, Oct 29, 2019 at 2:58 PM Kenth Eriksson via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> Hi!
>
> How can I get the number of elements in ArrayType?
>
>
> /k
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list