[cfe-dev] Prevent folding of integer constant expressions in AST
Benedikt Lukas Huber via cfe-dev
cfe-dev at lists.llvm.org
Thu Jan 16 08:21:38 PST 2020
Hi,
I am using ParseAST to traverse the AST provided by clang, using a ConstDeclVisitor, a ConstStmtVisitor and a TypeVisitor.
My problem now is that for expressions such as
char main_foo[sizeof(int) == sizeof(char) ? 5 : 8];
I cannot access the expression for the array size, from VisitConstantArrayType(). I can only access the folded numerical value, in this case 8.
Is there a way to access the unfolded expression? Or disable folding of integer constant expressions all together?
I am using clang 6.0.
Thank you and best regards,
Benedikt
More information about the cfe-dev
mailing list