[cfe-dev] Number of elements in ArrayType?
Keane, Erich via cfe-dev
cfe-dev at lists.llvm.org
Tue Oct 29 07:02:43 PDT 2019
It depends on the type of the ArrayType. ArrayType is the base class of ConstantArrayType, DependentSizedArrayType, IncompleteArrayType, and VariableArrayType.
You have to dyn_cast to whichever the array is. Note that only ConstantArrayType has a constant size (with its function getSize(), or getSizeExpr for the expression itself).
DependentSizedArrayType will show up in a template, if the size itself is a template parameter (you can get THAT with getSizeExpr()).
VariableArrayType represents a VLA (variable length array), so it will also have a getSizeExpr() that isn't calculatable at compile time.
IncompleteArrayType does not have a size.
-----Original Message-----
From: cfe-dev <cfe-dev-bounces at lists.llvm.org> On Behalf Of Kenth Eriksson via cfe-dev
Sent: Tuesday, October 29, 2019 6:59 AM
To: cfe-dev at lists.llvm.org
Subject: [cfe-dev] Number of elements in ArrayType?
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