[cfe-commits] P4R: Update initializer's type if checking it updates the decl's type
Chris Lattner
clattner at apple.com
Thu Nov 29 08:59:55 PST 2007
On Nov 29, 2007, at 12:47 AM, Christopher Lamb wrote:
> This was preventing CodeGen for
>
> int ary[] = {1, 2, 3, 4};
>
> because the initializer's type was of the original decl's type with
> an element count of zero.
Looks good to me, please apply. Thanks!
-Chris
>
> Index: Sema/SemaDecl.cpp
> ===================================================================
> --- Sema/SemaDecl.cpp (revision 44432)
> +++ Sema/SemaDecl.cpp (working copy)
> @@ -727,8 +727,10 @@
> // completed by the initializer. For example:
> // int ary[] = { 1, 3, 5 };
> // "ary" transitions from a VariableArrayType to a
> ConstantArrayType.
> - if (!VDecl->isInvalidDecl() && (DclT != SavT))
> + if (!VDecl->isInvalidDecl() && (DclT != SavT)) {
> VDecl->setType(DclT);
> + Init->setType(DclT);
> + }
>
> // Attach the initializer to the decl.
> VDecl->setInit(Init);
>
> --
> Christopher Lamb
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20071129/7a746db8/attachment.html>
More information about the cfe-commits
mailing list