<div dir="ltr">I have already sent the following on the list, may this helps.<div>Assume that you have the desired `VarDecl` `D` of `main_foo`:<br>```<br>const Expr *SizeExpr = nullptr;<br>if (const TypeSourceInfo *TSI = D->getTypeSourceInfo())<br> if (const auto ATL = TSI->getTypeLoc().getAs<ArrayTypeLoc>())<br> SizeExpr = ATL.getSizeExpr();<br>```</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 30, 2020 at 1:24 PM Benedikt Lukas Huber via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I wanted to bump this question. Maybe someone has an idea how to solve this.<br>
<br>
Thank you and best regards,<br>
Benedikt<br>
<br>
________________________________________<br>
From: Benedikt Lukas Huber <benedikt.lukas.huber@catena.tech><br>
Sent: Thursday, January 16, 2020 5:21 PM<br>
To: via cfe-dev<br>
Subject: Prevent folding of integer constant expressions in AST<br>
<br>
Hi,<br>
<br>
I am using ParseAST to traverse the AST provided by clang, using a ConstDeclVisitor, a ConstStmtVisitor and a TypeVisitor.<br>
My problem now is that for expressions such as<br>
<br>
char main_foo[sizeof(int) == sizeof(char) ? 5 : 8];<br>
<br>
I cannot access the expression for the array size, from VisitConstantArrayType(). I can only access the folded numerical value, in this case 8.<br>
Is there a way to access the unfolded expression? Or disable folding of integer constant expressions all together?<br>
I am using clang 6.0.<br>
<br>
Thank you and best regards,<br>
Benedikt<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>