[cfe-commits] P4R: Update initializer's type if checking it updates the decl's type

Chris Lattner clattner at apple.com
Thu Nov 29 09:02:02 PST 2007


On Nov 29, 2007, at 12:50 AM, Oliver Hunt wrote:
> Hurrah!  I was going to look into that tonight -- alas i'm not a  
> reviewer :(

Ah, but everyone is a reviewer:
http://llvm.org/docs/DeveloperPolicy.html#reviews

If you feel familiar enough with the code to do a good job reviewing  
it, feel free to approve it.  We rely on people exercising their own  
judgement to determine whether they are confident that a patch is ok. :)

-Chris

> --Oliver
>
> On 29/11/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.
>>
>>
>> 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
>
> _______________________________________________
> 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/bfff18d7/attachment.html>


More information about the cfe-commits mailing list