[cfe-dev] [PATCH] add constant expression evaluation to the AST and fix PR2413

Chris Lattner clattner at apple.com
Sat Jun 21 16:14:12 PDT 2008


On Jun 9, 2008, at 10:46 PM, Eli Friedman wrote:

> On Sun, Jun 8, 2008 at 7:05 PM, Eli Friedman  
> <eli.friedman at gmail.com> wrote:
>> Attached patch adds some capability to the AST to evaluate constant
>> expressions more general than integer constant expressions.  It then
>> uses that capability to remove the hack added for
>> Sema/darwin-align-cast.c, which fixes PR2413.
>
> This is an updated version with a few minor fixes.

I think this is a great idea, and a huge improvement over  
'CalcFakeICEVal' :).

In addition to the discriminated union, it would also be nice to  
change this to use a StmtVisitor if possible, just to simplify the  
code and make it more modular.  It would be natural to move the  
implementation to its own file if it is large, even though the  
entrypoint would stay a method on Expr.

-Chris



More information about the cfe-dev mailing list