[cfe-dev] Improve constant ImplicitCast codegen

Eli Friedman eli.friedman at gmail.com
Sat Jan 26 09:42:50 PST 2008


Patch attached.

This patch improves VisitImplicitCastExpr in a few ways.  One, it
deals with lvalues correctly, so code like:
struct s {int i[5];} val;
int* t = val.i;
would work (and not crash) if isConstantExpr let it through.
(isConstantExpr needs some improvements... I've hacked my version to
unconditionally return true for testing.)

Secondly, it deals with subsequent casts correctly, so that code like
"int zzzz[] = {zzzz};" doesn't crash in codegen and returns the right
result.

The change to the function type handling doesn't really make a
difference, but it's a bit more consistent with the wording in the
standard.

-Eli
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fiximplicitcast.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080126/addd0d64/attachment.txt>


More information about the cfe-dev mailing list